原生 Go OPC-UA 库
Artwork by Ashley McNamara
Inspired by Renee French
Taken from https://gopherize.me by Mat Ryer
OPC/UA
A native Go implementation of the OPC/UA Binary Protocol.
We support the current and previous major Go release. See below for a list of Tested Platforms and Supported Features.
# install library
go get -u github.com/gopcua/opcua
# get current date and time 'ns=0;i=2258'
go run examples/datetime/datetime.go -endpoint opc.tcp://localhost:4840
# read the server version
go run examples/read/read.go -endpoint opc.tcp://localhost:4840 -node 'ns=0;i=2261'
# get the current date time using different security and authentication modes
go run examples/crypto/*.go -endpoint opc.tcp://localhost:4840 -cert path/to/cert.pem -key path/to/key.pem -sec-policy Basic256 -sec-mode SignAndEncrypt
# checkout examples/ for more examples...
Jonathan Camp (@kung-foo) and Jeremy Theocharis (@JeremyTheocharis) agreed to be the new maintainers. See the full post here: https://github.com/gopcua/opcua/discussions/831
v0.9.0: Node operations now run against a Client interface instead of the concrete *Client type. Code that constructs nodes against the concrete client type must be updated (#847)v0.8.0: ResolveEndpoint signature has changed. It requires a context and returns the remote address as a url.URL`` instead of a *net.TCPAddr`v0.7.2: Tagged the wrong branch, deleted the tag, retracted the version, moved changes to v0.7.3 and v0.7.4 insteadv0.7.0: The node attributes for the server now use ua.DataValue instead of ua.Variant (#766)v0.6.0: The SelectEndpoint function in the client now returns an error (#753)v0.5.1: The NewClient function returns an errorv0.5.0: All Client methods must have a contextThe gopcua project is sponsored by the following organizations by supporting the active committers to the project:
We would also like to list organizations which use gopcua in production:
Please open a PR to include your logo here.
gopcua is not only utilized in production environments, but it also serves as a critical component in other larger projects. Here are some projects that rely on gopcua for their functionality:
gopcua to extract data from OPC-UA servers and insert it into InfluxDB. Telegraf supports both polling and subscribing methods for data acquisition.gopcua to extract data from OPC-UA servers and forwards the information to MQTT or Kafka brokers. benthos-umh currently supports polling for data collection.We are still actively working on this project and the APIs will change.
However, you can safely assume that we are aiming to make the APIs as stable as possible since the code is in use in several large scale production environments.
The Current State was moved to the Wiki.
If you are looking for ways to contribute you can
gopcua to be usefulAlso, if the library is already useful please spread the word as a motivation.
gopcua is run in production by several companies and with different equipment.
The table below is an incomplete list of where and how gopcua is used to provide
some guidance on the level of testing.
We would be happy if you can add your equipment to the list. Just open a PR :)
| Device | gopcua version | Environment | By |
|---|---|---|---|
| Siemens S7-1500 | v0.1.x..latest | production | Northvolt |
| Beckhoff C6015-0010,C6030-0060 on OPC/UA server 4.3.x | v0.1.x..latest | production | Northvolt |
| Kepware 6.x | v0.1.x..latest | production | Northvolt |
| Kepware 6.x | v0.1.x, v0.2.x | production | Intelecy |
| Cogent DataHub 9.x | v0.1.x, v0.2.x | production | Intelecy |
| ABB Ability EdgeInsight 1.8.X | v0.1.x, v0.2.x | production | Intelecy |
| GE Digital Historian 2022 HDA Server | v0.3.x | production | Intelecy |
| B&R Automation PC 3100 | v0.3.x | production | ACS |
| Siemens S7-1200 | v0.3.x | CI/CD testing | UMH |
| WAGO 750-8101 | v0.3.x | CI/CD testing | UMH |
| Microsoft OPC UA simulator v2.9.11 | v0.3.x | CI/CD testing | UMH |
| Prosys OPC UA Simulation Server v5.4.6-148 | v0.3.x | manual testing | UMH |
| Edge Connect OPC-UA Server | v0.3.x | production | IOTech Systems |
| Siemens S7-1200 | v0.3.x | production | IOTech Systems |
| Siemens S7-1500 | v0.3.x | production | IOTech Systems |
| OMRON NX102-9020 | v0.3.x | production | IOTech Systems |
| InfluxDB Telegraf plugin | v0.3.x | ? | Community |
| Bosch Rexroth ctrlX CORE X3 v3.2.x | v0.7.x, v0.8.x | bench testing | rymden software |
The current focus is on the OPC UA Binary protocol over TCP. No other protocols are supported at this point.
| Categories | Features | Supported | Notes |
|---|---|---|---|
| Encoding | OPC UA Binary | Yes | |
| OPC UA JSON | not planned | ||
| OPC UA XML | not planned | ||
| Transport | UA-TCP UA-SC UA Binary | Yes | |
| OPC UA HTTPS | not planned | ||
| SOAP-HTTP WS-SC UA Binary | not planned | ||
| SOAP-HTTP WS-SC UA XML | not planned | ||
| SOAP-HTTP WS-SC UA XML-UA Binary | not planned | ||
| Encryption | None | Yes | |
| Basic128Rsa15 | Yes | ||
| Basic256 | Yes | ||
| Basic256Sha256 | Yes | ||
| Authentication | Anonymous | Yes | |
| User Name Password | Yes | ||
| X509 Certificate | Yes |
The current focus is on the OPC UA Binary protocol over TCP. No other protocols are supported at this point.
| Categories | Features | Supported | Notes |
|---|---|---|---|
| Encoding | OPC UA Binary | Yes | |
| OPC UA JSON | not planned | ||
| OPC UA XML | not planned | ||
| Transport | UA-TCP UA-SC UA Binary | Yes | |
| OPC UA HTTPS | not planned | ||
| SOAP-HTTP WS-SC UA Binary | not planned | ||
| SOAP-HTTP WS-SC UA XML | not planned | ||
| SOAP-HTTP WS-SC UA XML-UA Binary | not planned | ||
| Encryption | None | Yes | |
| Basic128Rsa15 | Untested | ||
| Basic256 | Untested | ||
| Basic256Sha256 | Untested | ||
| Authentication | Anonymous | Yes | |
| User Name Password | Untested | ||
| X509 Certificate | Untested |
Here is the current set of supported services. For low-level access use the client Send funct
暂无开放 Issues,或尚未同步最近议题。