A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-fwuploader/commit/3b99ab67a74f1f8d4d5d118b3e07edca014b0708 below:

Introducing plugins system (#173) · arduino/arduino-fwuploader@3b99ab6 · GitHub

File tree Expand file treeCollapse file tree 27 files changed

+4273

-332

lines changed

Filter options

Expand file treeCollapse file tree 27 files changed

+4273

-332

lines changed Original file line number Diff line number Diff line change

@@ -2,6 +2,11 @@

2 2

sources:

3 3

go: true

4 4 5 +

reviewed:

6 +

go:

7 +

- golang.org/x/exp/constraints

8 +

- golang.org/x/exp/slices

9 + 5 10

apps:

6 11

- source_path: ./

7 12

@@ -11,6 +16,7 @@ allowed:

11 16

- gpl-1.0-or-later

12 17

- gpl-1.0+ # Deprecated ID for `gpl-1.0-or-later`

13 18

- gpl-2.0-or-later

19 +

- gpl-2.0

14 20

- gpl-2.0+ # Deprecated ID for `gpl-2.0-or-later`

15 21

- gpl-3.0-only

16 22

- gpl-3.0 # Deprecated ID for `gpl-3.0-only`

Original file line number Diff line number Diff line change

@@ -0,0 +1,63 @@

1 +

---

2 +

name: golang.org/x/exp/constraints

3 +

version: v0.0.0-20230321023759-10a507213a29

4 +

type: go

5 +

summary: Package constraints defines a set of useful constraints to be used with type

6 +

parameters.

7 +

homepage: https://pkg.go.dev/golang.org/x/exp/constraints

8 +

license: other

9 +

licenses:

10 +

- sources: exp@v0.0.0-20230321023759-10a507213a29/LICENSE

11 +

text: |

12 +

Copyright (c) 2009 The Go Authors. All rights reserved.

13 + 14 +

Redistribution and use in source and binary forms, with or without

15 +

modification, are permitted provided that the following conditions are

16 +

met:

17 + 18 +

* Redistributions of source code must retain the above copyright

19 +

notice, this list of conditions and the following disclaimer.

20 +

* Redistributions in binary form must reproduce the above

21 +

copyright notice, this list of conditions and the following disclaimer

22 +

in the documentation and/or other materials provided with the

23 +

distribution.

24 +

* Neither the name of Google Inc. nor the names of its

25 +

contributors may be used to endorse or promote products derived from

26 +

this software without specific prior written permission.

27 + 28 +

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

29 +

"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

30 +

LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

31 +

A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT

32 +

OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

33 +

SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

34 +

LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

35 +

DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY

36 +

THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

37 +

(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

38 +

OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

39 +

- sources: exp@v0.0.0-20230321023759-10a507213a29/PATENTS

40 +

text: |

41 +

Additional IP Rights Grant (Patents)

42 + 43 +

"This implementation" means the copyrightable works distributed by

44 +

Google as part of the Go project.

45 + 46 +

Google hereby grants to You a perpetual, worldwide, non-exclusive,

47 +

no-charge, royalty-free, irrevocable (except as stated in this section)

48 +

patent license to make, have made, use, offer to sell, sell, import,

49 +

transfer and otherwise run, modify and propagate the contents of this

50 +

implementation of Go, where such license applies only to those patent

51 +

claims, both currently owned or controlled by Google and acquired in

52 +

the future, licensable by Google that are necessarily infringed by this

53 +

implementation of Go. This grant does not include claims that would be

54 +

infringed only as a consequence of further modification of this

55 +

implementation. If you or your agent or exclusive licensee institute or

56 +

order or agree to the institution of patent litigation against any

57 +

entity (including a cross-claim or counterclaim in a lawsuit) alleging

58 +

that this implementation of Go or any code incorporated within this

59 +

implementation of Go constitutes direct or contributory patent

60 +

infringement, or inducement of patent infringement, then any patent

61 +

rights granted to you under this License for this implementation of Go

62 +

shall terminate as of the date such litigation is filed.

63 +

notices: []

Original file line number Diff line number Diff line change

@@ -0,0 +1,62 @@

1 +

---

2 +

name: golang.org/x/exp/slices

3 +

version: v0.0.0-20230321023759-10a507213a29

4 +

type: go

5 +

summary: Package slices defines various functions useful with slices of any type.

6 +

homepage: https://pkg.go.dev/golang.org/x/exp/slices

7 +

license: other

8 +

licenses:

9 +

- sources: exp@v0.0.0-20230321023759-10a507213a29/LICENSE

10 +

text: |

11 +

Copyright (c) 2009 The Go Authors. All rights reserved.

12 + 13 +

Redistribution and use in source and binary forms, with or without

14 +

modification, are permitted provided that the following conditions are

15 +

met:

16 + 17 +

* Redistributions of source code must retain the above copyright

18 +

notice, this list of conditions and the following disclaimer.

19 +

* Redistributions in binary form must reproduce the above

20 +

copyright notice, this list of conditions and the following disclaimer

21 +

in the documentation and/or other materials provided with the

22 +

distribution.

23 +

* Neither the name of Google Inc. nor the names of its

24 +

contributors may be used to endorse or promote products derived from

25 +

this software without specific prior written permission.

26 + 27 +

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

28 +

"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

29 +

LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

30 +

A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT

31 +

OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

32 +

SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

33 +

LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

34 +

DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY

35 +

THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

36 +

(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

37 +

OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

38 +

- sources: exp@v0.0.0-20230321023759-10a507213a29/PATENTS

39 +

text: |

40 +

Additional IP Rights Grant (Patents)

41 + 42 +

"This implementation" means the copyrightable works distributed by

43 +

Google as part of the Go project.

44 + 45 +

Google hereby grants to You a perpetual, worldwide, non-exclusive,

46 +

no-charge, royalty-free, irrevocable (except as stated in this section)

47 +

patent license to make, have made, use, offer to sell, sell, import,

48 +

transfer and otherwise run, modify and propagate the contents of this

49 +

implementation of Go, where such license applies only to those patent

50 +

claims, both currently owned or controlled by Google and acquired in

51 +

the future, licensable by Google that are necessarily infringed by this

52 +

implementation of Go. This grant does not include claims that would be

53 +

infringed only as a consequence of further modification of this

54 +

implementation. If you or your agent or exclusive licensee institute or

55 +

order or agree to the institution of patent litigation against any

56 +

entity (including a cross-claim or counterclaim in a lawsuit) alleging

57 +

that this implementation of Go or any code incorporated within this

58 +

implementation of Go constitutes direct or contributory patent

59 +

infringement, or inducement of patent infringement, then any patent

60 +

rights granted to you under this License for this implementation of Go

61 +

shall terminate as of the date such litigation is filed.

62 +

notices: []

Original file line number Diff line number Diff line change

@@ -0,0 +1,80 @@

1 +

---

2 +

name: gopkg.in/yaml.v3

3 +

version: v3.0.1

4 +

type: go

5 +

summary: Package yaml implements YAML support for the Go language.

6 +

homepage: https://pkg.go.dev/gopkg.in/yaml.v3

7 +

license: other

8 +

licenses:

9 +

- sources: LICENSE

10 +

text: |2

11 + 12 +

This project is covered by two different licenses: MIT and Apache.

13 + 14 +

#### MIT License ####

15 + 16 +

The following files were ported to Go from C files of libyaml, and thus

17 +

are still covered by their original MIT license, with the additional

18 +

copyright staring in 2011 when the project was ported over:

19 + 20 +

apic.go emitterc.go parserc.go readerc.go scannerc.go

21 +

writerc.go yamlh.go yamlprivateh.go

22 + 23 +

Copyright (c) 2006-2010 Kirill Simonov

24 +

Copyright (c) 2006-2011 Kirill Simonov

25 + 26 +

Permission is hereby granted, free of charge, to any person obtaining a copy of

27 +

this software and associated documentation files (the "Software"), to deal in

28 +

the Software without restriction, including without limitation the rights to

29 +

use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies

30 +

of the Software, and to permit persons to whom the Software is furnished to do

31 +

so, subject to the following conditions:

32 + 33 +

The above copyright notice and this permission notice shall be included in all

34 +

copies or substantial portions of the Software.

35 + 36 +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

37 +

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

38 +

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

39 +

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

40 +

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

41 +

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

42 +

SOFTWARE.

43 + 44 +

### Apache License ###

45 + 46 +

All the remaining project files are covered by the Apache license:

47 + 48 +

Copyright (c) 2011-2019 Canonical Ltd

49 + 50 +

Licensed under the Apache License, Version 2.0 (the "License");

51 +

you may not use this file except in compliance with the License.

52 +

You may obtain a copy of the License at

53 + 54 +

http://www.apache.org/licenses/LICENSE-2.0

55 + 56 +

Unless required by applicable law or agreed to in writing, software

57 +

distributed under the License is distributed on an "AS IS" BASIS,

58 +

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

59 +

See the License for the specific language governing permissions and

60 +

limitations under the License.

61 +

- sources: README.md

62 +

text: |-

63 +

The yaml package is licensed under the MIT and Apache License 2.0 licenses.

64 +

Please see the LICENSE file for details.

65 +

notices:

66 +

- sources: NOTICE

67 +

text: |-

68 +

Copyright 2011-2016 Canonical Ltd.

69 + 70 +

Licensed under the Apache License, Version 2.0 (the "License");

71 +

you may not use this file except in compliance with the License.

72 +

You may obtain a copy of the License at

73 + 74 +

http://www.apache.org/licenses/LICENSE-2.0

75 + 76 +

Unless required by applicable law or agreed to in writing, software

77 +

distributed under the License is distributed on an "AS IS" BASIS,

78 +

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

79 +

See the License for the specific language governing permissions and

80 +

limitations under the License.

Original file line number Diff line number Diff line change

@@ -0,0 +1,108 @@

1 +

/*

2 +

arduino-fwuploader

3 +

Copyright (c) 2023 Arduino LLC. All right reserved.

4 + 5 +

This program is free software: you can redistribute it and/or modify

6 +

it under the terms of the GNU Affero General Public License as published

7 +

by the Free Software Foundation, either version 3 of the License, or

8 +

(at your option) any later version.

9 + 10 +

This program is distributed in the hope that it will be useful,

11 +

but WITHOUT ANY WARRANTY; without even the implied warranty of

12 +

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

13 +

GNU Affero General Public License for more details.

14 + 15 +

You should have received a copy of the GNU Affero General Public License

16 +

along with this program. If not, see <https://www.gnu.org/licenses/>.

17 +

*/

18 + 19 +

package certificates

20 + 21 +

import (

22 +

"crypto/tls"

23 +

"crypto/x509"

24 +

"encoding/pem"

25 +

"fmt"

26 + 27 +

"github.com/arduino/go-paths-helper"

28 +

"github.com/sirupsen/logrus"

29 +

)

30 + 31 +

// ScrapeRootCertificatesFromURL downloads from a webserver the root certificate

32 +

// required to connect to that server from the TLS handshake response.

33 +

func ScrapeRootCertificatesFromURL(URL string) (*x509.Certificate, error) {

34 +

conn, err := tls.Dial("tcp", URL, &tls.Config{

35 +

InsecureSkipVerify: true,

36 +

})

37 +

if err != nil {

38 +

logrus.Error(err)

39 +

return nil, err

40 +

}

41 +

defer conn.Close()

42 + 43 +

if err := conn.Handshake(); err != nil {

44 +

logrus.Error(err)

45 +

return nil, err

46 +

}

47 + 48 +

peerCertificates := conn.ConnectionState().PeerCertificates

49 +

if len(peerCertificates) == 0 {

50 +

err = fmt.Errorf("no peer certificates found at %s", URL)

51 +

logrus.Error(err)

52 +

return nil, err

53 +

}

54 + 55 +

rootCertificate := peerCertificates[len(peerCertificates)-1]

56 +

return rootCertificate, nil

57 +

}

58 + 59 +

// LoadCertificatesFromFile read certificates from the given file. PEM and CER formats

60 +

// are supported.

61 +

func LoadCertificatesFromFile(certificateFile *paths.Path) ([]*x509.Certificate, error) {

62 +

data, err := certificateFile.ReadFile()

63 +

if err != nil {

64 +

logrus.Error(err)

65 +

return nil, err

66 +

}

67 +

var res []*x509.Certificate

68 +

switch certificateFile.Ext() {

69 +

case ".cer":

70 +

cert, err := x509.ParseCertificate(data)

71 +

if err != nil {

72 +

logrus.Error(err)

73 +

}

74 +

res = append(res, cert)

75 +

return res, err

76 + 77 +

case ".pem":

78 +

for {

79 +

block, rest := pem.Decode(data)

80 +

data = rest

81 +

if block == nil && len(rest) > 0 {

82 +

return nil, fmt.Errorf("invalid .pem data")

83 +

}

84 +

if block == nil {

85 +

return res, nil

86 +

}

87 +

cert, err := x509.ParseCertificate(block.Bytes)

88 +

if err != nil {

89 +

return nil, fmt.Errorf("failed to parse certificate: %w", err)

90 +

}

91 +

res = append(res, cert)

92 +

if len(rest) == 0 {

93 +

return res, nil

94 +

}

95 +

}

96 +

default:

97 +

return nil, fmt.Errorf("cert format %s not supported, please use .pem or .cer", certificateFile.Ext())

98 +

}

99 +

}

100 + 101 +

// EncodeCertificateAsPEM returns the PEM encoding of the given certificate

102 +

func EncodeCertificateAsPEM(cert *x509.Certificate) []byte {

103 +

pemBlock := &pem.Block{

104 +

Type: "CERTIFICATE",

105 +

Bytes: cert.Raw,

106 +

}

107 +

return pem.EncodeToMemory(pemBlock)

108 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4