guma

package module
v0.0.0-...-54cfa85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 0 Imported by: 0

README

Guma (deprecated)

Disclaimer: The code as it stands, is released as an inspiration to others, but does not offer a high-level interface and probably contain some bugs.

History

In Searis, we have the experience from having developed a OPC UA library in Go already back in 2014, although for a specific purpose, so GUMA was actually our second attempt where we started from scratch, and moved from mostly hand-written code to mostly generated code.

GUMA was written to be a general purpose open source OPC UA client library for the Go programming language. However, due to priorities and limited resources we never made it so far, and the project has been on hold since Nov 22, 2017, shrotly after the work had started.

Recently we have dicovered that there is another open source initative for OPC UA in Go that has gained traction, and we have chosen to finally deprecate this project. However, we also want to share what we have learned, and have chosen to open soure the code as an inspiration to others under an MIT License. It's also possible to fork or adopt this project if the code base is of particular interest to anyone.

Image of the Guma

Repository structure

At the moment, this repo includes the following:

  • generate/scripts:
    • A script to download the OPC UA XML and CSV schemas.
  • generate/cmd:
    • Commands used to generate code structures from XML and CSV.
  • stack
    • A low level client for talking to OPC UA servers
  • stack/uatype:
    • A package exporting a set of Go types that has mostly been generated from source.
  • stack/transport:
    • A parent package for OPC UA Secure Channel implementations.
  • stack/ecoding/binary:
    • A package similar to encoding/json in the standard library, that allows encoding of structs into an OPC UA binary representation.

Status

  • Handshake and opening of Secure Channel.
  • Closing a secure channel (easy, but not implemented).
  • Access to all OPC UA Service calls, such as Read, Browse and Subscribe.
  • SecureChannel made safe for concurrent access (necesary for e.g. Subscribe).
  • Secure channel Message signing and encryption.
  • Stateless HTTPS / HTTP.
  • Reconnect TCP Socket on errors.
  • Re-new Secure Channels at 75% of revised lifetine.

Development

To re-generate code, we rely on Go task:

task generate

See all tasks with task -l.

Known issues: patch to schema XML files no longer applies (OPC UA 1.03):

$ task download-schema
...
Hunk #175 succeeded at 2361 (offset 30 lines).
Hunk #176 FAILED at 2375.
1 out of 176 hunks FAILED -- saving rejects to file schemas/1.03/Opc.Ua.Types.bsd.xml.rej
$ cat schemas/1.03/Opc.Ua.Types.bsd.xml.rej                                                                              :(
***************
*** 2378
- </opc:TypeDictionary>--- 2375 -----
+ </opc:TypeDictionary>

Run unit-tests:

dep ensure
go test -v ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Output(calldepth int, s string) error
}

Logger defines the interface that is required when providing a debug logger for a guma a package. Some guma package provice a `SetDebugLogger` function which can be called to enable logging from that package.

Directories

Path Synopsis
examples
stack-client command
generate
cmd/csv2code command
internal
log
encoding/binary
Package binary provide functionality for encoding Go types into OPC UA binary representation as defined by [IEC-62541](https://webstore.iec.ch/webstore/webstore.nsf/mysearchajax?Openform&key=62541).
Package binary provide functionality for encoding Go types into OPC UA binary representation as defined by [IEC-62541](https://webstore.iec.ch/webstore/webstore.nsf/mysearchajax?Openform&key=62541).
transport/uacp
Package uacp provides an implementation of the OPC UA Connection Protocol and provides a transport.SecureChannel implementation that works with any UACP compatible middleware.
Package uacp provides an implementation of the OPC UA Connection Protocol and provides a transport.SecureChannel implementation that works with any UACP compatible middleware.
uatype
Package uatype provides mostly auto-generated types used for marshalling and unmarshalling of objects for the OPC UA v1.03 binary protocol.
Package uatype provides mostly auto-generated types used for marshalling and unmarshalling of objects for the OPC UA v1.03 binary protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL