diff --git a/.licensed.yml b/.licensed.yml index 25d5cda8..9ff10357 100644 --- a/.licensed.yml +++ b/.licensed.yml @@ -4,6 +4,10 @@ reviewed: - golang.org/x/crypto/curve25519/internal/field - golang.org/x/crypto/internal/poly1305 - golang.org/x/crypto/curve25519 + - golang.org/x/net/bpf + - golang.org/x/net/internal/iana + - golang.org/x/net/internal/socket + - golang.org/x/net/ipv4 - google.golang.org/protobuf/encoding/protojson - google.golang.org/protobuf/internal/encoding/json - github.com/klauspost/compress diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino.dep.yml index 1b50329e..0b130cee 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores.dep.yml index 4db7455f..8c5d103d 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/cores -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/cores license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packageindex.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packageindex.dep.yml index a1a9ad53..d8fed56b 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packageindex.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packageindex.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/cores/packageindex -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/cores/packageindex license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packagemanager.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packagemanager.dep.yml index 2a98e9af..a34672ac 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packagemanager.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/cores/packagemanager.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/cores/packagemanager -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/cores/packagemanager license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery.dep.yml index 7333fe0d..8c434189 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/discovery -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/discovery license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery/discoverymanager.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery/discoverymanager.dep.yml index 4eab991b..79fcf196 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery/discoverymanager.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/discovery/discoverymanager.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/discovery/discoverymanager -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/discovery/discoverymanager license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/globals.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/globals.dep.yml index 384f866f..f9fb5093 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/globals.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/globals.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/globals -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/globals license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/httpclient.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/httpclient.dep.yml index cdb9ba4d..98d8895c 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/httpclient.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/httpclient.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/httpclient -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/httpclient license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries.dep.yml index 6cb8090d..f12eea8b 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/libraries -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/libraries license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesindex.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesindex.dep.yml index d1ae1b74..cf177401 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesindex.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesindex.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/libraries/librariesindex -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/libraries/librariesindex license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.dep.yml index 1d8119ec..ffcbf7f8 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/libraries/librariesmanager -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/libraries/librariesmanager license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/resources.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/resources.dep.yml index 9896b30a..55e64f7c 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/resources.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/resources.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/resources -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/resources license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/security.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/security.dep.yml index ecc024a3..308e9ab8 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/security.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/security.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/security -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/security license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/serialutils.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/serialutils.dep.yml index 203433c7..2f3169c8 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/serialutils.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/serialutils.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/serialutils -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/serialutils license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/sketch.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/sketch.dep.yml index 778d30a7..bdd0aa8d 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/sketch.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/sketch.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/sketch -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/sketch license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/arduino/utils.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/arduino/utils.dep.yml index 110f64d6..f6af2731 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/arduino/utils.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/arduino/utils.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/arduino/utils -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/arduino/utils license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/cli/errorcodes.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/cli/errorcodes.dep.yml index 8ffd6572..a2231c53 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/cli/errorcodes.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/cli/errorcodes.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/cli/errorcodes -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/cli/errorcodes license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/cli/feedback.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/cli/feedback.dep.yml index 1310719c..b7ad6c1c 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/cli/feedback.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/cli/feedback.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/cli/feedback -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/cli/feedback license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/cli/globals.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/cli/globals.dep.yml index ff66309b..6a05de77 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/cli/globals.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/cli/globals.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/cli/globals -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/cli/globals license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/cli/instance.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/cli/instance.dep.yml index a6d996a5..da28827e 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/cli/instance.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/cli/instance.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/cli/instance -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/cli/instance license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/cli/output.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/cli/output.dep.yml index 53b8e7dc..835ddc68 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/cli/output.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/cli/output.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/cli/output -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/cli/output license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/commands.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/commands.dep.yml index 60b9d7d0..18a5dc4f 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/commands.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/commands.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/commands -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/commands license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/commands/board.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/commands/board.dep.yml index 578a7576..822403ef 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/commands/board.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/commands/board.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/commands/board -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/commands/board license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/commands/upload.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/commands/upload.dep.yml index e6911982..2986961d 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/commands/upload.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/commands/upload.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/commands/upload -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/commands/upload license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/configuration.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/configuration.dep.yml index 1d247959..9b25a6d6 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/configuration.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/configuration.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/configuration -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/configuration license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/executils.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/executils.dep.yml index d480b834..cb2692b0 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/executils.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/executils.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/executils -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/executils license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/i18n.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/i18n.dep.yml index ab465351..1e91f5cb 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/i18n.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/i18n.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/i18n -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/i18n license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/.licenses/go/github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.dep.yml index 30bcbc74..287ac582 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1 -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1 license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/table.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/table.dep.yml index 0bbeaf16..4d8e29a0 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/table.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/table.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/table -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/table license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/arduino/arduino-cli/version.dep.yml b/.licenses/go/github.com/arduino/arduino-cli/version.dep.yml index b9a1b664..7f1e928b 100644 --- a/.licenses/go/github.com/arduino/arduino-cli/version.dep.yml +++ b/.licenses/go/github.com/arduino/arduino-cli/version.dep.yml @@ -1,12 +1,12 @@ --- name: github.com/arduino/arduino-cli/version -version: v0.0.0-20240927141754-d9dd4ba1ed71 +version: v0.0.0-20250901123057-20dd7c932f59 type: go summary: homepage: https://pkg.go.dev/github.com/arduino/arduino-cli/version license: gpl-3.0 licenses: -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/LICENSE.txt +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/LICENSE.txt text: |2 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -682,7 +682,7 @@ licenses: the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -- sources: arduino-cli@v0.0.0-20240927141754-d9dd4ba1ed71/README.md +- sources: arduino-cli@v0.0.0-20250901123057-20dd7c932f59/README.md text: |- Arduino CLI is licensed under the [GPL 3.0] license. diff --git a/.licenses/go/github.com/beevik/ntp.dep.yml b/.licenses/go/github.com/beevik/ntp.dep.yml new file mode 100644 index 00000000..951e20d6 --- /dev/null +++ b/.licenses/go/github.com/beevik/ntp.dep.yml @@ -0,0 +1,36 @@ +--- +name: github.com/beevik/ntp +version: v1.4.3 +type: go +summary: Package ntp provides an implementation of a Simple NTP (SNTP) client capable + of querying the current time from a remote NTP server. +homepage: https://pkg.go.dev/github.com/beevik/ntp +license: bsd-2-clause +licenses: +- sources: LICENSE + text: | + Copyright © 2015-2023 Brett Vickers. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +notices: [] diff --git a/.licenses/go/go.bug.st/relaxed-semver.dep.yml b/.licenses/go/go.bug.st/relaxed-semver.dep.yml index bc044af9..90ec5ac2 100644 --- a/.licenses/go/go.bug.st/relaxed-semver.dep.yml +++ b/.licenses/go/go.bug.st/relaxed-semver.dep.yml @@ -1,6 +1,6 @@ --- name: go.bug.st/relaxed-semver -version: v0.9.0 +version: v0.10.1 type: go summary: homepage: https://pkg.go.dev/go.bug.st/relaxed-semver diff --git a/.licenses/go/golang.org/x/crypto/blowfish.dep.yml b/.licenses/go/golang.org/x/crypto/blowfish.dep.yml index 449f8662..4f682e0d 100644 --- a/.licenses/go/golang.org/x/crypto/blowfish.dep.yml +++ b/.licenses/go/golang.org/x/crypto/blowfish.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/blowfish -version: v0.18.0 +version: v0.23.0 type: go summary: Package blowfish implements Bruce Schneier's Blowfish encryption algorithm. homepage: https://pkg.go.dev/golang.org/x/crypto/blowfish license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/cast5.dep.yml b/.licenses/go/golang.org/x/crypto/cast5.dep.yml index bcdeb025..369aae2e 100644 --- a/.licenses/go/golang.org/x/crypto/cast5.dep.yml +++ b/.licenses/go/golang.org/x/crypto/cast5.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/cast5 -version: v0.18.0 +version: v0.23.0 type: go summary: Package cast5 implements CAST5, as defined in RFC 2144. homepage: https://pkg.go.dev/golang.org/x/crypto/cast5 license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/curve25519.dep.yml b/.licenses/go/golang.org/x/crypto/curve25519.dep.yml index 9565db0c..27ff49f5 100644 --- a/.licenses/go/golang.org/x/crypto/curve25519.dep.yml +++ b/.licenses/go/golang.org/x/crypto/curve25519.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/crypto/curve25519 -version: v0.18.0 +version: v0.23.0 type: go summary: Package curve25519 provides an implementation of the X25519 function, which performs scalar multiplication on the elliptic curve known as Curve25519. homepage: https://pkg.go.dev/golang.org/x/crypto/curve25519 license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp.dep.yml index af05f837..4ba5db06 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/openpgp -version: v0.18.0 +version: v0.23.0 type: go summary: Package openpgp implements high level operations on OpenPGP messages. homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp/armor.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp/armor.dep.yml index 0dc3804c..7784e1ad 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp/armor.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp/armor.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/openpgp/armor -version: v0.18.0 +version: v0.23.0 type: go summary: Package armor implements OpenPGP ASCII Armor, see RFC 4880. homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp/armor license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp/elgamal.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp/elgamal.dep.yml index e8bdefb6..dc98ffd8 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp/elgamal.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp/elgamal.dep.yml @@ -1,6 +1,6 @@ --- name: golang.org/x/crypto/openpgp/elgamal -version: v0.18.0 +version: v0.23.0 type: go summary: Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," @@ -8,7 +8,7 @@ summary: Package elgamal implements ElGamal encryption, suitable for OpenPGP, as homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp/elgamal license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -37,7 +37,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp/errors.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp/errors.dep.yml index 38fd876f..484e001b 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp/errors.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp/errors.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/openpgp/errors -version: v0.18.0 +version: v0.23.0 type: go summary: Package errors contains common error types for the OpenPGP packages. homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp/errors license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp/packet.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp/packet.dep.yml index 48b8a419..eb6d99c1 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp/packet.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp/packet.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/crypto/openpgp/packet -version: v0.18.0 +version: v0.23.0 type: go summary: Package packet implements parsing and serialization of OpenPGP packets, as specified in RFC 4880. homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp/packet license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/openpgp/s2k.dep.yml b/.licenses/go/golang.org/x/crypto/openpgp/s2k.dep.yml index c178e683..cc460fa6 100644 --- a/.licenses/go/golang.org/x/crypto/openpgp/s2k.dep.yml +++ b/.licenses/go/golang.org/x/crypto/openpgp/s2k.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/crypto/openpgp/s2k -version: v0.18.0 +version: v0.23.0 type: go summary: Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1. homepage: https://pkg.go.dev/golang.org/x/crypto/openpgp/s2k license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/ssh.dep.yml b/.licenses/go/golang.org/x/crypto/ssh.dep.yml index b2e4ec28..2c39eb21 100644 --- a/.licenses/go/golang.org/x/crypto/ssh.dep.yml +++ b/.licenses/go/golang.org/x/crypto/ssh.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/ssh -version: v0.18.0 +version: v0.23.0 type: go summary: Package ssh implements an SSH client and server. homepage: https://pkg.go.dev/golang.org/x/crypto/ssh license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/ssh/agent.dep.yml b/.licenses/go/golang.org/x/crypto/ssh/agent.dep.yml index b4f34666..85f57262 100644 --- a/.licenses/go/golang.org/x/crypto/ssh/agent.dep.yml +++ b/.licenses/go/golang.org/x/crypto/ssh/agent.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/crypto/ssh/agent -version: v0.18.0 +version: v0.23.0 type: go summary: Package agent implements the ssh-agent protocol, and provides both a client and a server. homepage: https://pkg.go.dev/golang.org/x/crypto/ssh/agent license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf.dep.yml b/.licenses/go/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf.dep.yml index e62bee50..38e497ed 100644 --- a/.licenses/go/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf.dep.yml +++ b/.licenses/go/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/crypto/ssh/internal/bcrypt_pbkdf -version: v0.18.0 +version: v0.23.0 type: go summary: Package bcrypt_pbkdf implements bcrypt_pbkdf(3) from OpenBSD. homepage: https://pkg.go.dev/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/crypto/ssh/knownhosts.dep.yml b/.licenses/go/golang.org/x/crypto/ssh/knownhosts.dep.yml index c8144dfa..777f3cfc 100644 --- a/.licenses/go/golang.org/x/crypto/ssh/knownhosts.dep.yml +++ b/.licenses/go/golang.org/x/crypto/ssh/knownhosts.dep.yml @@ -1,6 +1,6 @@ --- name: golang.org/x/crypto/ssh/knownhosts -version: v0.18.0 +version: v0.23.0 type: go summary: Package knownhosts implements a parser for the OpenSSH known_hosts host key database, and provides utility functions for writing OpenSSH compliant known_hosts @@ -8,7 +8,7 @@ summary: Package knownhosts implements a parser for the OpenSSH known_hosts host homepage: https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts license: bsd-3-clause licenses: -- sources: crypto@v0.18.0/LICENSE +- sources: crypto@v0.23.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -37,7 +37,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: crypto@v0.18.0/PATENTS +- sources: crypto@v0.23.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/bpf.dep.yml b/.licenses/go/golang.org/x/net/bpf.dep.yml new file mode 100644 index 00000000..e75ae79d --- /dev/null +++ b/.licenses/go/golang.org/x/net/bpf.dep.yml @@ -0,0 +1,63 @@ +--- +name: golang.org/x/net/bpf +version: v0.25.0 +type: go +summary: Package bpf implements marshaling and unmarshaling of programs for the Berkeley + Packet Filter virtual machine, and provides a Go implementation of the virtual machine. +homepage: https://pkg.go.dev/golang.org/x/net/bpf +license: other +licenses: +- sources: net@v0.25.0/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: net@v0.25.0/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] diff --git a/.licenses/go/golang.org/x/net/context.dep.yml b/.licenses/go/golang.org/x/net/context.dep.yml index 3a5b464d..5ce2b786 100644 --- a/.licenses/go/golang.org/x/net/context.dep.yml +++ b/.licenses/go/golang.org/x/net/context.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/net/context -version: v0.20.0 +version: v0.25.0 type: go summary: Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. homepage: https://pkg.go.dev/golang.org/x/net/context license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/http2.dep.yml b/.licenses/go/golang.org/x/net/http2.dep.yml index 7337b512..4e442b81 100644 --- a/.licenses/go/golang.org/x/net/http2.dep.yml +++ b/.licenses/go/golang.org/x/net/http2.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/net/http2 -version: v0.20.0 +version: v0.25.0 type: go summary: Package http2 implements the HTTP/2 protocol. homepage: https://pkg.go.dev/golang.org/x/net/http2 license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/internal/iana.dep.yml b/.licenses/go/golang.org/x/net/internal/iana.dep.yml new file mode 100644 index 00000000..3be2feba --- /dev/null +++ b/.licenses/go/golang.org/x/net/internal/iana.dep.yml @@ -0,0 +1,63 @@ +--- +name: golang.org/x/net/internal/iana +version: v0.25.0 +type: go +summary: Package iana provides protocol number resources managed by the Internet Assigned + Numbers Authority (IANA). +homepage: https://pkg.go.dev/golang.org/x/net/internal/iana +license: other +licenses: +- sources: net@v0.25.0/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: net@v0.25.0/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] diff --git a/.licenses/go/golang.org/x/net/internal/socket.dep.yml b/.licenses/go/golang.org/x/net/internal/socket.dep.yml new file mode 100644 index 00000000..bdcec430 --- /dev/null +++ b/.licenses/go/golang.org/x/net/internal/socket.dep.yml @@ -0,0 +1,62 @@ +--- +name: golang.org/x/net/internal/socket +version: v0.25.0 +type: go +summary: Package socket provides a portable interface for socket system calls. +homepage: https://pkg.go.dev/golang.org/x/net/internal/socket +license: other +licenses: +- sources: net@v0.25.0/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: net@v0.25.0/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] diff --git a/.licenses/go/golang.org/x/net/internal/socks.dep.yml b/.licenses/go/golang.org/x/net/internal/socks.dep.yml index c0776014..d87d267f 100644 --- a/.licenses/go/golang.org/x/net/internal/socks.dep.yml +++ b/.licenses/go/golang.org/x/net/internal/socks.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/net/internal/socks -version: v0.20.0 +version: v0.25.0 type: go summary: Package socks provides a SOCKS version 5 client implementation. homepage: https://pkg.go.dev/golang.org/x/net/internal/socks license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/internal/timeseries.dep.yml b/.licenses/go/golang.org/x/net/internal/timeseries.dep.yml index a612a972..6701aa7f 100644 --- a/.licenses/go/golang.org/x/net/internal/timeseries.dep.yml +++ b/.licenses/go/golang.org/x/net/internal/timeseries.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/net/internal/timeseries -version: v0.20.0 +version: v0.25.0 type: go summary: Package timeseries implements a time series structure for stats collection. homepage: https://pkg.go.dev/golang.org/x/net/internal/timeseries license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/ipv4.dep.yml b/.licenses/go/golang.org/x/net/ipv4.dep.yml new file mode 100644 index 00000000..34f6bc89 --- /dev/null +++ b/.licenses/go/golang.org/x/net/ipv4.dep.yml @@ -0,0 +1,63 @@ +--- +name: golang.org/x/net/ipv4 +version: v0.25.0 +type: go +summary: Package ipv4 implements IP-level socket options for the Internet Protocol + version 4. +homepage: https://pkg.go.dev/golang.org/x/net/ipv4 +license: other +licenses: +- sources: net@v0.25.0/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: net@v0.25.0/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] diff --git a/.licenses/go/golang.org/x/net/proxy.dep.yml b/.licenses/go/golang.org/x/net/proxy.dep.yml index 483ff363..4d60ef78 100644 --- a/.licenses/go/golang.org/x/net/proxy.dep.yml +++ b/.licenses/go/golang.org/x/net/proxy.dep.yml @@ -1,13 +1,13 @@ --- name: golang.org/x/net/proxy -version: v0.20.0 +version: v0.25.0 type: go summary: Package proxy provides support for a variety of protocols to proxy network data. homepage: https://pkg.go.dev/golang.org/x/net/proxy license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -36,7 +36,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/net/trace.dep.yml b/.licenses/go/golang.org/x/net/trace.dep.yml index 7d486480..94ae6214 100644 --- a/.licenses/go/golang.org/x/net/trace.dep.yml +++ b/.licenses/go/golang.org/x/net/trace.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/net/trace -version: v0.20.0 +version: v0.25.0 type: go summary: Package trace implements tracing of requests and long-lived objects. homepage: https://pkg.go.dev/golang.org/x/net/trace license: bsd-3-clause licenses: -- sources: net@v0.20.0/LICENSE +- sources: net@v0.25.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: net@v0.20.0/PATENTS +- sources: net@v0.25.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/sys/unix.dep.yml b/.licenses/go/golang.org/x/sys/unix.dep.yml index e04edef8..8c6dd955 100644 --- a/.licenses/go/golang.org/x/sys/unix.dep.yml +++ b/.licenses/go/golang.org/x/sys/unix.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/sys/unix -version: v0.16.0 +version: v0.20.0 type: go summary: Package unix contains an interface to the low-level operating system primitives. homepage: https://pkg.go.dev/golang.org/x/sys/unix license: bsd-3-clause licenses: -- sources: sys@v0.16.0/LICENSE +- sources: sys@v0.20.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: sys@v0.16.0/PATENTS +- sources: sys@v0.20.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/.licenses/go/golang.org/x/text/runes.dep.yml b/.licenses/go/golang.org/x/text/runes.dep.yml index baa52fe7..aec13555 100644 --- a/.licenses/go/golang.org/x/text/runes.dep.yml +++ b/.licenses/go/golang.org/x/text/runes.dep.yml @@ -1,12 +1,12 @@ --- name: golang.org/x/text/runes -version: v0.14.0 +version: v0.15.0 type: go summary: Package runes provide transforms for UTF-8 encoded text. homepage: https://pkg.go.dev/golang.org/x/text/runes license: bsd-3-clause licenses: -- sources: text@v0.14.0/LICENSE +- sources: text@v0.15.0/LICENSE text: | Copyright (c) 2009 The Go Authors. All rights reserved. @@ -35,7 +35,7 @@ licenses: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: text@v0.14.0/PATENTS +- sources: text@v0.15.0/PATENTS text: | Additional IP Rights Grant (Patents) diff --git a/cli/device/configure.go b/cli/device/configure.go index c8834640..713a512a 100644 --- a/cli/device/configure.go +++ b/cli/device/configure.go @@ -20,11 +20,7 @@ package device import ( "context" "encoding/json" - "errors" - "fmt" - "net" "os" - "strings" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" @@ -83,7 +79,7 @@ func runConfigureCommand(flags *netConfigurationFlags) error { } } else { feedback.Print("Insert network configuration") - getInputFromMenu(netParams) + device.GetInputFromMenu(netParams) } boardFilterParams := &device.CreateParams{} @@ -105,116 +101,3 @@ func runConfigureCommand(flags *netConfigurationFlags) error { feedback.Print("Network configuration successfully completed.") return nil } - -func getInputFromMenu(config *device.NetConfig) error { - - switch config.Type { - case 1: - config.WiFi = getWiFiSetting() - case 2: - config.Eth = getEthernetSetting() - case 3: - config.NB = getCellularSetting() - case 4: - config.GSM = getCellularSetting() - case 5: - config.Lora = getLoraSetting() - case 6: - config.CATM1 = getCatM1Setting() - case 7: - config.CellularSetting = getCellularSetting() - default: - return errors.New("invalid connection type, please try again") - } - return nil -} - -func getWiFiSetting() device.WiFiSetting { - var wifi device.WiFiSetting - fmt.Print("Enter SSID: ") - fmt.Scanln(&wifi.SSID) - fmt.Print("Enter Password: ") - fmt.Scanln(&wifi.PWD) - return wifi -} - -func getEthernetSetting() device.EthernetSetting { - var eth device.EthernetSetting - fmt.Println("Do you want to use DHCP? (yes/no): ") - var useDHCP string - fmt.Scanln(&useDHCP) - if useDHCP == "yes" || useDHCP == "y" { - eth.IP = device.IPAddr{Type: 0, Bytes: [16]byte{}} - eth.Gateway = device.IPAddr{Type: 0, Bytes: [16]byte{}} - eth.Netmask = device.IPAddr{Type: 0, Bytes: [16]byte{}} - eth.DNS = device.IPAddr{Type: 0, Bytes: [16]byte{}} - } else { - fmt.Println("Enter IP Address: ") - eth.IP = getIPAddr() - fmt.Println("Enter DNS: ") - eth.DNS = getIPAddr() - fmt.Println("Enter Gateway: ") - eth.Gateway = getIPAddr() - fmt.Println("Enter Netmask: ") - eth.Netmask = getIPAddr() - } - - return eth -} - -func getIPAddr() device.IPAddr { - var ip device.IPAddr - var ipString string - fmt.Scanln(&ipString) - if ipString == "" { - return ip - } - if strings.Count(ipString, ":") > 0 { - ip.Type = 1 // IPv6 - } else { - ip.Type = 0 // IPv4 - } - ip.Bytes = [16]byte(net.ParseIP(ipString).To16()) - return ip -} - -func getCellularSetting() device.CellularSetting { - var cellular device.CellularSetting - fmt.Println("Enter PIN: ") - fmt.Scanln(&cellular.PIN) - fmt.Print("Enter APN: ") - fmt.Scanln(&cellular.APN) - fmt.Print("Enter Login: ") - fmt.Scanln(&cellular.Login) - fmt.Print("Enter Password: ") - fmt.Scanln(&cellular.Pass) - return cellular -} - -func getCatM1Setting() device.CATM1Setting { - var catm1 device.CATM1Setting - fmt.Print("Enter PIN: ") - fmt.Scanln(&catm1.PIN) - fmt.Print("Enter APN: ") - fmt.Scanln(&catm1.APN) - fmt.Print("Enter Login: ") - fmt.Scanln(&catm1.Login) - fmt.Print("Enter Password: ") - fmt.Scanln(&catm1.Pass) - return catm1 -} - -func getLoraSetting() device.LoraSetting { - var lora device.LoraSetting - fmt.Print("Enter AppEUI: ") - fmt.Scanln(&lora.AppEUI) - fmt.Print("Enter AppKey: ") - fmt.Scanln(&lora.AppKey) - fmt.Print("Enter Band (Byte hex format): ") - fmt.Scanln(&lora.Band) - fmt.Print("Enter Channel Mask: ") - fmt.Scanln(&lora.ChannelMask) - fmt.Print("Enter Device Class: ") - fmt.Scanln(&lora.DeviceClass) - return lora -} diff --git a/cli/device/create.go b/cli/device/create.go index bca5453e..0323a57c 100644 --- a/cli/device/create.go +++ b/cli/device/create.go @@ -83,6 +83,8 @@ func runCreateCommand(flags *createFlags) error { ctx, cancel := cleanup.InterruptableContext(context.Background()) defer cancel() + feedback.Printf("Creating device with name %s", flags.name) + dev, err := device.Create(ctx, params, cred) if err != nil { return err diff --git a/command/device/board.go b/command/device/board.go index 568285c2..8d0a56f5 100644 --- a/command/device/board.go +++ b/command/device/board.go @@ -35,6 +35,8 @@ var ( "arduino:samd:mkrnb1500", "arduino:mbed_opta:opta", "arduino:mbed_giga:giga", + "arduino:renesas_uno:unor4wifi", + "arduino:renesas_portenta:portenta_c33", } loraFQBN = []string{ "arduino:samd:mkrwan1310", diff --git a/command/device/configurationstates.go b/command/device/configurationstates.go new file mode 100644 index 00000000..ec095452 --- /dev/null +++ b/command/device/configurationstates.go @@ -0,0 +1,340 @@ +// This file is part of arduino-cloud-cli. +// +// Copyright (C) 2025 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package device + +import ( + "context" + "errors" + "fmt" + "time" + + configurationprotocol "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol" + "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol/cborcoders" + "github.com/sirupsen/logrus" +) + +type ConfigStatus int + +// This enum represents the different states of the network configuration process +// of the Arduino Board Configuration Protocol. +const ( + NoneState ConfigStatus = iota + WaitForConnection + WaitingForInitialStatus + WaitingForNetworkOptions + BoardReady + FlashProvisioningSketch + GetSketchVersionRequest + WaitingSketchVersion + WiFiFWVersionRequest + WaitingWiFiFWVersion + RequestBLEMAC + WaitBLEMAC + SendInitialTS + MissingParameter + IDRequest + WaitingID + WaitingSignature + WaitingPublicKey + ClaimDevice + RegisterDevice + RequestReset + WaitResetResponse + GetNetConfigLibVersionRequest + WaitingNetConfigLibVersion + ConfigureNetwork + SendConnectionRequest + WaitingForConnectionCommandResult + WaitingForNetworkConfigResult + WaitingForProvisioningResult + UnclaimDevice + End + ErrorState +) + +const ( + CommandResponseTimeoutLong_s = 60 + CommandResponseTimeoutShort_s = 30 + ConnectResponseTimeout_s = 200 +) + +type ConfigurationStates struct { + configProtocol *configurationprotocol.NetworkConfigurationProtocol +} + +func NewConfigurationStates(configProtocol *configurationprotocol.NetworkConfigurationProtocol) *ConfigurationStates { + return &ConfigurationStates{ + configProtocol: configProtocol, + } +} + +func (c *ConfigurationStates) WaitForConnection() (ConfigStatus, error) { + if c.configProtocol.Connected() { + return WaitingForInitialStatus, nil + } + return ErrorState, errors.New("impossible to connect with the device") +} + +func (c *ConfigurationStates) WaitingForInitialStatus() (ConfigStatus, error) { + logrus.Info("NetworkConfigure: waiting for initial status from device") + res, err := c.configProtocol.ReceiveData(CommandResponseTimeoutShort_s) + if err != nil { + return ErrorState, fmt.Errorf("communication error: %w, please check the NetworkConfigurator lib is activated in the sketch", err) + } + + if res == nil { + return WaitingForNetworkOptions, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + if status.Status == 1 { + return WaitingForInitialStatus, nil + } + + if status.Status == -6 || status.Status < -101 { + return c.HandleStatusMessage(status.Status) + } + return WaitingForNetworkOptions, nil + } + + if res.Type() == cborcoders.WiFiNetworksType { + return BoardReady, nil + } + + return WaitingForNetworkOptions, nil +} + +// In this state the cli is waiting for the available network options as specified in the +// Arduino Board Configuration Protocol. +func (c *ConfigurationStates) WaitingForNetworkOptions() (ConfigStatus, error) { + logrus.Info("NetworkConfigure: waiting for network options from device") + res, err := c.configProtocol.ReceiveData(CommandResponseTimeoutShort_s) + if err != nil { + return ErrorState, err + } + + if res != nil { + // At the moment of writing, the only type of message that can be received in this state is the + // WiFiNetworksType, which contains the available WiFi networks list. + if res.Type() == cborcoders.WiFiNetworksType { + return BoardReady, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + if status.Status == 1 { + return WaitingForInitialStatus, nil + } + + return c.HandleStatusMessage(status.Status) + } + } + + return ErrorState, errors.New("timeout: no network options received from the device, please retry enabling the NetworkCofnigurator lib in the sketch") +} + +func (cs *ConfigurationStates) ConfigureNetwork(ctx context.Context, c *NetConfig) (ConfigStatus, error) { + logrus.Info("NetworkConfigure: Sending network configuration") + var cmd cborcoders.Cmd + if c.Type == 1 { // WiFi + cmd = cborcoders.From(cborcoders.ProvisioningWifiConfigMessage{ + SSID: c.WiFi.SSID, + PWD: c.WiFi.PWD, + }) + } else if c.Type == 2 { // Ethernet + cmd = cborcoders.From(cborcoders.ProvisioningEthernetConfigMessage{ + Static_ip: c.Eth.IP.Bytes[:], + Dns: c.Eth.DNS.Bytes[:], + Gateway: c.Eth.Gateway.Bytes[:], + Netmask: c.Eth.Netmask.Bytes[:], + Timeout: c.Eth.Timeout, + ResponseTimeout: c.Eth.ResponseTimeout, + }) + } else if c.Type == 3 { // NB-IoT + cmd = cborcoders.From(cborcoders.ProvisioningNBConfigMessage{ + PIN: c.NB.PIN, + Apn: c.NB.APN, + Login: c.NB.Login, + Pass: c.NB.Pass, + }) + } else if c.Type == 4 { // GSM + cmd = cborcoders.From(cborcoders.ProvisioningGSMConfigMessage{ + PIN: c.GSM.PIN, + Apn: c.GSM.APN, + Login: c.GSM.Login, + Pass: c.GSM.Pass, + }) + } else if c.Type == 5 { // LoRa + cmd = cborcoders.From(cborcoders.ProvisioningLoRaConfigMessage{ + AppEui: c.Lora.AppEUI, + AppKey: c.Lora.AppKey, + Band: c.Lora.Band, + ChannelMask: c.Lora.ChannelMask, + DeviceClass: c.Lora.DeviceClass, + }) + } else if c.Type == 6 { // CAT-M1 + cmd = cborcoders.From(cborcoders.ProvisioningCATM1ConfigMessage{ + PIN: c.CATM1.PIN, + Apn: c.CATM1.APN, + Login: c.CATM1.Login, + Pass: c.CATM1.Pass, + Band: nil, + }) + } else if c.Type == 7 { // Cellular + cmd = cborcoders.From(cborcoders.ProvisioningCellularConfigMessage{ + PIN: c.CellularSetting.PIN, + Apn: c.CellularSetting.APN, + Login: c.CellularSetting.Login, + Pass: c.CellularSetting.Pass, + }) + } else { + return ErrorState, errors.New("invalid configuration type") + } + + err := cs.configProtocol.SendData(cmd) + if err != nil { + return ErrorState, err + } + + sleepCtx(ctx, 1*time.Second) + return SendConnectionRequest, nil +} + +func (c *ConfigurationStates) SendConnectionRequest() (ConfigStatus, error) { + logrus.Info("NetworkConfigure: Sending connection request") + connectMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["Connect"]}) + err := c.configProtocol.SendData(connectMessage) + if err != nil { + return ErrorState, err + } + return WaitingForConnectionCommandResult, nil + +} + +func (c *ConfigurationStates) WaitingForConnectionCommandResult() (ConfigStatus, error) { + logrus.Info("NetworkConfigure: Waiting for connection command result") + res, err := c.configProtocol.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res != nil && res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + if status.Status == 1 { + return WaitingForNetworkConfigResult, nil + } + + if status.Status == -4 { + return ConfigureNetwork, nil + } + + return c.HandleStatusMessage(status.Status) + + } + + return ErrorState, errors.New("timeout: no confirmation of connection command received from the device, please retry") +} + +func (c *ConfigurationStates) WaitingForNetworkConfigResult() (ConfigStatus, error) { + logrus.Info("NetworkConfigure: Waiting for network configuration result") + res, err := c.configProtocol.ReceiveData(ConnectResponseTimeout_s) + if err != nil { + return ErrorState, err + } + + if res != nil && res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + + if status.Status == 2 { + return End, nil + } + //For boards of type Cellular, CAT-M1, GSM e NB-IOT that + //returns -3 or -101 when the network configuration is invalid + if status.Status == -3 || status.Status == -101 { + return ErrorState, errors.New("connection failed: invalid network configuration") + } + return c.HandleStatusMessage(status.Status) + + } + + return ErrorState, errors.New("timeout: no result received from the device for network configuration, please retry") +} + +// Keep for reference +/* +func (c *ConfigurationStates) printNetworkOption(msg *cborcoders.Cmd) { + if msg.Type() == cborcoders.WiFiNetworksType { + networks := msg.ToWiFiNetworks() + for _, network := range networks { + fmt.Printf("SSID: %s, RSSI %d \n", network.SSID, network.RSSI) + } + } +} +*/ + +func (c *ConfigurationStates) HandleStatusMessage(status int16) (ConfigStatus, error) { + statusMessage := configurationprotocol.StatusBoard[status] + logrus.Debugf("NetworkConfigure: status message received: %s", statusMessage) + + switch statusMessage { + case "Connecting": + return NoneState, nil + case "Connected": + return NoneState, nil + case "Resetted": + return NoneState, nil + case "Scanning for WiFi networks": + return WaitingForNetworkOptions, nil + case "Failed to connect": + return ErrorState, errors.New("connection failed: invalid network configuration") + case "Disconnected": + return NoneState, nil + case "Parameters not provided": + return MissingParameter, nil + case "Invalid parameters": + return ErrorState, errors.New("the provided parameters for network configuration are invalid") + case "Cannot execute anew request while another is pending": + return ErrorState, errors.New("board is busy, restart the board and try again") + case "Invalid request": + return ErrorState, errors.New("invalid request sent to the board") + case "Internet not available": + return ErrorState, errors.New("internet not available, check your network connection") + case "HW Error connectivity module": + return ErrorState, errors.New("hardware error in connectivity module, check the board") + case "HW Connectivity Module stopped": + return ErrorState, errors.New("hardware connectivity module stopped, restart the board and check your sketch") + case "Error initializing secure element": + return ErrorState, errors.New("error initializing secure element, check the board and try again") + case "Error configuring secure element": + return ErrorState, errors.New("error configuring secure element, check the board and try again") + case "Error locking secure element": + return ErrorState, errors.New("error locking secure element, check the board and try again") + case "Error generating UHWID": + return ErrorState, errors.New("error generating UHWID, check the board and try again") + case "Error storage begin module": + return ErrorState, errors.New("error beginning storage module, check the board storage partitioning and try again") + case "Fail to partition the storage": + return ErrorState, errors.New("failed to partition the storage, check the board storage and try again") + case "Generic error": + return ErrorState, errors.New("generic error, check the board and try again") + default: + return ErrorState, errors.New("generic error, check the board and try again") + } + +} diff --git a/command/device/configure.go b/command/device/configure.go index f8f642d5..b955009e 100644 --- a/command/device/configure.go +++ b/command/device/configure.go @@ -21,14 +21,13 @@ import ( "context" "errors" "fmt" - "time" + "net" + "strings" "github.com/arduino/arduino-cloud-cli/arduino/cli" configurationprotocol "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol" - "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol/cborcoders" "github.com/arduino/arduino-cloud-cli/internal/board-protocols/transport" "github.com/arduino/arduino-cloud-cli/internal/serial" - "github.com/sirupsen/logrus" ) func NetConfigure(ctx context.Context, boardFilters *CreateParams, NetConfig *NetConfig) error { @@ -56,344 +55,171 @@ func NetConfigure(ctx context.Context, boardFilters *CreateParams, NetConfig *Ne return err } - nc := NewNetworkConfigure(extInterface) + nc := NewNetworkConfigure(configProtocol) err = nc.Run(ctx, NetConfig) return err } -type ConfigStatus int - -// This enum represents the different states of the network configuration process -// of the Arduino Board Configuration Protocol. -const ( - NoneState ConfigStatus = iota - WaitForConnection - WaitingForInitialStatus - WaitingForNetworkOptions - ConfigureNetwork - SendConnectionRequest - WaitingForConnectionCommandResult - WaitingForNetworkConfigResult - End -) - -type NetworkConfigure struct { - state ConfigStatus - extInterface transport.TransportInterface - configProtocol *configurationprotocol.NetworkConfigurationProtocol -} - -func NewNetworkConfigure(extInterface transport.TransportInterface) *NetworkConfigure { - return &NetworkConfigure{ - extInterface: extInterface, - configProtocol: configurationprotocol.NewNetworkConfigurationProtocol(&extInterface), - } -} - -func (nc *NetworkConfigure) Run(ctx context.Context, netConfig *NetConfig) error { - nc.state = WaitForConnection - var err error - for nc.state != End { - - switch nc.state { - case WaitForConnection: - err = nc.waitForConnection() - if err != nil { - nc.state = End - } - case WaitingForInitialStatus: - err = nc.waitingForInitialStatus() - if err != nil { - nc.state = End - } - case WaitingForNetworkOptions: - err = nc.waitingForNetworkOptions() - if err != nil { - nc.state = End - } - case ConfigureNetwork: - err = nc.configureNetwork(ctx, netConfig) - if err != nil { - nc.state = End - } - case SendConnectionRequest: - err = nc.sendConnectionRequest() - if err != nil { - nc.state = End - } - case WaitingForConnectionCommandResult: - err = nc.waitingForConnectionCommandResult() - if err != nil { - nc.state = End - } - case WaitingForNetworkConfigResult: - err = nc.waitingForNetworkConfigResult() - if err != nil { - nc.state = End - } - } - - } - - nc.configProtocol.Close() - return err -} - -func (nc *NetworkConfigure) waitForConnection() error { - if nc.extInterface.Connected() { - nc.state = WaitingForInitialStatus +func GetInputFromMenu(config *NetConfig) error { + + switch config.Type { + case 1: + config.WiFi = getWiFiSetting() + case 2: + config.Eth = getEthernetSetting() + case 3: + config.NB = getCellularSetting() + case 4: + config.GSM = getCellularSetting() + case 5: + config.Lora = getLoraSetting() + case 6: + config.CATM1 = getCatM1Setting() + case 7: + config.CellularSetting = getCellularSetting() + default: + return errors.New("invalid connection type, please try again") } return nil } -func (nc *NetworkConfigure) waitingForInitialStatus() error { - logrus.Info("NetworkConfigure: waiting for initial status from device") - res, err := nc.configProtocol.ReceiveData(30) - if err != nil { - return fmt.Errorf("communication error: %w, please check the NetworkConfigurator lib is activated in the sketch", err) - } - - if res == nil { - nc.state = WaitingForNetworkOptions - } else if res.Type() == cborcoders.ProvisioningStatusMessageType { - status := res.ToProvisioningStatusMessage() - if status.Status == 1 { - nc.state = WaitingForInitialStatus - } else if status.Status == -6 || status.Status <= -101 { - newState, err := nc.handleStatusMessage(status.Status) - if err != nil { - return err - } - if newState != NoneState { - nc.state = newState - } - } else { - nc.state = WaitingForNetworkOptions - } - - } else if res.Type() == cborcoders.WiFiNetworksType { - nc.state = ConfigureNetwork - } - - return nil +func getWiFiSetting() WiFiSetting { + var wifi WiFiSetting + fmt.Print("Enter SSID: ") + fmt.Scanln(&wifi.SSID) + fmt.Print("Enter Password: ") + fmt.Scanln(&wifi.PWD) + return wifi } -// In this state the cli is waiting for the available network options as specified in the -// Arduino Board Configuration Protocol. -func (nc *NetworkConfigure) waitingForNetworkOptions() error { - logrus.Info("NetworkConfigure: waiting for network options from device") - res, err := nc.configProtocol.ReceiveData(30) - if err != nil { - return err - } - - if res != nil { - // At the moment of writing, the only type of message that can be received in this state is the - // WiFiNetworksType, which contains the available WiFi networks list. - if res.Type() == cborcoders.WiFiNetworksType { - nc.state = ConfigureNetwork - } else if res.Type() == cborcoders.ProvisioningStatusMessageType { - status := res.ToProvisioningStatusMessage() - if status.Status == 1 { - nc.state = WaitingForInitialStatus - } else { - newState, err := nc.handleStatusMessage(status.Status) - if err != nil { - return err - } - if newState != NoneState { - nc.state = newState - } - } - } +func getEthernetSetting() EthernetSetting { + var eth EthernetSetting + fmt.Println("Do you want to use DHCP? (yes/no): ") + var useDHCP string + fmt.Scanln(&useDHCP) + if useDHCP == "yes" || useDHCP == "y" { + eth.IP = IPAddr{Type: 0, Bytes: [16]byte{}} + eth.Gateway = IPAddr{Type: 0, Bytes: [16]byte{}} + eth.Netmask = IPAddr{Type: 0, Bytes: [16]byte{}} + eth.DNS = IPAddr{Type: 0, Bytes: [16]byte{}} + } else { + fmt.Println("Enter IP Address: ") + eth.IP = getIPAddr() + fmt.Println("Enter DNS: ") + eth.DNS = getIPAddr() + fmt.Println("Enter Gateway: ") + eth.Gateway = getIPAddr() + fmt.Println("Enter Netmask: ") + eth.Netmask = getIPAddr() } - return nil + return eth } -func (nc *NetworkConfigure) configureNetwork(ctx context.Context, c *NetConfig) error { - var cmd cborcoders.Cmd - if c.Type == 1 { // WiFi - cmd = cborcoders.From(cborcoders.ProvisioningWifiConfigMessage{ - SSID: c.WiFi.SSID, - PWD: c.WiFi.PWD, - }) - } else if c.Type == 2 { // Ethernet - cmd = cborcoders.From(cborcoders.ProvisioningEthernetConfigMessage{ - Static_ip: c.Eth.IP.Bytes[:], - Dns: c.Eth.DNS.Bytes[:], - Gateway: c.Eth.Gateway.Bytes[:], - Netmask: c.Eth.Netmask.Bytes[:], - Timeout: c.Eth.Timeout, - ResponseTimeout: c.Eth.ResponseTimeout, - }) - } else if c.Type == 3 { // NB-IoT - cmd = cborcoders.From(cborcoders.ProvisioningNBConfigMessage{ - PIN: c.NB.PIN, - Apn: c.NB.APN, - Login: c.NB.Login, - Pass: c.NB.Pass, - }) - } else if c.Type == 4 { // GSM - cmd = cborcoders.From(cborcoders.ProvisioningGSMConfigMessage{ - PIN: c.GSM.PIN, - Apn: c.GSM.APN, - Login: c.GSM.Login, - Pass: c.GSM.Pass, - }) - } else if c.Type == 5 { // LoRa - cmd = cborcoders.From(cborcoders.ProvisioningLoRaConfigMessage{ - AppEui: c.Lora.AppEUI, - AppKey: c.Lora.AppKey, - Band: c.Lora.Band, - ChannelMask: c.Lora.ChannelMask, - DeviceClass: c.Lora.DeviceClass, - }) - } else if c.Type == 6 { // CAT-M1 - cmd = cborcoders.From(cborcoders.ProvisioningCATM1ConfigMessage{ - PIN: c.CATM1.PIN, - Apn: c.CATM1.APN, - Login: c.CATM1.Login, - Pass: c.CATM1.Pass, - Band: c.CATM1.Band, - }) - } else if c.Type == 7 { // Cellular - cmd = cborcoders.From(cborcoders.ProvisioningCellularConfigMessage{ - PIN: c.CellularSetting.PIN, - Apn: c.CellularSetting.APN, - Login: c.CellularSetting.Login, - Pass: c.CellularSetting.Pass, - }) +func getIPAddr() IPAddr { + var ip IPAddr + var ipString string + fmt.Scanln(&ipString) + if ipString == "" { + return ip + } + if strings.Count(ipString, ":") > 0 { + ip.Type = 1 // IPv6 } else { - return errors.New("invalid configuration type") + ip.Type = 0 // IPv4 } + ip.Bytes = [16]byte(net.ParseIP(ipString).To16()) + return ip +} - err := nc.configProtocol.SendData(cmd) - if err != nil { - return err - } +func getCellularSetting() CellularSetting { + var cellular CellularSetting + fmt.Println("Enter PIN: ") + fmt.Scanln(&cellular.PIN) + fmt.Print("Enter APN: ") + fmt.Scanln(&cellular.APN) + fmt.Print("Enter Login: ") + fmt.Scanln(&cellular.Login) + fmt.Print("Enter Password: ") + fmt.Scanln(&cellular.Pass) + return cellular +} - nc.state = SendConnectionRequest - sleepCtx(ctx, 1*time.Second) - return nil +func getCatM1Setting() CATM1Setting { + var catm1 CATM1Setting + fmt.Print("Enter PIN: ") + fmt.Scanln(&catm1.PIN) + fmt.Print("Enter APN: ") + fmt.Scanln(&catm1.APN) + fmt.Print("Enter Login: ") + fmt.Scanln(&catm1.Login) + fmt.Print("Enter Password: ") + fmt.Scanln(&catm1.Pass) + return catm1 } -func (nc *NetworkConfigure) sendConnectionRequest() error { - connectMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["Connect"]}) - err := nc.configProtocol.SendData(connectMessage) - if err != nil { - return err - } - nc.state = WaitingForConnectionCommandResult - return nil +func getLoraSetting() LoraSetting { + var lora LoraSetting + fmt.Print("Enter AppEUI: ") + fmt.Scanln(&lora.AppEUI) + fmt.Print("Enter AppKey: ") + fmt.Scanln(&lora.AppKey) + fmt.Print("Enter Band (Byte hex format): ") + fmt.Scanln(&lora.Band) + fmt.Print("Enter Channel Mask: ") + fmt.Scanln(&lora.ChannelMask) + fmt.Print("Enter Device Class: ") + fmt.Scanln(&lora.DeviceClass) + return lora } -func (nc *NetworkConfigure) waitingForConnectionCommandResult() error { - res, err := nc.configProtocol.ReceiveData(60) - if err != nil { - return err - } +type NetworkConfigure struct { + configStates *ConfigurationStates + configProtocol *configurationprotocol.NetworkConfigurationProtocol +} - if res != nil && res.Type() == cborcoders.ProvisioningStatusMessageType { - status := res.ToProvisioningStatusMessage() - if status.Status == 1 { - nc.state = WaitingForNetworkConfigResult - } else { - newState, err := nc.handleStatusMessage(status.Status) - if err != nil { - return err - } - if newState != NoneState { - nc.state = newState - } - } +func NewNetworkConfigure(configProtocol *configurationprotocol.NetworkConfigurationProtocol) *NetworkConfigure { + return &NetworkConfigure{ + configStates: NewConfigurationStates(configProtocol), + configProtocol: configProtocol, } - - return nil } -func (nc *NetworkConfigure) waitingForNetworkConfigResult() error { - res, err := nc.configProtocol.ReceiveData(200) - if err != nil { - return err - } +func (nc *NetworkConfigure) Run(ctx context.Context, netConfig *NetConfig) error { + state := WaitForConnection + nextState := state + var err error - if res != nil && res.Type() == cborcoders.ProvisioningStatusMessageType { - status := res.ToProvisioningStatusMessage() + for state != End && state != ErrorState { - if status.Status == 2 { - nc.state = End - } else { - newState, err := nc.handleStatusMessage(status.Status) - if err != nil { - return err - } - if newState != NoneState { - nc.state = newState - } + switch state { + case WaitForConnection: + nextState, err = nc.configStates.WaitForConnection() + case WaitingForInitialStatus: + nextState, err = nc.configStates.WaitingForInitialStatus() + case WaitingForNetworkOptions: + nextState, err = nc.configStates.WaitingForNetworkOptions() + case BoardReady: + nextState = ConfigureNetwork + case ConfigureNetwork: + nextState, err = nc.configStates.ConfigureNetwork(ctx, netConfig) + case SendConnectionRequest: + nextState, err = nc.configStates.SendConnectionRequest() + case WaitingForConnectionCommandResult: + nextState, err = nc.configStates.WaitingForConnectionCommandResult() + case MissingParameter: + nextState = ConfigureNetwork + case WaitingForNetworkConfigResult: + nextState, err = nc.configStates.WaitingForNetworkConfigResult() } - } - - return nil -} -func (nc *NetworkConfigure) printNetworkOption(msg *cborcoders.Cmd) { - if msg.Type() == cborcoders.WiFiNetworksType { - networks := msg.ToWiFiNetworks() - for _, network := range networks { - fmt.Printf("SSID: %s, RSSI %d \n", network.SSID, network.RSSI) + if nextState != NoneState { + state = nextState } - } -} - -func (nc *NetworkConfigure) handleStatusMessage(status int16) (ConfigStatus, error) { - statusMessage := configurationprotocol.StatusBoard[status] - logrus.Debugf("NetworkConfigure: status message received: %s", statusMessage) - switch statusMessage { - case "Connecting": - return NoneState, nil - case "Connected": - return NoneState, nil - case "Resetted": - return NoneState, nil - case "Scanning for WiFi networks": - return WaitingForNetworkOptions, nil - case "Failed to connect": - return NoneState, errors.New("connection failed invalid credentials or network configuration") - case "Disconnected": - return NoneState, nil - case "Parameters not provided": - return ConfigureNetwork, nil - case "Invalid parameters": - return NoneState, errors.New("the provided parameters for network configuration are invalid") - case "Cannot execute anew request while another is pending": - return NoneState, errors.New("board is busy, restart the board and try again") - case "Invalid request": - return NoneState, errors.New("invalid request sent to the board") - case "Internet not available": - return NoneState, errors.New("internet not available, check your network connection") - case "HW Error connectivity module": - return NoneState, errors.New("hardware error in connectivity module, check the board") - case "HW Connectivity Module stopped": - return NoneState, errors.New("hardware connectivity module stopped, restart the board and check your sketch") - case "Error initializing secure element": - return NoneState, errors.New("error initializing secure element, check the board and try again") - case "Error configuring secure element": - return NoneState, errors.New("error configuring secure element, check the board and try again") - case "Error locking secure element": - return NoneState, errors.New("error locking secure element, check the board and try again") - case "Error generating UHWID": - return NoneState, errors.New("error generating UHWID, check the board and try again") - case "Error storage begin module": - return NoneState, errors.New("error beginning storage module, check the board storage partitioning and try again") - case "Fail to partition the storage": - return NoneState, errors.New("failed to partition the storage, check the board storage and try again") - case "Generic error": - return NoneState, errors.New("generic error, check the board and try again") - default: - return NoneState, errors.New("generic error, check the board and try again") } + nc.configProtocol.Close() + return err } diff --git a/command/device/create.go b/command/device/create.go index cabc9996..f255e6bf 100644 --- a/command/device/create.go +++ b/command/device/create.go @@ -22,9 +22,13 @@ import ( "errors" "fmt" + "github.com/arduino/arduino-cloud-cli/arduino" "github.com/arduino/arduino-cloud-cli/arduino/cli" "github.com/arduino/arduino-cloud-cli/config" + "github.com/arduino/arduino-cloud-cli/internal/board-protocols/transport" "github.com/arduino/arduino-cloud-cli/internal/iot" + iotapiraw "github.com/arduino/arduino-cloud-cli/internal/iot-api-raw" + "github.com/arduino/arduino-cloud-cli/internal/serial" "github.com/sirupsen/logrus" ) @@ -65,19 +69,87 @@ func Create(ctx context.Context, params *CreateParams, cred *config.Credentials) ) } - iotClient, err := iot.NewClient(cred) + iotApiRawClient := iotapiraw.NewClient(cred) + + boardProvisioningDetails, err := iotApiRawClient.GetBoardDetailByFQBN(board.fqbn) if err != nil { return nil, err } + var devInfo *DeviceInfo + if boardProvisioningDetails.Provisioning != nil && *boardProvisioningDetails.Provisioning == "v2" { + logrus.Info("Provisioning V2 started") + devInfo, err = runProvisioningV2(ctx, params, &comm, iotApiRawClient, cred, board, boardProvisioningDetails) + } else { + logrus.Info("Provisioning V1 started") + devInfo, err = runProvisioningV1(ctx, params, &comm, cred, board) + } + + return devInfo, err +} + +func runProvisioningV2(ctx context.Context, params *CreateParams, comm *arduino.Commander, iotClient *iotapiraw.IoTApiRawClient, cred *config.Credentials, board *board, boardProvisioningDetails *iotapiraw.BoardType) (*DeviceInfo, error) { + if params.ConnectionType == nil { + return nil, errors.New("connection type is required for Provisioning V2") + } + + netConfig := NetConfig{ + Type: connectionTypeIDByName[*params.ConnectionType], + } + + err := GetInputFromMenu(&netConfig) + if err != nil { + return nil, err + } + + var extInterface transport.TransportInterface + extInterface = &serial.Serial{} + + prov := NewProvisionV2(comm, iotClient, cred, extInterface) + // Start the provisioning process + err = prov.Run(ctx, ProvisioningV2BoardParams{ + fqbn: board.fqbn, + address: board.address, + protocol: board.protocol, + serial: board.serial, + minProvSketchVersion: *boardProvisioningDetails.MinProvSketchVersion, + minWiFiVersion: boardProvisioningDetails.MinWiFiVersion, + name: params.Name, + connectionType: *params.ConnectionType, + netConfig: netConfig, + }) + if err != nil { + return nil, err + } + + devId, err := prov.GetProvisioningResult() + if err != nil { + return nil, err + } + + devInfo := &DeviceInfo{ + Name: params.Name, + ID: devId, + Board: *params.ConnectionType, + Serial: board.serial, + FQBN: board.fqbn, + } + return devInfo, nil +} + +func runProvisioningV1(ctx context.Context, params *CreateParams, comm *arduino.Commander, cred *config.Credentials, board *board) (*DeviceInfo, error) { logrus.Info("Creating a new device on the cloud") + iotClient, err := iot.NewClient(cred) + if err != nil { + return nil, err + } dev, err := iotClient.DeviceCreate(ctx, board.fqbn, params.Name, board.serial, board.dType, params.ConnectionType) if err != nil { return nil, err } prov := &provision{ - Commander: comm, + Commander: *comm, cert: iotClient, board: board, id: dev.Id, @@ -94,7 +166,6 @@ func Create(ctx context.Context, params *CreateParams, cred *config.Credentials) } return nil, fmt.Errorf("cannot provision device: %w", err) } - devInfo := &DeviceInfo{ Name: dev.Name, ID: dev.Id, diff --git a/command/device/provisionv2.go b/command/device/provisionv2.go new file mode 100644 index 00000000..6fd0b779 --- /dev/null +++ b/command/device/provisionv2.go @@ -0,0 +1,631 @@ +// This file is part of arduino-cloud-cli. +// +// Copyright (C) 2021 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package device + +import ( + "context" + "errors" + "fmt" + "os" + "strconv" + "strings" + "time" + "unicode" + + "github.com/arduino/arduino-cloud-cli/arduino" + "github.com/arduino/arduino-cloud-cli/config" + configurationprotocol "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol" + "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol/cborcoders" + "github.com/arduino/arduino-cloud-cli/internal/board-protocols/transport" + "github.com/arduino/arduino-cloud-cli/internal/boardpids" + iotapiraw "github.com/arduino/arduino-cloud-cli/internal/iot-api-raw" + provisioningapi "github.com/arduino/arduino-cloud-cli/internal/provisioning-api" + "github.com/arduino/go-paths-helper" + "github.com/beevik/ntp" + "github.com/sirupsen/logrus" +) + +var connectionTypeIDByName = map[string]int32{ + "wifi": 1, + "eth": 2, + "nb": 3, + "gsm": 4, + "lora": 5, + "catm1": 6, + "cellular": 7, +} + +const ( + MaxRetriesFlashProvSketch = 5 + MaxRetriesProvisioningResult = 20 +) + +type ConnectedBoardInfos struct { + UHWID string + PublicKey string + Signature string + BLEMacAddress string +} + +type ProvisioningV2BoardParams struct { + fqbn string + address string + protocol string + serial string + minProvSketchVersion string + minWiFiVersion *string + name string + connectionType string + netConfig NetConfig +} + +type ProvisionV2 struct { + arduino.Commander + iotApiClient *iotapiraw.IoTApiRawClient + provisioningClient *provisioningapi.ProvisioningApiClient + provProt *configurationprotocol.NetworkConfigurationProtocol + configStates *ConfigurationStates + connectedBoardInfos ConnectedBoardInfos + provisioningId string + deviceId string +} + +func NewProvisionV2(comm *arduino.Commander, iotClient *iotapiraw.IoTApiRawClient, credentials *config.Credentials, extInterface transport.TransportInterface) *ProvisionV2 { + provProt := configurationprotocol.NewNetworkConfigurationProtocol(&extInterface) + return &ProvisionV2{ + Commander: *comm, + iotApiClient: iotClient, + provisioningClient: provisioningapi.NewClient(credentials), + provProt: provProt, + configStates: NewConfigurationStates(provProt), + deviceId: "", + } +} + +func (p *ProvisionV2) connectToBoard(address string) error { + err := p.provProt.Connect(address) + return err +} + +/* + * The function return the Arduino Cloud Device ID of the new created board + * if the process ends successfully. Otherwise, an error + */ +func (p *ProvisionV2) GetProvisioningResult() (string, error) { + if p.deviceId == "" { + return "", errors.New("device not provisioned") + } + return p.deviceId, nil +} + +func (p *ProvisionV2) Run(ctx context.Context, params ProvisioningV2BoardParams) error { + var err error + if err = p.connectToBoard(params.address); err != nil { + return err + } + state := WaitForConnection + nextState := NoneState + + // FSM for Provisioning 2.0 + for state != End && state != ErrorState { + + switch state { + case WaitForConnection: + nextState, err = p.configStates.WaitForConnection() + case WaitingForInitialStatus: + nextState, err = p.configStates.WaitingForInitialStatus() + if err != nil { + nextState = FlashProvisioningSketch + } + case WaitingForNetworkOptions: + nextState, err = p.configStates.WaitingForNetworkOptions() + if err != nil { + nextState = FlashProvisioningSketch + } + case BoardReady: + nextState = GetSketchVersionRequest + case GetSketchVersionRequest: + nextState, err = p.getSketchVersionRequest() + case WaitingSketchVersion: + nextState, err = p.waitingSketchVersion(params.minProvSketchVersion) + case FlashProvisioningSketch: + nextState, err = p.flashProvisioningSketch(ctx, params.fqbn, params.address, params.protocol) + case WiFiFWVersionRequest: + nextState, err = p.getWiFiFWVersionRequest(ctx) + case WaitingWiFiFWVersion: + nextState, err = p.waitWiFiFWVersion(params.minWiFiVersion) + case RequestBLEMAC: + nextState, err = p.getBLEMACRequest(ctx) + case WaitBLEMAC: + nextState, err = p.waitBLEMac() + case SendInitialTS: + nextState, err = p.sendInitialTS(ctx) + case IDRequest: + nextState, err = p.getIDRequest() + case WaitingPublicKey: + nextState, err = p.waitingPublicKey() + case WaitingID: + nextState, err = p.waitingUHWID() + case WaitingSignature: + nextState, err = p.waitingSignature() + case ClaimDevice: + nextState, err = p.claimDevice(params.name, params.connectionType) + case RegisterDevice: + nextState, err = p.registerDevice(params.fqbn, params.serial) + case RequestReset: + nextState, err = p.resetBoardRequest() + if err != nil { + nextState = UnclaimDevice + } + case WaitResetResponse: + nextState, err = p.waitingForResetResult() + if err != nil { + nextState = UnclaimDevice + } + case ConfigureNetwork: + nextState, err = p.configStates.ConfigureNetwork(ctx, ¶ms.netConfig) + if err != nil { + nextState = UnclaimDevice + } + case SendConnectionRequest: + nextState, err = p.configStates.SendConnectionRequest() + if err != nil { + nextState = UnclaimDevice + } + case WaitingForConnectionCommandResult: + nextState, err = p.configStates.WaitingForConnectionCommandResult() + if err != nil { + nextState = UnclaimDevice + } + + if nextState == MissingParameter { + nextState = ConfigureNetwork + } + case WaitingForNetworkConfigResult: + _, err = p.configStates.WaitingForNetworkConfigResult() + if err != nil { + nextState = UnclaimDevice + } else { + nextState = WaitingForProvisioningResult + } + case WaitingForProvisioningResult: + nextState, err = p.waitProvisioningResult(ctx) + if err != nil { + nextState = UnclaimDevice + } + case UnclaimDevice: + nextState, _ = p.unclaimDevice() + } + + if nextState != NoneState { + state = nextState + } + + } + + p.provProt.Close() + return err +} + +func (p *ProvisionV2) getSketchVersionRequest() (ConfigStatus, error) { + logrus.Info("Provisioning V2: Requesting Sketch Version") + getSketchVersionMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["GetSketchVersion"]}) + err := p.provProt.SendData(getSketchVersionMessage) + if err != nil { + return ErrorState, err + } + + return WaitingSketchVersion, nil +} + +/* + * This function returns + * - <0 if version1 < version2 + * - =0 if version1 == version2 + * - >0 if version1 > version2 + */ +func (p *ProvisionV2) compareVersions(version1, version2 string) int { + version1Tokens := strings.Split(version1, ".") + version2Tokens := strings.Split(version2, ".") + if len(version1Tokens) != len(version2Tokens) { + return -1 + } + for i := 0; i < len(version1Tokens) && i < len(version2Tokens); i++ { + version1Num, _ := strconv.Atoi(version1Tokens[i]) + version2Num, _ := strconv.Atoi(version2Tokens[i]) + if version1Num != version2Num { + return version1Num - version2Num + } + } + return 0 +} + +func (p *ProvisionV2) waitingSketchVersion(minSketchVersion string) (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + logrus.Error("Provisioning V2: Requesting sketch Version failed, flashing...") + return FlashProvisioningSketch, nil + } + + if res.Type() == cborcoders.ProvisioningSketchVersionMessageType { + sketch_version := res.ToProvisioningSketchVersionMessage().ProvisioningSketchVersion + logrus.Infof("Provisioning V2: Received Sketch Version %s", sketch_version) + + if p.compareVersions(sketch_version, minSketchVersion) < 0 { + logrus.Infof("Provisioning V2: Sketch version %s is lower than required minimum %s. Updating...", sketch_version, minSketchVersion) + return FlashProvisioningSketch, nil + } + + return WiFiFWVersionRequest, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + if status.Status == -7 { + return FlashProvisioningSketch, nil + } + return p.configStates.HandleStatusMessage(status.Status) + } + + return NoneState, nil +} + +func (p *ProvisionV2) flashProvisioningSketch(ctx context.Context, fqbn, address, protocol string) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Downloading provisioning sketch") + path := paths.TempDir().Join("cloud-cli").Join("provisioning_v2_sketch") + + file, err := p.iotApiClient.DownloadProvisioningV2Sketch(fqbn, path, nil) + if err != nil { + logrus.Error("Provisioning V2: Downloading provisioning sketch failed") + return ErrorState, err + } + + // Try to upload the provisioning sketch + logrus.Info("Uploading provisioning sketch on the board") + p.provProt.Close() + errMsg := "Provisioning V2: error while uploading the provisioning sketch" + err = retry(ctx, MaxRetriesFlashProvSketch, time.Millisecond*1000, errMsg, func() error { + return p.UploadBin(ctx, fqbn, file, address, protocol) + }) + if err != nil { + return ErrorState, err + } + + err = os.Remove(file) + if err != nil { + logrus.Error("Provisioning V2: Removing temporary file failed") + return ErrorState, err + } + + logrus.Info("Provisioning V2: Uploading provisioning sketch succeeded") + sleepCtx(ctx, 3*time.Second) + if err = p.connectToBoard(address); err != nil { + return ErrorState, err + } + + return WaitForConnection, nil +} + +func (p *ProvisionV2) getWiFiFWVersionRequest(ctx context.Context) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Requesting WiFi FW Version") + getWiFiFWVersionMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["GetWiFiFWVersion"]}) + err := p.provProt.SendData(getWiFiFWVersionMessage) + if err != nil { + return ErrorState, err + } + sleepCtx(ctx, 1*time.Second) + return WaitingWiFiFWVersion, nil +} + +func (p *ProvisionV2) waitWiFiFWVersion(minWiFiVersion *string) (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + return ErrorState, errors.New("provisioning V2: Requesting WiFi FW Version failed") + } + + if res.Type() == cborcoders.ProvisioningWiFiFWVersionMessageType { + wifi_version := res.ToProvisioningWiFiFWVersionMessage().WiFiFWVersion + logrus.Infof("Received WiFi FW Version: %s", wifi_version) + if minWiFiVersion != nil && + p.compareVersions(wifi_version, *minWiFiVersion) < 0 { + return ErrorState, fmt.Errorf("provisioning V2: WiFi FW version %s is lower than required minimum %s. Please update the board firmware using Arduino IDE or Arduino CLI", wifi_version, *minWiFiVersion) + } + + return RequestBLEMAC, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + return p.configStates.HandleStatusMessage(status.Status) + } + + return ErrorState, errors.New("provisioning V2: WiFi FW version not received") +} + +func (p *ProvisionV2) getBLEMACRequest(ctx context.Context) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Requesting BLE MAC") + getblemacMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["GetBLEMac"]}) + err := p.provProt.SendData(getblemacMessage) + if err != nil { + return ErrorState, err + } + sleepCtx(ctx, 1*time.Second) + return WaitBLEMAC, nil +} + +func (p *ProvisionV2) waitBLEMac() (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + return ErrorState, errors.New("provisioning V2: BLEMac was not received") + } + + if res.Type() == cborcoders.ProvisioningBLEMacAddressMessageType { + mac := res.ToProvisioningBLEMacAddressMessage().BLEMacAddress + logrus.Infof("Provisioning V2: Received MAC in hex: %02X", mac) + macStr := fmt.Sprintf("%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) + p.connectedBoardInfos.BLEMacAddress = macStr + return SendInitialTS, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + return p.configStates.HandleStatusMessage(status.Status) + } + + return ErrorState, errors.New("provisioning V2: BLE MAC address not received") +} + +func (p *ProvisionV2) sendInitialTS(ctx context.Context) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Sending initial timestamp") + var ts int64 + t, err := ntp.Time("time.arduino.cc") + if err == nil { + ts = t.Unix() + } else { + logrus.Warnf("Provisioning V2: Cannot get time from NTP server, using local time: %v", err) + ts = time.Now().Unix() + } + + logrus.Infof("Provisioning V2: Sending timestamp: %d", ts) + tsMessage := cborcoders.From(cborcoders.ProvisioningTimestampMessage{Timestamp: uint64(ts)}) + err = p.provProt.SendData(tsMessage) + if err != nil { + return ErrorState, err + } + sleepCtx(ctx, 1*time.Second) + return IDRequest, nil +} + +func (p *ProvisionV2) getIDRequest() (ConfigStatus, error) { + logrus.Info("Provisioning V2: Requesting UniqueID") + getuuidMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["GetID"]}) + err := p.provProt.SendData(getuuidMessage) + if err != nil { + return ErrorState, err + } + + return WaitingPublicKey, nil +} + +func (p *ProvisionV2) waitingPublicKey() (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + return ErrorState, errors.New("provisioning V2: public key was not received") + } + + if res.Type() == cborcoders.ProvisioningPublicKeyMessageType { + pubKey := res.ToProvisioningPublicKeyMessage().ProvisioningPublicKey + logrus.Info("Provisioning V2: Received Public Key") + p.connectedBoardInfos.PublicKey = pubKey + return WaitingID, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + newState, err := p.configStates.HandleStatusMessage(status.Status) + if newState == MissingParameter { + return SendInitialTS, nil + } + return newState, err + } + return ErrorState, errors.New("provisioning V2: Public Key not received") +} + +func (p *ProvisionV2) waitingUHWID() (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + return ErrorState, errors.New("provisioning V2: UniqueID was not received") + } + + if res.Type() == cborcoders.ProvisioningUniqueIdMessageType { + uhwid := res.ToProvisioningUniqueIdMessage().UniqueId + logrus.Infof("Provisioning V2: Received UniqueID") + uhwidString := fmt.Sprintf("%02x", uhwid) + p.connectedBoardInfos.UHWID = uhwidString + return WaitingSignature, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + return p.configStates.HandleStatusMessage(status.Status) + } + + return ErrorState, errors.New("provisioning V2: UniqueID was not received") +} + +func (p *ProvisionV2) waitingSignature() (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res == nil { + return ErrorState, errors.New("provisioning V2: Signature was not received") + } + + if res.Type() == cborcoders.ProvisioningSignatureMessageType { + signature := res.ToProvisioningSignatureMessage().Signature + logrus.Infof("Provisioning V2: Received Signature") + + signatureString := strings.TrimRightFunc(fmt.Sprintf("%s", signature), func(r rune) bool { + return unicode.IsLetter(r) == false && unicode.IsNumber(r) == false + }) + p.connectedBoardInfos.Signature = signatureString + return ClaimDevice, nil + } + + if res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + return p.configStates.HandleStatusMessage(status.Status) + } + + return ErrorState, errors.New("provisioning V2: Signature was not received") +} + +func (p *ProvisionV2) claimDevice(name, connectionType string) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Claiming device...") + + claimData := provisioningapi.ClaimData{ + BLEMac: p.connectedBoardInfos.BLEMacAddress, + BoardToken: p.connectedBoardInfos.Signature, + ConnectionType: connectionType, + DeviceName: name, + } + + provResp, provErr, err := p.provisioningClient.ClaimDevice(claimData) + if err != nil { + return ErrorState, fmt.Errorf("provisioning V2: failed to claim device: %w", err) + } + + if provErr != nil { + if provErr.ErrCode == 1 || provErr.ErrCode == 2 { + logrus.Warn("Provisioning V2: Device claim failed. The board has to migrate") + return RegisterDevice, nil + } + + if provErr.ErrCode == 3 { + // If the device key and the DB key are different + return ErrorState, fmt.Errorf("provisioning V2: Device claim failed. Keys do not match. Please contact the Arduino Support with this hardware id: %s", p.connectedBoardInfos.UHWID) + } + + return ErrorState, fmt.Errorf("provisioning V2: Device claim failed with error: %s", provErr.Err) + } + + if provResp != nil { + p.provisioningId = provResp.OnboardId + return RequestReset, nil + } + + return ErrorState, errors.New("provisioning V2: Device ID not received") +} + +func (p *ProvisionV2) registerDevice(fqbn, serial string) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Registering device...") + + registerData := provisioningapi.RegisterBoardData{ + PID: boardpids.ArduinoFqbnToPID[fqbn], + PublicKey: p.connectedBoardInfos.PublicKey, + Serial: &serial, + UniqueHardwareID: p.connectedBoardInfos.UHWID, + VID: boardpids.ArduinoVendorID, //Only Arduino boards can support Provisioning 2.0 + } + + provErr, err := p.provisioningClient.RegisterDevice(registerData) + if err != nil { + return ErrorState, fmt.Errorf("provisioning V2: failed to register device: %w", err) + } + + if provErr != nil { + return ErrorState, fmt.Errorf("provisioning V2: Device registration failed with error: %s", provErr.Err) + } + + logrus.Info("Provisioning V2: Device registered successfully, claiming...") + return ClaimDevice, nil +} + +func (p *ProvisionV2) resetBoardRequest() (ConfigStatus, error) { + logrus.Info("Provisioning V2: Requesting Reset Stored Credentials") + resetMessage := cborcoders.From(cborcoders.ProvisioningCommandsMessage{Command: configurationprotocol.Commands["Reset"]}) + err := p.provProt.SendData(resetMessage) + if err != nil { + return ErrorState, err + } + + return WaitResetResponse, nil +} + +func (p *ProvisionV2) waitingForResetResult() (ConfigStatus, error) { + res, err := p.provProt.ReceiveData(CommandResponseTimeoutLong_s) + if err != nil { + return ErrorState, err + } + + if res != nil && res.Type() == cborcoders.ProvisioningStatusMessageType { + status := res.ToProvisioningStatusMessage() + if status.Status == 4 { + logrus.Info("Provisioning V2: Reset Stored Credentials successful") + return ConfigureNetwork, nil + } + return p.configStates.HandleStatusMessage(status.Status) + } + + return ErrorState, errors.New("provisioning V2: Reset Stored Credentials failed") +} + +func (p *ProvisionV2) waitProvisioningResult(ctx context.Context) (ConfigStatus, error) { + logrus.Info("Provisioning V2: Waiting for provisioning result...") + + for n := 0; n < MaxRetriesProvisioningResult; n++ { + res, err := p.provisioningClient.GetProvisioningDetail(p.provisioningId) + if err != nil { + return ErrorState, err + } + if res.DeviceID != nil { + p.deviceId = *res.DeviceID + return End, nil + } + sleepCtx(ctx, 10*time.Second) + } + return ErrorState, errors.New("provisioning V2: Timeout expires for board provisioning. The board was not able to reach the Arduino IoT Cloud for completing the provisioning") +} + +func (p *ProvisionV2) unclaimDevice() (ConfigStatus, error) { + logrus.Warnf("Provisioning V2: Something went wrong, unclaiming device...") + _, err := p.provisioningClient.UnclaimDevice(p.provisioningId) + return End, err +} diff --git a/command/ota/generate.go b/command/ota/generate.go index 50663222..caf1eaa9 100644 --- a/command/ota/generate.go +++ b/command/ota/generate.go @@ -23,6 +23,7 @@ import ( "os" "strings" + "github.com/arduino/arduino-cloud-cli/internal/boardpids" inota "github.com/arduino/arduino-cloud-cli/internal/ota" ) @@ -37,12 +38,12 @@ func Generate(binFile string, outFile string, fqbn string) error { // Esp32 boards have a wide range of vid and pid, we don't map all of them // If the fqbn is the one of an ESP32 board, we force a default magic number that matches the same default expected on the fw side if !strings.HasPrefix(fqbn, "arduino:esp32") && strings.HasPrefix(fqbn, "esp32") { - magicNumberPart1 = inota.Esp32MagicNumberPart1 - magicNumberPart2 = inota.Esp32MagicNumberPart2 + magicNumberPart1 = boardpids.Esp32MagicNumberPart1 + magicNumberPart2 = boardpids.Esp32MagicNumberPart2 } else { //For Arduino Boards we use vendorId and productID to form the magic number - magicNumberPart1 = inota.ArduinoVendorID - productID, ok := inota.ArduinoFqbnToPID[fqbn] + magicNumberPart1 = boardpids.ArduinoVendorID + productID, ok := boardpids.ArduinoFqbnToPID[fqbn] if !ok { return errors.New("fqbn not valid") } diff --git a/go.mod b/go.mod index 99b2ec48..8c85a5bc 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,12 @@ module github.com/arduino/arduino-cloud-cli go 1.23 require ( - github.com/arduino/arduino-cli v0.0.0-20240927141754-d9dd4ba1ed71 + github.com/arduino/arduino-cli v0.0.0-20250901123057-20dd7c932f59 github.com/arduino/go-paths-helper v1.12.1 github.com/arduino/go-win32-utils v1.0.0 github.com/arduino/iot-client-go/v3 v3.1.1 + github.com/beevik/ntp v1.4.3 + github.com/fxamacker/cbor/v2 v2.8.0 github.com/gofrs/uuid v4.2.0+incompatible github.com/google/go-cmp v0.6.0 github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6 @@ -18,7 +20,7 @@ require ( github.com/stretchr/testify v1.9.0 go.bug.st/cleanup v1.0.0 go.bug.st/serial v1.6.2 - golang.org/x/crypto v0.18.0 + golang.org/x/crypto v0.23.0 golang.org/x/oauth2 v0.25.0 google.golang.org/grpc v1.61.0 gopkg.in/yaml.v3 v3.0.1 @@ -36,7 +38,6 @@ require ( github.com/emirpasic/gods v1.18.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/fxamacker/cbor/v2 v2.8.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/h2non/filetype v1.1.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -71,11 +72,11 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.bug.st/downloader/v2 v2.1.1 // indirect - go.bug.st/relaxed-semver v0.9.0 // indirect + go.bug.st/relaxed-semver v0.10.1 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/go.sum b/go.sum index 4b8560ba..1f3605b6 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/arduino/arduino-cli v0.0.0-20240927141754-d9dd4ba1ed71 h1:UsiGQuo0H5l7DmZYuEn20jBiPHSOj8QF80uyoegXE90= -github.com/arduino/arduino-cli v0.0.0-20240927141754-d9dd4ba1ed71/go.mod h1:jkWY40xUrKH6CYi1ppeFF4h6LS3UaOUMo+fk4zYf74I= +github.com/arduino/arduino-cli v0.0.0-20250901123057-20dd7c932f59 h1:KjD3s14n+hc6G+NFzg6gh5F3AZU9zfoSSoa/ivZizbk= +github.com/arduino/arduino-cli v0.0.0-20250901123057-20dd7c932f59/go.mod h1:jkWY40xUrKH6CYi1ppeFF4h6LS3UaOUMo+fk4zYf74I= github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= github.com/arduino/go-paths-helper v1.12.1 h1:WkxiVUxBjKWlLMiMuYy8DcmVrkxdP7aKxQOAq7r2lVM= github.com/arduino/go-paths-helper v1.12.1/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM= @@ -80,6 +80,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/beevik/ntp v1.4.3 h1:PlbTvE5NNy4QHmA4Mg57n7mcFTmr1W1j3gcK7L1lqho= +github.com/beevik/ntp v1.4.3/go.mod h1:Unr8Zg+2dRn7d8bHFuehIMSvvUYssHMxW3Q5Nx4RW5Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -454,8 +456,8 @@ go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA= go.bug.st/cleanup v1.0.0/go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk= go.bug.st/downloader/v2 v2.1.1 h1:nyqbUizo3E2IxCCm4YFac4FtSqqFpqWP+Aae5GCMuw4= go.bug.st/downloader/v2 v2.1.1/go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII= -go.bug.st/relaxed-semver v0.9.0 h1:qt0T8W70VCurvsbxRK25fQwiTOFjkzwC/fDOpyPnchQ= -go.bug.st/relaxed-semver v0.9.0/go.mod h1:ug0/W/RPYUjliE70Ghxg77RDHmPxqpo7SHV16ijss7Q= +go.bug.st/relaxed-semver v0.10.1 h1:g61DeaZ48IsikiPpd52wE/extF+sqX0SyllzsEIWhBM= +go.bug.st/relaxed-semver v0.10.1/go.mod h1:lPVGdtzbQ9/2fv6iXqIXWHOj6cMTUJ/l/Lu1w+sgdio= go.bug.st/serial v1.6.2 h1:kn9LRX3sdm+WxWKufMlIRndwGfPWsH1/9lCWXQCasq8= go.bug.st/serial v1.6.2/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -485,8 +487,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -567,8 +569,8 @@ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -670,11 +672,11 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -684,8 +686,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/board-protocols/configuration-protocol/cborcoders/enc_dec.go b/internal/board-protocols/configuration-protocol/cborcoders/enc_dec.go index b76aff8f..e9ff9aa7 100644 --- a/internal/board-protocols/configuration-protocol/cborcoders/enc_dec.go +++ b/internal/board-protocols/configuration-protocol/cborcoders/enc_dec.go @@ -79,7 +79,7 @@ func init() { panic(err) } - _em, err = cbor.EncOptions{IndefLength: 1}.EncModeWithTags(tags) + _em, err = cbor.EncOptions{IndefLength: 1, NilContainers: cbor.NilContainerAsEmpty}.EncModeWithTags(tags) if err != nil { panic(err) diff --git a/internal/board-protocols/configuration-protocol/cborcoders/enc_dec_test.go b/internal/board-protocols/configuration-protocol/cborcoders/enc_dec_test.go index f0f47bdc..3abe5b52 100644 --- a/internal/board-protocols/configuration-protocol/cborcoders/enc_dec_test.go +++ b/internal/board-protocols/configuration-protocol/cborcoders/enc_dec_test.go @@ -185,13 +185,24 @@ func TestEncodeDecode(t *testing.T) { name: "provisioning catm1 config", in: From(ProvisioningCATM1ConfigMessage{ PIN: "12345678", - Band: [4]uint32{1, 2, 524288, 134217728}, + Band: []uint32{1, 2, 524288, 134217728}, Apn: "apn.arduino.cc", Login: "TESTUSER", Pass: "TESTPASSWORD", }), want: "DA00012008856831323334353637388401021A000800001A080000006E61706E2E61726475696E6F2E63636854455354555345526C5445535450415353574F5244", }, + { + name: "provisioning catm1 config no band", + in: From(ProvisioningCATM1ConfigMessage{ + PIN: "12345678", + Band: []uint32{}, + Apn: "apn.arduino.cc", + Login: "TESTUSER", + Pass: "TESTPASSWORD", + }), + want: "DA0001200885683132333435363738806E61706E2E61726475696E6F2E63636854455354555345526C5445535450415353574F5244", + }, { name: "provisioning ethernet config ipv4", in: From(ProvisioningEthernetConfigMessage{ diff --git a/internal/board-protocols/configuration-protocol/cborcoders/model.go b/internal/board-protocols/configuration-protocol/cborcoders/model.go index ccb3f066..158af8c3 100644 --- a/internal/board-protocols/configuration-protocol/cborcoders/model.go +++ b/internal/board-protocols/configuration-protocol/cborcoders/model.go @@ -133,7 +133,7 @@ func (t ProvisioningLoRaConfigMessage) String() string { type ProvisioningCATM1ConfigMessage struct { _ struct{} `cbor:",toarray"` PIN string - Band [4]uint32 + Band []uint32 Apn string Login string Pass string diff --git a/internal/board-protocols/configuration-protocol/configuration_protocol.go b/internal/board-protocols/configuration-protocol/configuration_protocol.go index cfff4382..ea467ae5 100644 --- a/internal/board-protocols/configuration-protocol/configuration_protocol.go +++ b/internal/board-protocols/configuration-protocol/configuration_protocol.go @@ -19,6 +19,7 @@ package configurationprotocol import ( "fmt" + "time" "github.com/arduino/arduino-cloud-cli/internal/board-protocols/configuration-protocol/cborcoders" "github.com/arduino/arduino-cloud-cli/internal/board-protocols/frame" @@ -99,6 +100,13 @@ func (ncp *NetworkConfigurationProtocol) Connect(address string) error { } +func (ncp *NetworkConfigurationProtocol) Connected() bool { + if ncp.transport == nil || *ncp.transport == nil { + return false + } + return (*ncp.transport).Connected() +} + func (ncp *NetworkConfigurationProtocol) Close() error { if ncp.transport == nil || *ncp.transport == nil { return fmt.Errorf("NetworkConfigurationProtocol: transport interface is not initialized") @@ -111,6 +119,7 @@ func (ncp *NetworkConfigurationProtocol) Close() error { if err != nil { return fmt.Errorf("error sending end of transmission: %w", err) } + time.Sleep(1 * time.Second) } err := (*ncp.transport).Close() diff --git a/internal/ota/boardpids.go b/internal/boardpids/boardpids.go similarity index 70% rename from internal/ota/boardpids.go rename to internal/boardpids/boardpids.go index 6b4b824f..78733c12 100644 --- a/internal/ota/boardpids.go +++ b/internal/boardpids/boardpids.go @@ -15,7 +15,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package ota +package boardpids var ( BoardTypes = map[uint32]string{ @@ -44,21 +44,23 @@ var ( "025F": "arduino:mbed_nicla:nicla_vision", "0064": "arduino:mbed_opta:opta", "0266": "arduino:mbed_giga:giga", + "0068": "arduino:renesas_portenta:portenta_c33", } ArduinoFqbnToPID = map[string]string{ - "arduino:samd:nano_33_iot": "8057", - "arduino:samd:mkr1000": "804E", - "arduino:samd:mkrgsm1400": "8052", - "arduino:samd:mkrnb1500": "8055", - "arduino:samd:mkrwifi1010": "8054", - "arduino:mbed_nano:nanorp2040connect": "005E", - "arduino:mbed_portenta:envie_m7": "025B", - "arduino:mbed_nicla:nicla_vision": "025F", - "arduino:mbed_opta:opta": "0064", - "arduino:mbed_giga:giga": "0266", - "arduino:renesas_uno:unor4wifi": "1002", - "arduino:esp32:nano_nora": "0070", + "arduino:samd:nano_33_iot": "8057", + "arduino:samd:mkr1000": "804E", + "arduino:samd:mkrgsm1400": "8052", + "arduino:samd:mkrnb1500": "8055", + "arduino:samd:mkrwifi1010": "8054", + "arduino:mbed_nano:nanorp2040connect": "005E", + "arduino:mbed_portenta:envie_m7": "025B", + "arduino:mbed_nicla:nicla_vision": "025F", + "arduino:mbed_opta:opta": "0064", + "arduino:mbed_giga:giga": "0266", + "arduino:renesas_uno:unor4wifi": "1002", + "arduino:esp32:nano_nora": "0070", + "arduino:renesas_portenta:portenta_c33": "0068", } ArduinoVendorID = "2341" diff --git a/internal/iot-api-raw/client.go b/internal/iot-api-raw/client.go new file mode 100644 index 00000000..2565cee5 --- /dev/null +++ b/internal/iot-api-raw/client.go @@ -0,0 +1,163 @@ +package iotapiraw + +import ( + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + + "github.com/arduino/arduino-cloud-cli/config" + "github.com/arduino/arduino-cloud-cli/internal/iot" + "github.com/arduino/go-paths-helper" + "golang.org/x/oauth2" +) + +type IoTApiRawClient struct { + client *http.Client + host string + src oauth2.TokenSource + organization string +} + +func NewClient(credentials *config.Credentials) *IoTApiRawClient { + host := iot.GetArduinoAPIBaseURL() + tokenSource := iot.NewUserTokenSource(credentials.Client, credentials.Secret, host, credentials.Organization) + return &IoTApiRawClient{ + client: &http.Client{}, + src: tokenSource, + host: host, + organization: credentials.Organization, + } +} + +func (c *IoTApiRawClient) performRequest(endpoint, method, token string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequest(method, endpoint, body) + if err != nil { + return nil, err + } + req.Header.Add("Authorization", "Bearer "+token) + req.Header.Add("Content-Type", "application/json") + if c.organization != "" { + req.Header.Add("X-Organization", c.organization) + } + res, err := c.client.Do(req) + if err != nil { + return nil, err + } + return res, nil +} + +func (c *IoTApiRawClient) GetBoardsDetail() (*BoardTypeList, error) { + endpoint := c.host + "/iot/v1/supported/devices" + token, err := iot.GetToken(c.src) + if err != nil { + return nil, err + } + + res, err := c.performRequest(endpoint, http.MethodGet, token.AccessToken, nil) + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + var response BoardTypeList + + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + err = json.Unmarshal(respBytes, &response) + if err != nil { + return nil, err + } + return &response, nil + } else if res.StatusCode == 400 { + return nil, errors.New(endpoint + " returned bad request") + } else if res.StatusCode == 401 { + return nil, errors.New(endpoint + " returned unauthorized request") + } else if res.StatusCode == 403 { + return nil, errors.New(endpoint + " returned forbidden request") + } else if res.StatusCode == 500 { + return nil, errors.New(endpoint + " returned internal server error") + } + + return nil, err +} + +func (c *IoTApiRawClient) GetBoardDetailByFQBN(fqbn string) (*BoardType, error) { + boardsList, err := c.GetBoardsDetail() + if err != nil { + return nil, err + } + + for _, b := range *boardsList { + if b.FQBN != nil && *b.FQBN == fqbn { + return &b, nil + } + } + return nil, fmt.Errorf("board with fqbn %s not found", fqbn) +} + +func (c *IoTApiRawClient) DownloadProvisioningV2Sketch(fqbn string, path *paths.Path, filename *string) (string, error) { + endpoint := c.host + "/iot/v2/binaries/provisioningv2?fqbn=" + fqbn + token, err := iot.GetToken(c.src) + if err != nil { + return "", err + } + + res, err := c.performRequest(endpoint, http.MethodGet, token.AccessToken, nil) + if err != nil { + return "", err + } + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + var response Prov2SketchBinRes + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return "", err + } + + err = json.Unmarshal(respBytes, &response) + if err != nil { + return "", err + } + + if filename != nil { + path = path.Join(*filename) + } else { + path = path.Join(response.FileName) + } + + path.Parent().MkdirAll() + + bytes, err := base64.StdEncoding.DecodeString(response.Binary) + if err != nil { + return "", err + } + + if err = path.WriteFile(bytes); err != nil { + return "", fmt.Errorf("writing provisioning v2 binary: %w", err) + } + p, err := path.Abs() + if err != nil { + return "", fmt.Errorf("cannot retrieve absolute path of downloaded provisioning v2 binary: %w", err) + } + return p.String(), nil + } else if res.StatusCode == 400 { + return "", errors.New(endpoint + " returned bad request") + } else if res.StatusCode == 401 { + return "", errors.New(endpoint + " returned unauthorized request") + } else if res.StatusCode == 403 { + return "", errors.New(endpoint + " returned forbidden request") + } else if res.StatusCode == 500 { + return "", errors.New(endpoint + " returned internal server error") + } + + return "", errors.New("failed to download the provisioning v2 binary: unknown error") + +} diff --git a/internal/iot-api-raw/dto.go b/internal/iot-api-raw/dto.go new file mode 100644 index 00000000..69d07968 --- /dev/null +++ b/internal/iot-api-raw/dto.go @@ -0,0 +1,23 @@ +package iotapiraw + +type BoardType struct { + FQBN *string `json:"fqbn,omitempty"` + Label string `json:"label"` + MinProvSketchVersion *string `json:"min_provisioning_sketch_version,omitempty"` + MinWiFiVersion *string `json:"min_provisioning_wifi_version,omitempty"` + Provisioning *string `json:"provisioning,omitempty"` + Tags []string `json:"tags"` + Type string `json:"type"` + Vendor string `json:"vendor"` + OTAAvailable *bool `json:"ota_available,omitempty"` +} + +type BoardTypeList []BoardType + +type Prov2SketchBinRes struct { + Binary string `json:"bin"` + FileName string `json:"filename"` + FQBN string `json:"fqbn"` + Name string `json:"name"` + SHA256 string `json:"sha256"` +} diff --git a/internal/iot/token.go b/internal/iot/token.go index bfa3df37..3c1912d2 100644 --- a/internal/iot/token.go +++ b/internal/iot/token.go @@ -70,3 +70,14 @@ func ctxWithToken(ctx context.Context, src oauth2.TokenSource) (context.Context, } return context.WithValue(ctx, iotclient.ContextOAuth2, src), nil } + +func GetToken(src oauth2.TokenSource) (*oauth2.Token, error) { + token, err := src.Token() + if err != nil { + if strings.Contains(err.Error(), "401") { + return nil, errors.New("wrong credentials") + } + return nil, fmt.Errorf("cannot retrieve a valid token: %w", err) + } + return token, nil +} diff --git a/internal/ota/decoder_test.go b/internal/ota/decoder_test.go index 49290b91..5b3d9347 100644 --- a/internal/ota/decoder_test.go +++ b/internal/ota/decoder_test.go @@ -3,6 +3,7 @@ package ota import ( "testing" + "github.com/arduino/arduino-cloud-cli/internal/boardpids" "github.com/stretchr/testify/assert" ) @@ -10,17 +11,17 @@ func TestDecodeHeader(t *testing.T) { header, err := DecodeOtaFirmwareHeaderFromFile("testdata/cloud.ota") assert.Nil(t, err) - assert.Equal(t, ArduinoVendorID, header.VID) + assert.Equal(t, boardpids.ArduinoVendorID, header.VID) assert.Equal(t, "8057", header.PID) assert.Equal(t, "arduino:samd:nano_33_iot", *header.FQBN) - assert.Equal(t, ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) + assert.Equal(t, boardpids.ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) header, err = DecodeOtaFirmwareHeaderFromFile("testdata/blink.ota") assert.Nil(t, err) - assert.Equal(t, ArduinoVendorID, header.VID) + assert.Equal(t, boardpids.ArduinoVendorID, header.VID) assert.Equal(t, "8057", header.PID) assert.Equal(t, "arduino:samd:nano_33_iot", *header.FQBN) - assert.Equal(t, ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) + assert.Equal(t, boardpids.ArduinoFqbnToPID["arduino:samd:nano_33_iot"], header.PID) } @@ -40,8 +41,8 @@ func TestDecodeEsp32Header(t *testing.T) { header, err := DecodeOtaFirmwareHeaderFromFile("testdata/esp32.ota") assert.Nil(t, err) - assert.Equal(t, Esp32MagicNumberPart1, header.VID) - assert.Equal(t, Esp32MagicNumberPart2, header.PID) + assert.Equal(t, boardpids.Esp32MagicNumberPart1, header.VID) + assert.Equal(t, boardpids.Esp32MagicNumberPart2, header.PID) assert.Nil(t, header.FQBN) assert.Equal(t, "ESP32", header.BoardType) diff --git a/internal/provisioning-api/client.go b/internal/provisioning-api/client.go new file mode 100644 index 00000000..3bba5591 --- /dev/null +++ b/internal/provisioning-api/client.go @@ -0,0 +1,227 @@ +// This file is part of arduino-cloud-cli. +// +// Copyright (C) 2025 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package provisioningapi + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + + "github.com/arduino/arduino-cloud-cli/config" + "github.com/arduino/arduino-cloud-cli/internal/iot" + "golang.org/x/oauth2" +) + +type ProvisioningApiClient struct { + client *http.Client + host string + src oauth2.TokenSource + organization string +} + +func NewClient(credentials *config.Credentials) *ProvisioningApiClient { + host := iot.GetArduinoAPIBaseURL() + tokenSource := iot.NewUserTokenSource(credentials.Client, credentials.Secret, host, credentials.Organization) + return &ProvisioningApiClient{ + client: &http.Client{}, + src: tokenSource, + host: host, + organization: credentials.Organization, + } +} + +func (c *ProvisioningApiClient) performRequest(endpoint, method, token string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequest(method, endpoint, body) + if err != nil { + return nil, err + } + req.Header.Add("Authorization", "Bearer "+token) + req.Header.Add("Content-Type", "application/json") + if c.organization != "" { + req.Header.Add("X-Organization", c.organization) + } + res, err := c.client.Do(req) + if err != nil { + return nil, err + } + return res, nil +} + +func (c *ProvisioningApiClient) ClaimDevice(data ClaimData) (*ClaimResponse, *BadResponse, error) { + endpoint := c.host + "/provisioning/v1/onboarding/claim" + token, err := iot.GetToken(c.src) + if err != nil { + return nil, nil, err + } + + dataJson, err := json.Marshal(data) + if err != nil { + return nil, nil, fmt.Errorf("failed to marshal claim data: %w", err) + } + + res, err := c.performRequest(endpoint, http.MethodPost, token.AccessToken, bytes.NewReader(dataJson)) + if err != nil { + return nil, nil, err + } + defer res.Body.Close() + + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return nil, nil, err + } + + if res.StatusCode == http.StatusOK { + var response ClaimResponse + + err = json.Unmarshal(respBytes, &response) + if err != nil { + return nil, nil, err + } + return &response, nil, nil + } + var badResponse BadResponse + + err = json.Unmarshal(respBytes, &badResponse) + if err != nil { + return nil, nil, fmt.Errorf("failed to unmarshal bad response: %s", respBytes) + } + + return nil, &badResponse, nil +} + +func (c *ProvisioningApiClient) RegisterDevice(data RegisterBoardData) (*BadResponse, error) { + endpoint := c.host + "/provisioning/v1/boards/register" + token, err := iot.GetToken(c.src) + if err != nil { + return nil, err + } + + dataJson, err := json.Marshal(data) + if err != nil { + return nil, fmt.Errorf("failed to marshal register data: %w", err) + } + + res, err := c.performRequest(endpoint, http.MethodPost, token.AccessToken, bytes.NewReader(dataJson)) + if err != nil { + return nil, err + } + defer res.Body.Close() + + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + if res.StatusCode == http.StatusOK { + return nil, nil + } + var badResponse BadResponse + + err = json.Unmarshal(respBytes, &badResponse) + if err != nil { + return nil, err + } + + return &badResponse, nil +} + +func (c *ProvisioningApiClient) UnclaimDevice(provisioningId string) (*BadResponse, error) { + endpoint := c.host + "/provisioning/v1/onboarding/" + provisioningId + token, err := iot.GetToken(c.src) + if err != nil { + return nil, err + } + + res, err := c.performRequest(endpoint, http.MethodDelete, token.AccessToken, nil) + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + return nil, nil + } + var badResponse BadResponse + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + err = json.Unmarshal(respBytes, &badResponse) + if err != nil { + return nil, err + } + + return &badResponse, nil +} + +func (c *ProvisioningApiClient) GetProvisioningList() (*OnboardingsResponse, error) { + endpoint := c.host + "/provisioning/v1/onboarding?all=true" + token, err := iot.GetToken(c.src) + if err != nil { + return nil, err + } + + res, err := c.performRequest(endpoint, http.MethodGet, token.AccessToken, nil) + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + var response OnboardingsResponse + + respBytes, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + err = json.Unmarshal(respBytes, &response) + if err != nil { + return nil, err + } + return &response, nil + } else if res.StatusCode == 400 { + return nil, errors.New(endpoint + " returned bad request") + } else if res.StatusCode == 401 { + return nil, errors.New(endpoint + " returned unauthorized request") + } else if res.StatusCode == 403 { + return nil, errors.New(endpoint + " returned forbidden request") + } else if res.StatusCode == 500 { + return nil, errors.New(endpoint + " returned internal server error") + } + + return nil, err +} + +func (c *ProvisioningApiClient) GetProvisioningDetail(provID string) (*Onboarding, error) { + onboardingList, err := c.GetProvisioningList() + if err != nil { + return nil, fmt.Errorf("failed to get provisioning list: %w", err) + } + + for _, onboarding := range onboardingList.Onboardings { + if onboarding.ID == provID { + return &onboarding, nil + } + } + + return nil, fmt.Errorf("onboarding with ID %s not found", provID) +} diff --git a/internal/provisioning-api/dto.go b/internal/provisioning-api/dto.go new file mode 100644 index 00000000..f2da081d --- /dev/null +++ b/internal/provisioning-api/dto.go @@ -0,0 +1,62 @@ +// This file is part of arduino-cloud-cli. +// +// Copyright (C) 2025 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package provisioningapi + +type RegisterBoardData struct { + PID string `json:"pid"` + PublicKey string `json:"public_key"` + Serial *string `json:"serial"` + UniqueHardwareID string `json:"unique_hardware_id"` + VID string `json:"vid"` +} + +type ClaimData struct { + BLEMac string `json:"ble_mac"` + BoardToken string `json:"board_token"` + ConnectionType string `json:"connection_type"` + DeviceName string `json:"device_name"` +} + +type BadResponse struct { + Err string `json:"err"` + ErrCode int `json:"err_code"` +} + +type ClaimResponse struct { + OnboardId string `json:"id"` +} + +type Onboarding struct { + ID string `json:"id"` + UniqueHardwareID string `json:"unique_hardware_id"` + DeviceName string `json:"device_name"` + ConnectionType string `json:"connection_type"` + DeviceID *string `json:"device_id"` + UserID string `json:"user_id"` + OrgID *string `json:"org_id"` + BLEMac string `json:"ble_mac"` + CreatedAt string `json:"created_at"` + ProvisionedAt *string `json:"provisioned_at"` + ClaimedAt string `json:"claimed_at"` + EndedAt *string `json:"ended_at"` + FQBN string `json:"fqbn"` +} + +type OnboardingsResponse struct { + Onboardings []Onboarding `json:"onboardings"` +}