Documentation ¶
Index ¶
- Constants
- Variables
- type AttrValue
- type AttributeService
- func (s *AttributeService) HistoryRead(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *AttributeService) HistoryUpdate(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *AttributeService) Read(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *AttributeService) Write(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type Attributes
- type DiscoveryService
- func (s *DiscoveryService) FindServers(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *DiscoveryService) FindServersOnNetwork(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *DiscoveryService) GetEndpoints(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *DiscoveryService) RegisterServer(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *DiscoveryService) RegisterServer2(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type Handler
- type Logger
- type MapNamespace
- func (ns *MapNamespace) AddNode(n *Node) *Node
- func (ns *MapNamespace) Attribute(n *ua.NodeID, a ua.AttributeID) *ua.DataValue
- func (ns *MapNamespace) Browse(bd *ua.BrowseDescription) *ua.BrowseResult
- func (s *MapNamespace) ChangeNotification(key string)
- func (s *MapNamespace) GetValue(key string) any
- func (s *MapNamespace) ID() uint16
- func (ns *MapNamespace) Name() string
- func (ns *MapNamespace) Node(id *ua.NodeID) *Node
- func (ns *MapNamespace) Objects() *Node
- func (ns *MapNamespace) Root() *Node
- func (s *MapNamespace) SetAttribute(node *ua.NodeID, attr ua.AttributeID, val *ua.DataValue) ua.StatusCode
- func (ns *MapNamespace) SetID(id uint16)
- func (s *MapNamespace) SetValue(key string, value any)
- type MethodService
- type MonitoredItem
- type MonitoredItemService
- func (s *MonitoredItemService) ChangeNotification(n *ua.NodeID)
- func (s *MonitoredItemService) CreateMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *MonitoredItemService) DeleteMonitoredItem(id uint32)
- func (s *MonitoredItemService) DeleteMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *MonitoredItemService) DeleteSub(id uint32)
- func (s *MonitoredItemService) ModifyMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *MonitoredItemService) NextID() uint32
- func (s *MonitoredItemService) SetMonitoringMode(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *MonitoredItemService) SetTriggering(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type NameSpace
- type Node
- func CurrentTimeNode() *Node
- func NamespacesNode(s *Server) *Node
- func NewFolderNode(nodeID *ua.NodeID, name string) *Node
- func NewNode(id *ua.NodeID, attr Attributes, refs References, val ValueFunc) *Node
- func NewVariableNode(nodeID *ua.NodeID, name string, value any) *Node
- func RootNode() *Node
- func ServerCapabilitiesNodes(s *Server) []*Node
- func ServerStatusNodes(s *Server, ServerNode *Node) []*Node
- func (n *Node) AddObject(o *Node) *Node
- func (n *Node) AddRef(o *Node, rt RefType, forward bool)
- func (n *Node) AddVariable(o *Node) *Node
- func (n *Node) Attribute(id ua.AttributeID) (*AttrValue, error)
- func (n *Node) BrowseName() *ua.QualifiedName
- func (n *Node) DataType() *ua.ExpandedNodeID
- func (n *Node) Description() *ua.LocalizedText
- func (n *Node) DisplayName() *ua.LocalizedText
- func (n *Node) ID() *ua.NodeID
- func (n *Node) NodeClass() ua.NodeClass
- func (n *Node) SetAttribute(id ua.AttributeID, val ua.DataValue) error
- func (n *Node) SetBrowseName(s string)
- func (n *Node) SetDescription(text, locale string)
- func (n *Node) SetDisplayName(text, locale string)
- func (n *Node) SetNodeClass(nc ua.NodeClass)
- func (n *Node) Value() *ua.Variant
- type NodeManagementService
- func (s *NodeManagementService) AddNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *NodeManagementService) AddReferences(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *NodeManagementService) DeleteNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *NodeManagementService) DeleteReferences(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type NodeNameSpace
- func (as *NodeNameSpace) AddNewVariableNode(name string, value any) *Node
- func (as *NodeNameSpace) AddNewVariableStringNode(name string, value any) *Node
- func (as *NodeNameSpace) AddNode(n *Node) *Node
- func (as *NodeNameSpace) Attribute(id *ua.NodeID, attr ua.AttributeID) *ua.DataValue
- func (ns *NodeNameSpace) Browse(bd *ua.BrowseDescription) *ua.BrowseResult
- func (s *NodeNameSpace) ChangeNotification(nodeid *ua.NodeID)
- func (ns *NodeNameSpace) GetNextNodeID() uint32
- func (ns *NodeNameSpace) ID() uint16
- func (ns *NodeNameSpace) Name() string
- func (as *NodeNameSpace) Node(id *ua.NodeID) *Node
- func (as *NodeNameSpace) Objects() *Node
- func (as *NodeNameSpace) Root() *Node
- func (as *NodeNameSpace) SetAttribute(id *ua.NodeID, attr ua.AttributeID, val *ua.DataValue) ua.StatusCode
- func (ns *NodeNameSpace) SetID(id uint16)
- type OperationalLimits
- type Option
- func Certificate(cert []byte) Option
- func EnableAuthMode(tokenType ua.UserTokenType) Option
- func EnableSecurity(secPolicy string, secMode ua.MessageSecurityMode) Option
- func EndPoint(host string, port int) Option
- func ManufacturerName(name string) Option
- func PrivateKey(key *rsa.PrivateKey) Option
- func ProductName(name string) Option
- func ServerName(name string) Option
- func SetLogger(logger Logger) Option
- func SoftwareVersion(name string) Option
- type PubReq
- type QueryService
- type RefType
- type References
- type Server
- func (s *Server) AddNamespace(ns NameSpace) int
- func (s *Server) ChangeNotification(n *ua.NodeID)
- func (s *Server) Close() error
- func (s *Server) Endpoints() []*ua.EndpointDescription
- func (srv *Server) ImportNodeSet(nodes *schema.UANodeSet) error
- func (s *Server) Namespace(id int) (NameSpace, error)
- func (s *Server) Namespaces() []NameSpace
- func (s *Server) Node(nid *ua.NodeID) *Node
- func (s *Server) RegisterHandler(typeID uint16, h Handler)
- func (s *Server) Session(hdr *ua.RequestHeader) *session
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Status() *ua.ServerStatusDataType
- func (s *Server) URLs() []string
- type ServerCapabilities
- type SessionService
- func (s *SessionService) ActivateSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SessionService) Cancel(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SessionService) CloseSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SessionService) CreateSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type Subscription
- type SubscriptionService
- func (s *SubscriptionService) CreateSubscription(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) DeleteSubscription(id uint32)
- func (s *SubscriptionService) DeleteSubscriptions(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) ModifySubscription(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) Publish(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) Republish(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) SetPublishingMode(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *SubscriptionService) TransferSubscriptions(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- type ValueFunc
- type ViewService
- func (s *ViewService) Browse(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *ViewService) BrowseNext(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *ViewService) RegisterNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *ViewService) TranslateBrowsePathsToNodeIDs(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
- func (s *ViewService) UnregisterNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
Constants ¶
const ( RefTypeIDHasComponent = id.HasComponent RefTypeIDOrganizes = id.Organizes )
Variables ¶
var ( ObjectsFolder = ua.NewNumericNodeID(0, id.ObjectsFolder) RootFolder = ua.NewNumericNodeID(0, id.RootFolder) )
Functions ¶
This section is empty.
Types ¶
type AttrValue ¶
func NewAttrValue ¶
type AttributeService ¶
type AttributeService struct {
// contains filtered or unexported fields
}
AttributeService implements the Attribute Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.10
func (*AttributeService) HistoryRead ¶
func (s *AttributeService) HistoryRead(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.10.3
func (*AttributeService) HistoryUpdate ¶
func (s *AttributeService) HistoryUpdate(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.10.5
func (*AttributeService) Read ¶
func (s *AttributeService) Read(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.10.2
func (*AttributeService) Write ¶
func (s *AttributeService) Write(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.10.4
type Attributes ¶
type Attributes map[ua.AttributeID]*ua.Variant
type DiscoveryService ¶
type DiscoveryService struct {
// contains filtered or unexported fields
}
DiscoveryService implements the Discovery Service Set
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4
func (*DiscoveryService) FindServers ¶
func (s *DiscoveryService) FindServers(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4.2
func (*DiscoveryService) FindServersOnNetwork ¶
func (s *DiscoveryService) FindServersOnNetwork(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4.3
func (*DiscoveryService) GetEndpoints ¶
func (s *DiscoveryService) GetEndpoints(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4.4
func (*DiscoveryService) RegisterServer ¶
func (s *DiscoveryService) RegisterServer(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4.5
func (*DiscoveryService) RegisterServer2 ¶
func (s *DiscoveryService) RegisterServer2(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.4.6
type Logger ¶
type Logger interface { Debug(msg string, args ...any) Error(msg string, args ...any) Info(msg string, args ...any) Warn(msg string, args ...any) }
this logger interface is used to allow the user to provide their own logger it is compatible with slog.Logger
type MapNamespace ¶
type MapNamespace struct { Mu sync.RWMutex Data map[string]any // This can be used to be alerted when a value is changed from the opc server ExternalNotification chan string // contains filtered or unexported fields }
This namespaces give a convenient way to have data mapped to the OPC server without having to map your application data to the OCP-UA data abstraction
It (currently) supports ints, floats, strings, and timestamps. No maps inside of maps and no arrays.
To notify subscribers of changes, be sure to call ChangeNotification(key) after changing the value. To be notified of changes from the opc-ua server to the map, receive on ExternalNotification channel
func NewMapNamespace ¶
func NewMapNamespace(srv *Server, name string) *MapNamespace
func (*MapNamespace) AddNode ¶
func (ns *MapNamespace) AddNode(n *Node) *Node
func (*MapNamespace) Attribute ¶
func (ns *MapNamespace) Attribute(n *ua.NodeID, a ua.AttributeID) *ua.DataValue
func (*MapNamespace) Browse ¶
func (ns *MapNamespace) Browse(bd *ua.BrowseDescription) *ua.BrowseResult
func (*MapNamespace) ChangeNotification ¶
func (s *MapNamespace) ChangeNotification(key string)
This function is used to notify OPC UA subscribers if a key was changed without using the SetValue() function
func (*MapNamespace) GetValue ¶
func (s *MapNamespace) GetValue(key string) any
Get the value associated with key from the MapNamespace. This function handles locking and getting the value.
Returns nil if the value doesn't exist.
func (*MapNamespace) ID ¶
func (s *MapNamespace) ID() uint16
func (*MapNamespace) Name ¶
func (ns *MapNamespace) Name() string
func (*MapNamespace) Objects ¶
func (ns *MapNamespace) Objects() *Node
func (*MapNamespace) Root ¶
func (ns *MapNamespace) Root() *Node
func (*MapNamespace) SetAttribute ¶
func (s *MapNamespace) SetAttribute(node *ua.NodeID, attr ua.AttributeID, val *ua.DataValue) ua.StatusCode
func (*MapNamespace) SetID ¶
func (ns *MapNamespace) SetID(id uint16)
func (*MapNamespace) SetValue ¶
func (s *MapNamespace) SetValue(key string, value any)
update the value associated with a key and trigger the change notification to the OPC server
type MethodService ¶
type MethodService struct {
// contains filtered or unexported fields
}
MethodService implements the Method Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.11
func (*MethodService) Call ¶
func (s *MethodService) Call(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.11.2
type MonitoredItem ¶
type MonitoredItem struct { ID uint32 Sub *Subscription Req *ua.MonitoredItemCreateRequest //TODO: use this Mode ua.MonitoringMode }
type MonitoredItemService ¶
type MonitoredItemService struct { SubService *SubscriptionService Mu sync.Mutex // items tracked by ID Items map[uint32]*MonitoredItem // items tracked by node Nodes map[string][]*MonitoredItem // items tracked by subscription Subs map[uint32][]*MonitoredItem // contains filtered or unexported fields }
MonitoredItemService implements the MonitoredItem Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12
func (*MonitoredItemService) ChangeNotification ¶
func (s *MonitoredItemService) ChangeNotification(n *ua.NodeID)
func (*MonitoredItemService) CreateMonitoredItems ¶
func (s *MonitoredItemService) CreateMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12.2
func (*MonitoredItemService) DeleteMonitoredItem ¶
func (s *MonitoredItemService) DeleteMonitoredItem(id uint32)
function to get rid of all references to a specific Monitored Item (by ID number)
func (*MonitoredItemService) DeleteMonitoredItems ¶
func (s *MonitoredItemService) DeleteMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12.6
func (*MonitoredItemService) DeleteSub ¶
func (s *MonitoredItemService) DeleteSub(id uint32)
function to delete all monitored items associated with a specific sub (as indicated by id number)
func (*MonitoredItemService) ModifyMonitoredItems ¶
func (s *MonitoredItemService) ModifyMonitoredItems(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12.3
func (*MonitoredItemService) NextID ¶
func (s *MonitoredItemService) NextID() uint32
func (*MonitoredItemService) SetMonitoringMode ¶
func (s *MonitoredItemService) SetMonitoringMode(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12.4
func (*MonitoredItemService) SetTriggering ¶
func (s *MonitoredItemService) SetTriggering(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.12.5
type NameSpace ¶
type NameSpace interface { // Name of the namespace. Per the standard it should be an URI. Name() string // This function should create a new node AddNode(n *Node) *Node // This function should lookup and return the node indicated by the Node ID Node(id *ua.NodeID) *Node // This function should return the base Objects node that contains other nodes Objects() *Node // This function should return the root node Root() *Node // This is the function to list all available nodes to the client that is browsing. // The BrowseDescription has the root node of the browse and what kind of nodes the // client is looking for. The Browse Result should have the list of matching nodes. Browse(req *ua.BrowseDescription) *ua.BrowseResult // ID and SetID are the namespace ID number of this namespace. When you add it to the server // with srv.AddNamespace(xxx) it will set these for you. ID() uint16 SetID(uint16) // These are the functions for reading and writing arbitrary attributes. The most common // is the value attribute, but many clients also read the datatype and description attributes. // as well as attributes related to array bounds Attribute(*ua.NodeID, ua.AttributeID) *ua.DataValue SetAttribute(*ua.NodeID, ua.AttributeID, *ua.DataValue) ua.StatusCode }
These are all the functions a namespace needs in order to provide nodes into the server
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func CurrentTimeNode ¶
func CurrentTimeNode() *Node
func NamespacesNode ¶
func NewNode ¶
func NewNode(id *ua.NodeID, attr Attributes, refs References, val ValueFunc) *Node
func ServerCapabilitiesNodes ¶
func ServerStatusNodes ¶
func (*Node) AddVariable ¶
func (*Node) BrowseName ¶
func (n *Node) BrowseName() *ua.QualifiedName
func (*Node) DataType ¶
func (n *Node) DataType() *ua.ExpandedNodeID
func (*Node) Description ¶
func (n *Node) Description() *ua.LocalizedText
func (*Node) DisplayName ¶
func (n *Node) DisplayName() *ua.LocalizedText
func (*Node) SetAttribute ¶
func (*Node) SetBrowseName ¶
func (*Node) SetDescription ¶
func (*Node) SetDisplayName ¶
func (*Node) SetNodeClass ¶
type NodeManagementService ¶
type NodeManagementService struct {
// contains filtered or unexported fields
}
NodeManagementService implements the Node Management Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7
func (*NodeManagementService) AddNodes ¶
func (s *NodeManagementService) AddNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.2
func (*NodeManagementService) AddReferences ¶
func (s *NodeManagementService) AddReferences(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.3
func (*NodeManagementService) DeleteNodes ¶
func (s *NodeManagementService) DeleteNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.4
func (*NodeManagementService) DeleteReferences ¶
func (s *NodeManagementService) DeleteReferences(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7.5
type NodeNameSpace ¶
type NodeNameSpace struct { ExternalNotification chan *ua.NodeID // contains filtered or unexported fields }
the base "node-centric" namespace
func NewNameSpace ¶
func NewNameSpace(name string) *NodeNameSpace
func NewNodeNameSpace ¶
func NewNodeNameSpace(srv *Server, name string) *NodeNameSpace
func (*NodeNameSpace) AddNewVariableNode ¶
func (as *NodeNameSpace) AddNewVariableNode(name string, value any) *Node
func (*NodeNameSpace) AddNewVariableStringNode ¶
func (as *NodeNameSpace) AddNewVariableStringNode(name string, value any) *Node
func (*NodeNameSpace) AddNode ¶
func (as *NodeNameSpace) AddNode(n *Node) *Node
func (*NodeNameSpace) Attribute ¶
func (as *NodeNameSpace) Attribute(id *ua.NodeID, attr ua.AttributeID) *ua.DataValue
func (*NodeNameSpace) Browse ¶
func (ns *NodeNameSpace) Browse(bd *ua.BrowseDescription) *ua.BrowseResult
func (*NodeNameSpace) ChangeNotification ¶
func (s *NodeNameSpace) ChangeNotification(nodeid *ua.NodeID)
This function is to notify opc subscribers if a node was changed without using the SetAttribute method
func (*NodeNameSpace) GetNextNodeID ¶
func (ns *NodeNameSpace) GetNextNodeID() uint32
func (*NodeNameSpace) ID ¶
func (ns *NodeNameSpace) ID() uint16
func (*NodeNameSpace) Name ¶
func (ns *NodeNameSpace) Name() string
func (*NodeNameSpace) Objects ¶
func (as *NodeNameSpace) Objects() *Node
func (*NodeNameSpace) Root ¶
func (as *NodeNameSpace) Root() *Node
func (*NodeNameSpace) SetAttribute ¶
func (as *NodeNameSpace) SetAttribute(id *ua.NodeID, attr ua.AttributeID, val *ua.DataValue) ua.StatusCode
func (*NodeNameSpace) SetID ¶
func (ns *NodeNameSpace) SetID(id uint16)
type OperationalLimits ¶
type OperationalLimits struct {
MaxNodesPerRead uint32
}
type Option ¶
type Option func(*serverConfig)
Option is an option function type to modify the configuration.
func Certificate ¶
Certificate sets the client X509 certificate in the secure channel configuration and also detects and sets the ApplicationURI from the URI within the certificate
func EnableAuthMode ¶
func EnableAuthMode(tokenType ua.UserTokenType) Option
EnableAuthMode registers a new user authentication mode to the server. All AuthModes except Anonymous require encryption by default, so EnableSecurity() must also be called with at least one non-"None" SecurityPolicy
func EnableSecurity ¶
func EnableSecurity(secPolicy string, secMode ua.MessageSecurityMode) Option
EnableSecurity registers a new endpoint security mode to the server. This will also register the security policy against each enabled auth mode
func ManufacturerName ¶
func PrivateKey ¶
func PrivateKey(key *rsa.PrivateKey) Option
PrivateKey sets the RSA private key in the secure channel configuration.
func ProductName ¶
func ServerName ¶
func SetLogger ¶
the server.SetLogger takes a server.Logger interface. This interface is met by slog.Logger{}. A simple wrapper could be made for other loggers if they don't already meet the interface.
func SoftwareVersion ¶
type PubReq ¶
type PubReq struct { // The data of the publish request Req *ua.PublishRequest // The request ID (from the header) of the publish request. This has to be used when replying. ID uint32 }
type QueryService ¶
type QueryService struct {
// contains filtered or unexported fields
}
QueryService implements the Query Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.9
func (*QueryService) QueryFirst ¶
func (s *QueryService) QueryFirst(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.9.3
func (*QueryService) QueryNext ¶
func (s *QueryService) QueryNext(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.9.4
type References ¶
type References []*ua.ReferenceDescription
type Server ¶
type Server struct { SubscriptionService *SubscriptionService MonitoredItemService *MonitoredItemService // contains filtered or unexported fields }
Server is a high-level OPC-UA Server
func New ¶
New returns an initialized OPC-UA server. Call Start() afterwards to begin listening and serving connections
func (*Server) AddNamespace ¶
for now, the address space of the server is split up into namespaces. this means that when we look up a node, we need to ask the specific namespace it belongs to for it instead of just a general lookup by ID
the refRoot and refObjects flags can be used to automatically add a reference to the new Namespaces root or objects object respectively to the namespace 0
func (*Server) ChangeNotification ¶
func (*Server) Close ¶
Close gracefully shuts the server down by closing all open connections, and stops listening on all endpoints
func (*Server) Endpoints ¶
func (s *Server) Endpoints() []*ua.EndpointDescription
func (*Server) Namespaces ¶
func (*Server) RegisterHandler ¶
This function allows you to overwrite a handler before you call start.
func (*Server) Session ¶
func (s *Server) Session(hdr *ua.RequestHeader) *session
func (*Server) Start ¶
Start initializes and starts a Server listening on addr If s was not initialized with NewServer(), addr defaults to localhost:0 to let the OS select a random port
func (*Server) Status ¶
func (s *Server) Status() *ua.ServerStatusDataType
Status returns the current server status.
type ServerCapabilities ¶
type ServerCapabilities struct {
OperationalLimits OperationalLimits
}
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService implements the Session Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6
func (*SessionService) ActivateSession ¶
func (s *SessionService) ActivateSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6.3
func (*SessionService) Cancel ¶
func (s *SessionService) Cancel(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6.5
func (*SessionService) CloseSession ¶
func (s *SessionService) CloseSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6.4
func (*SessionService) CreateSession ¶
func (s *SessionService) CreateSession(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6.2
type Subscription ¶
type Subscription struct { Session *session ID uint32 RevisedPublishingInterval float64 RevisedLifetimeCount uint32 RevisedMaxKeepAliveCount uint32 Channel *uasc.SecureChannel SequenceID uint32 //SeqNums map[uint32]struct{} T *time.Ticker NotifyChannel chan *ua.MonitoredItemNotification ModifyChannel chan *ua.ModifySubscriptionRequest // the running flag and shutdown channel are used to signal the background task that it should stop. // multiple places can kill the subscription so make sure you check the running flag using the mutex // before closing the shutdown channel. Mu sync.Mutex // contains filtered or unexported fields }
This is the type that with its run() function will work in the bakground fullfilling subscription publishes.
MonitoredItems will send updates on the NotifyChannel to let the background task know that an event has occured that needs to be published.
func NewSubscription ¶
func NewSubscription() *Subscription
func (*Subscription) Start ¶
func (s *Subscription) Start()
func (*Subscription) Update ¶
func (s *Subscription) Update(req *ua.ModifySubscriptionRequest)
type SubscriptionService ¶
type SubscriptionService struct { // pub sub stuff Mu sync.Mutex Subs map[uint32]*Subscription // contains filtered or unexported fields }
SubscriptionService implements the Subscription Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13
func (*SubscriptionService) CreateSubscription ¶
func (s *SubscriptionService) CreateSubscription(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.2
func (*SubscriptionService) DeleteSubscription ¶
func (s *SubscriptionService) DeleteSubscription(id uint32)
get rid of all references to a subscription and all monitored items that are pointed at this subscription.
func (*SubscriptionService) DeleteSubscriptions ¶
func (s *SubscriptionService) DeleteSubscriptions(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.8
func (*SubscriptionService) ModifySubscription ¶
func (s *SubscriptionService) ModifySubscription(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.3
func (*SubscriptionService) Publish ¶
func (s *SubscriptionService) Publish(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.5
func (*SubscriptionService) Republish ¶
func (s *SubscriptionService) Republish(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.6
func (*SubscriptionService) SetPublishingMode ¶
func (s *SubscriptionService) SetPublishingMode(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.4
func (*SubscriptionService) TransferSubscriptions ¶
func (s *SubscriptionService) TransferSubscriptions(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.13.7
type ViewService ¶
type ViewService struct {
// contains filtered or unexported fields
}
ViewService implements the View Service Set.
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8
func (*ViewService) Browse ¶
func (s *ViewService) Browse(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8.2
func (*ViewService) BrowseNext ¶
func (s *ViewService) BrowseNext(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8.3
func (*ViewService) RegisterNodes ¶
func (s *ViewService) RegisterNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8.5
func (*ViewService) TranslateBrowsePathsToNodeIDs ¶
func (s *ViewService) TranslateBrowsePathsToNodeIDs(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8.4
func (*ViewService) UnregisterNodes ¶
func (s *ViewService) UnregisterNodes(sc *uasc.SecureChannel, r ua.Request, reqID uint32) (ua.Response, error)
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.8.6
Source Files ¶
- attribute_service.go
- channel_broker.go
- discovery_service.go
- method_service.go
- monitored_item_service.go
- namespace_map.go
- namespace_node.go
- namespaces.go
- node.go
- node_mgmt_service.go
- nodeset2_import.go
- query_service.go
- server.go
- server_config.go
- server_nodes.go
- service_handlers.go
- session_broker.go
- session_service.go
- subscription_service.go
- view_service.go