Documentation
¶
Index ¶
- func FindServers(ctx context.Context, request *ua.FindServersRequest) (*ua.FindServersResponse, error)
- func GetEndpoints(ctx context.Context, request *ua.GetEndpointsRequest) (*ua.GetEndpointsResponse, error)
- type Client
- func (ch *Client) Abort(ctx context.Context) error
- func (ch *Client) AddNodes(ctx context.Context, request *ua.AddNodesRequest) (*ua.AddNodesResponse, error)
- func (ch *Client) AddReferences(ctx context.Context, request *ua.AddReferencesRequest) (*ua.AddReferencesResponse, error)
- func (ch *Client) Browse(ctx context.Context, request *ua.BrowseRequest) (*ua.BrowseResponse, error)
- func (ch *Client) BrowseNext(ctx context.Context, request *ua.BrowseNextRequest) (*ua.BrowseNextResponse, error)
- func (ch *Client) Call(ctx context.Context, request *ua.CallRequest) (*ua.CallResponse, error)
- func (ch *Client) Cancel(ctx context.Context, request *ua.CancelRequest) (*ua.CancelResponse, error)
- func (ch *Client) Close(ctx context.Context) error
- func (ch *Client) CreateMonitoredItems(ctx context.Context, request *ua.CreateMonitoredItemsRequest) (*ua.CreateMonitoredItemsResponse, error)
- func (ch *Client) CreateSubscription(ctx context.Context, request *ua.CreateSubscriptionRequest) (*ua.CreateSubscriptionResponse, error)
- func (ch *Client) DeleteMonitoredItems(ctx context.Context, request *ua.DeleteMonitoredItemsRequest) (*ua.DeleteMonitoredItemsResponse, error)
- func (ch *Client) DeleteNodes(ctx context.Context, request *ua.DeleteNodesRequest) (*ua.DeleteNodesResponse, error)
- func (ch *Client) DeleteReferences(ctx context.Context, request *ua.DeleteReferencesRequest) (*ua.DeleteReferencesResponse, error)
- func (ch *Client) DeleteSubscriptions(ctx context.Context, request *ua.DeleteSubscriptionsRequest) (*ua.DeleteSubscriptionsResponse, error)
- func (ch *Client) EndpointURL() string
- func (ch *Client) HistoryRead(ctx context.Context, request *ua.HistoryReadRequest) (*ua.HistoryReadResponse, error)
- func (ch *Client) HistoryUpdate(ctx context.Context, request *ua.HistoryUpdateRequest) (*ua.HistoryUpdateResponse, error)
- func (ch *Client) IsClosing() bool
- func (ch *Client) MaxRequestMessageSize() uint32
- func (ch *Client) ModifyMonitoredItems(ctx context.Context, request *ua.ModifyMonitoredItemsRequest) (*ua.ModifyMonitoredItemsResponse, error)
- func (ch *Client) ModifySubscription(ctx context.Context, request *ua.ModifySubscriptionRequest) (*ua.ModifySubscriptionResponse, error)
- func (ch *Client) Publish(ctx context.Context, request *ua.PublishRequest) (*ua.PublishResponse, error)
- func (ch *Client) Read(ctx context.Context, request *ua.ReadRequest) (*ua.ReadResponse, error)
- func (ch *Client) RegisterNodes(ctx context.Context, request *ua.RegisterNodesRequest) (*ua.RegisterNodesResponse, error)
- func (ch *Client) Republish(ctx context.Context, request *ua.RepublishRequest) (*ua.RepublishResponse, error)
- func (ch *Client) SecurityMode() ua.MessageSecurityMode
- func (ch *Client) SecurityPolicyURI() string
- func (ch *Client) SessionID() ua.NodeID
- func (ch *Client) SessionTimeout() float64
- func (ch *Client) SetMonitoringMode(ctx context.Context, request *ua.SetMonitoringModeRequest) (*ua.SetMonitoringModeResponse, error)
- func (ch *Client) SetPublishingMode(ctx context.Context, request *ua.SetPublishingModeRequest) (*ua.SetPublishingModeResponse, error)
- func (ch *Client) SetTriggering(ctx context.Context, request *ua.SetTriggeringRequest) (*ua.SetTriggeringResponse, error)
- func (ch *Client) TransferSubscriptions(ctx context.Context, request *ua.TransferSubscriptionsRequest) (*ua.TransferSubscriptionsResponse, error)
- func (ch *Client) TranslateBrowsePathsToNodeIDs(ctx context.Context, request *ua.TranslateBrowsePathsToNodeIDsRequest) (*ua.TranslateBrowsePathsToNodeIDsResponse, error)
- func (ch *Client) UnregisterNodes(ctx context.Context, request *ua.UnregisterNodesRequest) (*ua.UnregisterNodesResponse, error)
- func (ch *Client) Write(ctx context.Context, request *ua.WriteRequest) (*ua.WriteResponse, error)
- type Option
- func WithApplicationName(value string) Option
- func WithClientCertificate(cert []byte, privateKey *rsa.PrivateKey) Option
- func WithClientCertificateFile(certPath, keyPath string) Option
- func WithClientCertificatePaths(certPath, keyPath string) Option
- func WithConnectTimeout(value int64) Option
- func WithDiagnosticsHint(value uint32) Option
- func WithInsecureSkipVerify() Option
- func WithIssuedIdentity(tokenData []byte) Option
- func WithIssuerCertificatesPaths(certPath, crlPath string) Option
- func WithRejectedCertificatesPath(path string) Option
- func WithSecurityPolicyURI(uri string, securityMode ua.MessageSecurityMode) Option
- func WithServerCertificate(certDER []byte) Option
- func WithSessionName(value string) Option
- func WithSessionTimeout(value float64) Option
- func WithTimeoutHint(value uint32) Option
- func WithTokenLifetime(value uint32) Option
- func WithTrace() Option
- func WithTransportLimits(maxBufferSize, maxMessageSize, maxChunkCount uint32) Option
- func WithTrustedCertificatesFile(path string) Option
- func WithTrustedCertificatesPaths(certPath, crlPath string) Option
- func WithUserNameIdentity(userName, password string) Option
- func WithX509Identity(certificate []byte, privateKey *rsa.PrivateKey) Option
- func WithX509IdentityFile(certPath, keyPath string) Option
- func WithX509IdentityPaths(certPath, keyPath string) Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindServers ¶
func FindServers(ctx context.Context, request *ua.FindServersRequest) (*ua.FindServersResponse, error)
FindServers returns the Servers known to a Server or Discovery Server. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.4.2/
func GetEndpoints ¶
func GetEndpoints(ctx context.Context, request *ua.GetEndpointsRequest) (*ua.GetEndpointsResponse, error)
GetEndpoints returns the endpoint descriptions supported by the server. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.4.4/
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for exchanging binary encoded requests and responses with an OPC UA server. Uses TCP with the binary security protocol UA-SecureConversation 1.0 and the binary message encoding UA-Binary 1.0.
func (*Client) AddNodes ¶
func (ch *Client) AddNodes(ctx context.Context, request *ua.AddNodesRequest) (*ua.AddNodesResponse, error)
AddNodes adds one or more Nodes into the AddressSpace hierarchy. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.7.2/
func (*Client) AddReferences ¶
func (ch *Client) AddReferences(ctx context.Context, request *ua.AddReferencesRequest) (*ua.AddReferencesResponse, error)
AddReferences adds one or more References to one or more Nodes. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.7.3/
func (*Client) Browse ¶
func (ch *Client) Browse(ctx context.Context, request *ua.BrowseRequest) (*ua.BrowseResponse, error)
Browse discovers the References of a specified Node. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.2/
Example ¶
This example demonstrates browsing the top-level 'Objects' folder of the server.
package main
import (
"context"
"fmt"
"github.com/awcullen/opcua/client"
"github.com/awcullen/opcua/ua"
)
func main() {
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare browse request
req := &ua.BrowseRequest{
NodesToBrowse: []ua.BrowseDescription{
{
NodeID: ua.ParseNodeID("i=85"), // Objects folder
BrowseDirection: ua.BrowseDirectionForward,
ReferenceTypeID: ua.ReferenceTypeIDHierarchicalReferences,
IncludeSubtypes: true,
ResultMask: uint32(ua.BrowseResultMaskTargetInfo),
},
},
}
// send request to server. receive response or error
res, err := ch.Browse(ctx, req)
if err != nil {
fmt.Printf("Error browsing Objects folder. %s\n", err.Error())
ch.Abort(ctx)
return
}
// print results
fmt.Printf("Browse results of NodeID '%s':\n", req.NodesToBrowse[0].NodeID)
for _, r := range res.Results[0].References {
fmt.Printf(" + %s, browseName: %s, nodeClass: %s, nodeId: %s\n", r.DisplayName.Text, r.BrowseName, r.NodeClass, r.NodeID)
}
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
}
Output: Browse results of NodeID 'i=85': + Server, browseName: 0:Server, nodeClass: Object, nodeId: i=2253 + Aliases, browseName: 0:Aliases, nodeClass: Object, nodeId: i=23470 + Demo, browseName: 2:Demo, nodeClass: Object, nodeId: ns=2;s=Demo
func (*Client) BrowseNext ¶
func (ch *Client) BrowseNext(ctx context.Context, request *ua.BrowseNextRequest) (*ua.BrowseNextResponse, error)
BrowseNext requests the next set of Browse responses, when the information is too large to be sent in a single response. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.3/
func (*Client) Call ¶
func (ch *Client) Call(ctx context.Context, request *ua.CallRequest) (*ua.CallResponse, error)
Call invokes a list of Methods. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.11.2/
Example ¶
This example demonstrates calling an method of the server to add two integers and return the sum.
package main
import (
"context"
"fmt"
"github.com/awcullen/opcua/client"
"github.com/awcullen/opcua/ua"
)
func main() {
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithClientCertificatePaths("./pki/client.crt", "./pki/client.key"), // need secure channel to send password
client.WithUserNameIdentity("root", "secret"), // need role of "operator" to call this method
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare call request
req := &ua.CallRequest{
MethodsToCall: []ua.CallMethodRequest{
{
ObjectID: ua.ParseNodeID("ns=2;s=Demo.Methods"), // parent of "MethodIO" method
MethodID: ua.ParseNodeID("ns=2;s=Demo.Methods.MethodIO"), // "MethodIO" method
InputArguments: []ua.Variant{
uint32(6),
uint32(7),
},
},
},
}
// send request to server. receive response or error
res, err := ch.Call(ctx, req)
if err != nil {
fmt.Printf("Error calling method. %s\n", err.Error())
ch.Abort(ctx)
return
}
// print results
fmt.Printf("Call method result:\n")
if res.Results[0].StatusCode.IsGood() {
fmt.Println(res.Results[0].OutputArguments[0].(uint32))
}
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
}
Output: Call method result: 13
func (*Client) Cancel ¶
func (ch *Client) Cancel(ctx context.Context, request *ua.CancelRequest) (*ua.CancelResponse, error)
Cancel sends a cancel request. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.6.5/
func (*Client) CreateMonitoredItems ¶
func (ch *Client) CreateMonitoredItems(ctx context.Context, request *ua.CreateMonitoredItemsRequest) (*ua.CreateMonitoredItemsResponse, error)
CreateMonitoredItems creates and adds one or more MonitoredItems to a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.12.2/
func (*Client) CreateSubscription ¶
func (ch *Client) CreateSubscription(ctx context.Context, request *ua.CreateSubscriptionRequest) (*ua.CreateSubscriptionResponse, error)
CreateSubscription creates a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.2/
Example ¶
This example demonstrates subscribing to the server's 'CurrentTime' variable and receiving data changes.
package main
import (
"context"
"fmt"
"github.com/awcullen/opcua/client"
"github.com/awcullen/opcua/ua"
)
func main() {
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare create subscription request
req := &ua.CreateSubscriptionRequest{
RequestedPublishingInterval: 1000.0,
RequestedMaxKeepAliveCount: 30,
RequestedLifetimeCount: 30 * 3,
PublishingEnabled: true,
}
// send request to server. receive response or error
res, err := ch.CreateSubscription(ctx, req)
if err != nil {
fmt.Printf("Error creating subscription. %s\n", err.Error())
ch.Abort(ctx)
return
}
// prepare create monitored items request
req2 := &ua.CreateMonitoredItemsRequest{
SubscriptionID: res.SubscriptionID,
TimestampsToReturn: ua.TimestampsToReturnBoth,
ItemsToCreate: []ua.MonitoredItemCreateRequest{
{
ItemToMonitor: ua.ReadValueID{
NodeID: ua.VariableIDServerServerStatusCurrentTime,
AttributeID: ua.AttributeIDValue,
},
MonitoringMode: ua.MonitoringModeReporting,
// specify a unique ClientHandle. The ClientHandle is returned in the PublishResponse
RequestedParameters: ua.MonitoringParameters{
ClientHandle: 42, QueueSize: 1, DiscardOldest: true, SamplingInterval: 1000.0},
},
},
}
// send request to server. receive response or error
_, err = ch.CreateMonitoredItems(ctx, req2)
if err != nil {
fmt.Printf("Error creating item. %s\n", err.Error())
ch.Abort(ctx)
return
}
// prepare an initial publish request
req3 := &ua.PublishRequest{
RequestHeader: ua.RequestHeader{TimeoutHint: 60000},
SubscriptionAcknowledgements: []ua.SubscriptionAcknowledgement{},
}
// loop until 3 data changes received.
numChanges := 0
for numChanges < 3 {
// send publish request to the server.
res3, err := ch.Publish(ctx, req3)
if err != nil {
break
}
// loop thru all the notifications in the response.
for _, data := range res3.NotificationMessage.NotificationData {
switch body := data.(type) {
case ua.DataChangeNotification:
// the data change notification contains a slice of monitored item notifications.
for _, item := range body.MonitoredItems {
// each monitored item notification contains a clientHandle and dataValue.
if item.ClientHandle == 42 {
fmt.Println("<the current utc time here>" /* item.Value.Value */)
numChanges++
}
}
}
}
// prepare another publish request
req3 = &ua.PublishRequest{
RequestHeader: ua.RequestHeader{TimeoutHint: 60000},
SubscriptionAcknowledgements: []ua.SubscriptionAcknowledgement{
{SequenceNumber: res3.NotificationMessage.SequenceNumber, SubscriptionID: res3.SubscriptionID},
},
}
}
// success after receiving 3 data changes.
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
}
Output: <the current utc time here> <the current utc time here> <the current utc time here>
func (*Client) DeleteMonitoredItems ¶
func (ch *Client) DeleteMonitoredItems(ctx context.Context, request *ua.DeleteMonitoredItemsRequest) (*ua.DeleteMonitoredItemsResponse, error)
DeleteMonitoredItems removes one or more MonitoredItems of a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.12.6/
func (*Client) DeleteNodes ¶
func (ch *Client) DeleteNodes(ctx context.Context, request *ua.DeleteNodesRequest) (*ua.DeleteNodesResponse, error)
DeleteNodes deletes one or more Nodes from the AddressSpace. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.7.4/
func (*Client) DeleteReferences ¶
func (ch *Client) DeleteReferences(ctx context.Context, request *ua.DeleteReferencesRequest) (*ua.DeleteReferencesResponse, error)
DeleteReferences deletes one or more References of a Node. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.7.5/
func (*Client) DeleteSubscriptions ¶
func (ch *Client) DeleteSubscriptions(ctx context.Context, request *ua.DeleteSubscriptionsRequest) (*ua.DeleteSubscriptionsResponse, error)
DeleteSubscriptions deletes one or more Subscriptions. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.8/
func (*Client) EndpointURL ¶
EndpointURL gets the EndpointURL of the server.
func (*Client) HistoryRead ¶
func (ch *Client) HistoryRead(ctx context.Context, request *ua.HistoryReadRequest) (*ua.HistoryReadResponse, error)
HistoryRead returns historical values or events of one or more Nodes. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.10.3/
func (*Client) HistoryUpdate ¶
func (ch *Client) HistoryUpdate(ctx context.Context, request *ua.HistoryUpdateRequest) (*ua.HistoryUpdateResponse, error)
HistoryUpdate sets historical values or events of one or more Nodes. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.10.5/
func (*Client) MaxRequestMessageSize ¶
MaxRequestMessageSize gets the maximum size for the body of any request message. Zero equals no limit.
func (*Client) ModifyMonitoredItems ¶
func (ch *Client) ModifyMonitoredItems(ctx context.Context, request *ua.ModifyMonitoredItemsRequest) (*ua.ModifyMonitoredItemsResponse, error)
ModifyMonitoredItems modifies MonitoredItems of a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.12.3/
func (*Client) ModifySubscription ¶
func (ch *Client) ModifySubscription(ctx context.Context, request *ua.ModifySubscriptionRequest) (*ua.ModifySubscriptionResponse, error)
ModifySubscription modifies a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.3/
func (*Client) Publish ¶
func (ch *Client) Publish(ctx context.Context, request *ua.PublishRequest) (*ua.PublishResponse, error)
Publish requests the Server to return a NotificationMessage or a keep-alive Message. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.5/
func (*Client) Read ¶
func (ch *Client) Read(ctx context.Context, request *ua.ReadRequest) (*ua.ReadResponse, error)
Read returns values of Attributes of one or more Nodes. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.10.2/
Example ¶
This example demonstrates reading the 'ServerStatus' variable.
package main
import (
"context"
"fmt"
"github.com/awcullen/opcua/client"
"github.com/awcullen/opcua/ua"
)
func main() {
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare read request
req := &ua.ReadRequest{
NodesToRead: []ua.ReadValueID{
{
NodeID: ua.VariableIDServerServerStatus,
AttributeID: ua.AttributeIDValue,
},
},
}
// send request to server. receive response or error
res, err := ch.Read(ctx, req)
if err != nil {
fmt.Printf("Error reading ServerStatus. %s\n", err.Error())
ch.Abort(ctx)
return
}
// print results
if serverStatus, ok := res.Results[0].Value.(ua.ServerStatusDataType); ok {
fmt.Printf("Server status:\n")
fmt.Printf(" ProductName: %s\n", serverStatus.BuildInfo.ProductName)
fmt.Printf(" ManufacturerName: %s\n", serverStatus.BuildInfo.ManufacturerName)
fmt.Printf(" State: %s\n", serverStatus.State)
} else {
fmt.Println("Error decoding ServerStatus.")
}
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
}
Output: Server status: ProductName: testserver ManufacturerName: awcullen State: Running
Example (Array) ¶
This example demonstrates reading an multidimensional array variable.
package main
import (
"context"
"fmt"
"github.com/awcullen/opcua/client"
"github.com/awcullen/opcua/ua"
)
func main() {
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare read request
req := &ua.ReadRequest{
NodesToRead: []ua.ReadValueID{
{
NodeID: ua.ParseNodeID("ns=2;s=Demo.Static.Arrays.Matrix"),
AttributeID: ua.AttributeIDValue,
},
},
}
// send request to server. receive response or error
res, err := ch.Read(ctx, req)
if err != nil {
fmt.Printf("Error reading ServerStatus. %s\n", err.Error())
ch.Abort(ctx)
return
}
// print results
if val, ok := res.Results[0].Value.([][][]int32); ok {
fmt.Println(val)
} else {
fmt.Println("Error decoding [][][]int32.")
}
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
}
Output: [[[0 1 2] [3 4 5] [6 7 8] [9 10 11]] [[12 13 14] [15 16 17] [18 19 20] [21 22 23]]]
Example (Customstruct) ¶
This example demonstrates reading the 'CustomStruct' variable.
ctx := context.Background()
// open a connection to testserver running locally. Testserver is started if not already running.
ch, err := client.Dial(
ctx,
"opc.tcp://localhost:46010",
client.WithInsecureSkipVerify(), // skips verification of server certificate
)
if err != nil {
fmt.Printf("Error opening client connection. %s\n", err.Error())
return
}
// prepare read request
req := &ua.ReadRequest{
NodesToRead: []ua.ReadValueID{
{
NodeID: ua.ParseNodeID("ns=2;i=14"),
AttributeID: ua.AttributeIDValue,
},
},
}
// send request to server. receive response or error
res, err := ch.Read(ctx, req)
if err != nil {
fmt.Printf("Error reading CustomStruct. %s\n", err.Error())
ch.Abort(ctx)
return
}
// print results
if custom, ok := res.Results[0].Value.(CustomStruct); ok {
fmt.Printf("CustomStruct:\n")
fmt.Printf(" W1: %d\n", custom.W1)
fmt.Printf(" W2: %d\n", custom.W2)
} else {
fmt.Println("Error decoding CustomStruct.")
}
// close connection
err = ch.Close(ctx)
if err != nil {
ch.Abort(ctx)
return
}
Output: CustomStruct: W1: 1 W2: 2
func (*Client) RegisterNodes ¶
func (ch *Client) RegisterNodes(ctx context.Context, request *ua.RegisterNodesRequest) (*ua.RegisterNodesResponse, error)
RegisterNodes registers the Nodes that will be accessed repeatedly (e.g. Write, Call). See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.5/
func (*Client) Republish ¶
func (ch *Client) Republish(ctx context.Context, request *ua.RepublishRequest) (*ua.RepublishResponse, error)
Republish requests the Server to republish a NotificationMessage from its retransmission queue. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.6/
func (*Client) SecurityMode ¶
func (ch *Client) SecurityMode() ua.MessageSecurityMode
SecurityMode gets the MessageSecurityMode of the secure channel.
func (*Client) SecurityPolicyURI ¶
SecurityPolicyURI gets the SecurityPolicyURI of the secure channel.
func (*Client) SessionTimeout ¶
SessionTimeout gets the maximum number of milliseconds that the session will remain open without activity.
func (*Client) SetMonitoringMode ¶
func (ch *Client) SetMonitoringMode(ctx context.Context, request *ua.SetMonitoringModeRequest) (*ua.SetMonitoringModeResponse, error)
SetMonitoringMode sets the monitoring mode for one or more MonitoredItems of a Subscription. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.12.4/
func (*Client) SetPublishingMode ¶
func (ch *Client) SetPublishingMode(ctx context.Context, request *ua.SetPublishingModeRequest) (*ua.SetPublishingModeResponse, error)
SetPublishingMode enables sending of Notifications on one or more Subscriptions. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.4/
func (*Client) SetTriggering ¶
func (ch *Client) SetTriggering(ctx context.Context, request *ua.SetTriggeringRequest) (*ua.SetTriggeringResponse, error)
SetTriggering creates and deletes triggering links for a triggering item. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.12.5/
func (*Client) TransferSubscriptions ¶
func (ch *Client) TransferSubscriptions(ctx context.Context, request *ua.TransferSubscriptionsRequest) (*ua.TransferSubscriptionsResponse, error)
TransferSubscriptions ransfers a Subscription and its MonitoredItems from one Session to another. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.7/
func (*Client) TranslateBrowsePathsToNodeIDs ¶
func (ch *Client) TranslateBrowsePathsToNodeIDs(ctx context.Context, request *ua.TranslateBrowsePathsToNodeIDsRequest) (*ua.TranslateBrowsePathsToNodeIDsResponse, error)
TranslateBrowsePathsToNodeIDs translates one or more browse paths to NodeIDs. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.4/
func (*Client) UnregisterNodes ¶
func (ch *Client) UnregisterNodes(ctx context.Context, request *ua.UnregisterNodesRequest) (*ua.UnregisterNodesResponse, error)
UnregisterNodes unregisters NodeIDs that have been obtained via the RegisterNodes service. See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.6/
func (*Client) Write ¶
func (ch *Client) Write(ctx context.Context, request *ua.WriteRequest) (*ua.WriteResponse, error)
Write sets values of Attributes of one or more Nodes See https://reference.opcfoundation.org/v104/Core/docs/Part4/5.10.4/
type Option ¶
Option is a functional option to be applied to a client during initialization.
func WithApplicationName ¶
WithApplicationName sets the name of the client application. (default: package name)
func WithClientCertificate ¶
func WithClientCertificate(cert []byte, privateKey *rsa.PrivateKey) Option
WithClientCertificate sets the client certificate and private key.
func WithClientCertificateFile ¶
WithClientCertificateFile sets the file paths of the client certificate and private key. Reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data. DEPRECIATED. Use WithClientCertificatePaths().
func WithClientCertificatePaths ¶
WithClientCertificatePaths sets the paths of the client certificate and private key. Reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data.
func WithConnectTimeout ¶
WithConnectTimeout sets the number of milliseconds to wait for a connection response. (default:5000)
func WithDiagnosticsHint ¶
WithDiagnosticsHint sets the default diagnostic hint that is sent in a request. (default: None)
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify() Option
WithInsecureSkipVerify skips verification of server certificate. Skips checking HostName, Expiration, and Authority.
func WithIssuedIdentity ¶
WithIssuedIdentity sets the user identity to an IssuedIdentity created from token data. (default: AnonymousIdentity)
func WithIssuerCertificatesPaths ¶
WithIssuerCertificatesPath sets the file path of the issuer certificates and revocation lists. Issuer certificates are needed for validation, but are not trusted. Path may be to a file, comma-separated list of files, or directory.
func WithRejectedCertificatesPath ¶
WithRejectedCertificatesPath sets the file path where rejected certificates are stored. Path must be to a directory.
func WithSecurityPolicyURI ¶
func WithSecurityPolicyURI(uri string, securityMode ua.MessageSecurityMode) Option
WithSecurityPolicyURI selects endpoint with given security policy URI and MessageSecurityMode. (default: "" selects most secure endpoint)
func WithServerCertificate ¶
WithServerCertificate pre-loads the server's DER certificate so that Dial() can skip the None-security GetEndpoints discovery call. Use this when the server refuses None-security discovery channels. When this option is set and the security policy is not BestAvailable, Dial() connects directly without first calling GetEndpoints.
func WithSessionName ¶
WithSessionName sets the name of the session. (default: server assigned)
func WithSessionTimeout ¶
WithSessionTimeout sets the number of milliseconds that a session may be unused before being closed by the server. (default: 2 min)
func WithTimeoutHint ¶
WithTimeoutHint sets the default number of milliseconds to wait before the ServiceRequest is cancelled. (default: 1500)
func WithTokenLifetime ¶
WithTokenLifetime sets the requested number of milliseconds before a security token is renewed. (default: 60 min)
func WithTrace ¶
func WithTrace() Option
WithTrace logs all ServiceRequests and ServiceResponses to StdOut.
func WithTransportLimits ¶
WithTransportLimits sets the limits on the size of the buffers and messages. (default: 64Kb, 64Mb, 4096)
func WithTrustedCertificatesFile ¶
WithTrustedCertificatesFile sets the file path of the trusted server certificates or certificate authorities. The file must contain PEM encoded data. DEPRECIATED. Use WithTrustedCertificatesPath().
func WithTrustedCertificatesPaths ¶
WithTrustedCertificatesPaths sets the file path of the trusted certificates and revocation lists. Path may be to a file, comma-separated list of files, or directory.
func WithUserNameIdentity ¶
WithUserNameIdentity sets the user identity to a UserNameIdentity created from a username and password. (default: AnonymousIdentity)
func WithX509Identity ¶
func WithX509Identity(certificate []byte, privateKey *rsa.PrivateKey) Option
WithX509Identity sets the user identity to an X509Identity created from a certificate and private key. (default: AnonymousIdentity)
func WithX509IdentityFile ¶
WithX509IdentityFile sets the user identity to an X509Identity created from the file paths of the certificate and private key. (default: AnonymousIdentity) Reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data. DEPRECIATED. Use WithX509IdentityPaths().
func WithX509IdentityPaths ¶
WithX509IdentityPaths sets the user identity to an X509Identity created from the file paths of the certificate and private key. (default: AnonymousIdentity) Reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data.