Skip to content

Commit b890196

Browse files
authored
release v3
release v3
2 parents 8876521 + c408e31 commit b890196

File tree

128 files changed

+6677
-7781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+6677
-7781
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
ignore:
22
- "examples"
33
- "**/*_test.go"
4+
- "v3"

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v3
1818

19-
- name: Set up Go 1.18
19+
- name: Set up Go 1.18+
2020
uses: actions/setup-go@v3
2121
with:
2222
go-version: "^1.18" # The Go version to download (if necessary) and use.
23+
check-latest: true
2324

2425
- run: go version
2526

.github/workflows/staticAnalysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v3
1515

16-
- name: Set up Go 1.18
16+
- name: Set up Go 1.18+
1717
uses: actions/setup-go@v3
1818
with:
1919
go-version: "^1.18" # The Go version to download (if necessary) and use.
20+
check-latest: true
2021

2122
- run: go version
2223

.github/workflows/test-for-fork.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ jobs:
1414
os: [ubuntu-latest, windows-latest, macOS-latest]
1515

1616
steps:
17-
- name: Set up Go 1.18
17+
- name: Set up Go 1.18+
1818
uses: actions/setup-go@v3
1919
with:
20-
go-version: ^1.18
20+
go-version: "^1.18"
21+
check-latest: true
22+
23+
- run: go version
2124

2225
# Checks-out repository under $GITHUB_WORKSPACE
2326
- name: Checkout

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ jobs:
2222
os: [ubuntu-latest, windows-latest, macOS-latest]
2323

2424
steps:
25-
- name: Set up Go 1.18
25+
- name: Set up Go 1.18+
2626
uses: actions/setup-go@v3
2727
with:
28-
go-version: ^1.18
28+
go-version: "^1.18"
29+
check-latest: true
30+
31+
- run: go version
2932

3033
# Checks-out repository under $GITHUB_WORKSPACE
3134
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ server
1010
client
1111
!client/
1212
vendor/
13+
v3/
1314

1415
# Test binary, build with `go test -c`
1516
*.test

.golangci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ linters:
2222
# - exhaustive # check exhaustiveness of enum switch statements
2323
- exportloopref # checks for pointers to enclosing loop variables
2424
# - forbidigo # Forbids identifiers
25-
# - forcetypeassert # finds forced type assertions
25+
- forcetypeassert # finds forced type assertions
2626
- gci # Gci control golang package import order and make it always deterministic.
2727
# - gochecknoglobals # Checks that no globals are present in Go code
2828
# - gochecknoinits # Checks that no init functions are present in Go code
2929
# - gocognit # Computes and checks the cognitive complexity of functions
3030
- goconst # Finds repeated strings that could be replaced by a constant
3131
- gocritic # The most opinionated Go source code linter
32-
# - gocyclo # Computes and checks the cyclomatic complexity of functions
32+
- gocyclo # Computes and checks the cyclomatic complexity of functions
3333
# - godox # Tool for detection of FIXME, TODO and other comment keywords
3434
# - goerr113 # Golang linter to check the errors handling expressions
3535
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
@@ -98,22 +98,29 @@ issues:
9898
- path: _test\.go
9999
linters:
100100
- dupl
101+
- forcetypeassert
101102
- gosec
102103

103104
- path: ^test/.*\.go
104105
linters:
105106
- dupl
107+
- forcetypeassert
106108
- gosec
107109

108110
- path: example_test\.go
109111
text: "exitAfterDefer"
110112
linters:
111113
- gocritic
112114

113-
- path: udp/message/getmid.go
115+
- path: message/getmid.go
114116
text: "G404: Use of weak random number generator \\(math/rand instead of crypto/rand\\)"
115117
linters:
116-
- gosec
118+
- gosec
119+
120+
- path: example_test\.go
121+
text: "exitAfterDefer"
122+
linters:
123+
- gocritic
117124

118125
# # Fix found issues (if it's supported by the linter).
119126
# fix: true

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"go.testEnvVars": {
88
// "GOFLAGS":"-mod=vendor",
99
},
10-
"go.testTimeout": "40s"
10+
"go.testTimeout": "40s",
11+
"files.watcherExclude": {
12+
"**/go-coap/v3/**": true
13+
}
1114
}

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![contributors](https://img.shields.io/github/contributors/plgd-dev/go-coap)](https://github.com/plgd-dev/go-coap/graphs/contributors)
99
[![GitHub stars](https://img.shields.io/github/stars/plgd-dev/go-coap)](https://github.com/plgd-dev/go-coap/stargazers)
1010
[![GitHub license](https://img.shields.io/github/license/plgd-dev/go-coap)](https://github.com/plgd-dev/go-coap/blob/master/LICENSE)
11-
[![GoDoc](https://pkg.go.dev/badge/github.com/plgd-dev/go-coap/v2?utm_source=godoc)](https://pkg.go.dev/github.com/plgd-dev/go-coap/v2?utm_source=godoc)
11+
[![GoDoc](https://pkg.go.dev/badge/github.com/plgd-dev/go-coap/v3?utm_source=godoc)](https://pkg.go.dev/github.com/plgd-dev/go-coap/v3?utm_source=godoc)
1212
<!-- [![Go Report](https://goreportcard.com/badge/github.com/plgd-dev/go-coap)](https://goreportcard.com/report/github.com/plgd-dev/go-coap) -->
1313

1414
The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained networks in the Internet of Things.
@@ -36,6 +36,10 @@ The go-coap provides servers and clients for DTLS, TCP-TLS, UDP, TCP in golang l
3636
[pion-dtls]: https://github.com/pion/dtls
3737
[coap-429]: https://datatracker.ietf.org/doc/html/rfc8516
3838

39+
## Requirements
40+
41+
* Go 1.18 or higher
42+
3943
## Samples
4044

4145
### Simple
@@ -48,7 +52,7 @@ The go-coap provides servers and clients for DTLS, TCP-TLS, UDP, TCP in golang l
4852
// Middleware function, which will be called for each request.
4953
func loggingMiddleware(next mux.Handler) mux.Handler {
5054
return mux.HandlerFunc(func(w mux.ResponseWriter, r *mux.Message) {
51-
log.Printf("ClientAddress %v, %v\n", w.Client().RemoteAddr(), r.String())
55+
log.Printf("ClientAddress %v, %v\n", w.Conn().RemoteAddr(), r.String())
5256
next.ServeCOAP(w, r)
5357
})
5458
}

0 commit comments

Comments
 (0)