Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4.0 #662

Merged
merged 3 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,17 @@

A native Go implementation of the OPC/UA Binary Protocol.

You need go1.13 or higher. We test with the current and previous Go version.
We support the current and previous major Go release.
See below for a list of [Tested Platforms](#tested-platforms) and [Supported Features](#supported-features).

[![GitHub](https://github.com/gopcua/opcua/workflows/gopuca/badge.svg)](https://github.com/gopcua/opcua/actions)
[![Go Reference](https://pkg.go.dev/badge/github.com/gopcua/opcua.svg)](https://pkg.go.dev/github.com/gopcua/opcua)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/gopcua/opcua/blob/master/LICENSE)
[![Version](https://img.shields.io/github/tag/gopcua/opcua.svg?color=blue&label=version)](https://github.com/gopcua/opcua/releases)

## Note

`v0.2.4` and `v0.2.5` are broken and should not be used. Please upgrade to `v0.2.6` or later.
See [#538](https://github.com/gopcua/opcua/issues/538) for details.

## Quickstart

```sh
# make sure you have go1.17 or higher

# install library
go get -u github.com/gopcua/opcua

Expand Down Expand Up @@ -95,11 +88,9 @@ We would also like to list organizations which use `gopcua` in production. Pleas

We are still actively working on this project and the APIs will change.

We have started to tag the code to support go modules and reproducible builds
but there is still no guarantee of API stability.

However, you can safely assume that we are aiming to make the APIs as
stable as possible. :)
stable as possible since the code is in use in several large scale
production environments.

The [Current State](https://github.com/gopcua/opcua/wiki/Current-State) was moved
to the [Wiki](https://github.com/gopcua/opcua/wiki).
Expand Down
9 changes: 0 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1431,15 +1431,6 @@ func safeAssign(t, ptrT interface{}) error {
return nil
}

func uint32SliceContains(n uint32, a []uint32) bool {
for _, v := range a {
if n == v {
return true
}
}
return false
}

type InvalidResponseTypeError struct {
got, want interface{}
}
Expand Down
3 changes: 2 additions & 1 deletion client_sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/gopcua/opcua/stats"
"github.com/gopcua/opcua/ua"
"github.com/gopcua/opcua/uasc"
"golang.org/x/exp/slices"
)

// Subscribe creates a Subscription with given parameters.
Expand Down Expand Up @@ -156,7 +157,7 @@ func (c *Client) sendRepublishRequests(ctx context.Context, sub *Subscription, a
// todo(fs): check if sub.nextSeq is in the available sequence numbers
// todo(fs): if not then we need to decide whether we fail b/c of data loss
// todo(fs): or whether we log it and continue.
if len(availableSeq) > 0 && !uint32SliceContains(sub.nextSeq, availableSeq) {
if len(availableSeq) > 0 && !slices.Contains(availableSeq, sub.nextSeq) {
log.Printf("sub %d: next sequence number %d not in retransmission buffer %v", sub.SubscriptionID, sub.nextSeq, availableSeq)
}

Expand Down
13 changes: 3 additions & 10 deletions debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"log"
"os"
"strings"

"golang.org/x/exp/slices"
)

// Flags contains the debug flags set by OPC_DEBUG.
Expand Down Expand Up @@ -58,14 +60,5 @@ func ToJSON(v interface{}) string {
// FlagSet returns true if the OPCUA_DEBUG environment variable contains the
// given flag.
func FlagSet(name string) bool {
return stringSliceContains(name, strings.Fields(Flags))
}

func stringSliceContains(s string, vals []string) bool {
for _, v := range vals {
if s == v {
return true
}
}
return false
return slices.Contains(strings.Fields(Flags), name)
}
16 changes: 11 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ module github.com/gopcua/opcua
go 1.20

require (
github.com/pascaldekloe/goe v0.1.0
github.com/pkg/errors v0.8.1
golang.org/x/crypto v0.7.0
github.com/pascaldekloe/goe v0.1.1
github.com/pkg/errors v0.9.1
golang.org/x/crypto v0.9.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
)

require (
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
)

retract (
v0.2.5 // https://github.com/gopcua/opcua/issues/538
v0.2.4 // https://github.com/gopcua/opcua/issues/538
)
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
github.com/pascaldekloe/goe v0.1.1 h1:Ah6WQ56rZONR3RW3qWa2NCZ6JAVvSpUcoLBaOmYFt9Q=
github.com/pascaldekloe/goe v0.1.1/go.mod h1:KSyfaxQOh0HZPjDP1FL/kFtbqYqrALJTaMafFUIccqU=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=