From ab3e9f2f897f7586f1c658c77d3fd32e2e803f35 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 18 Apr 2023 13:10:26 +0200 Subject: [PATCH] Make package REUSE compliant --- .github/.ci.conf | 4 +- .reuse/dep5 | 6 +- LICENSE | 1 + LICENSES/BSD-3-Clause.txt | 11 ++ LICENSES/CC0-1.0.txt | 121 +++++++++++++ LICENSE.md => LICENSES/MIT.txt | 4 +- Makefile | 3 + addr.go | 3 + addr_test.go | 3 + agent.go | 3 + agent_test.go | 3 + api/check.sh | 4 + appveyor.yml | 22 --- attributes.go | 3 + attributes_debug.go | 3 + attributes_debug_test.go | 3 + attributes_test.go | 3 + checks.go | 3 + checks_debug.go | 3 + client.go | 3 + client_test.go | 3 + cmd/stun-bench/main.go | 3 + cmd/stun-client/stun_client.go | 3 + cmd/stun-decode/main.go | 3 + cmd/stun-multiplex/main.go | 3 + cmd/stun-nat-behaviour/main.go | 5 +- cmd/stun-traversal/{Readme.md => README.md} | 0 cmd/stun-traversal/main.go | 3 + e2e/capture.sh | 4 + e2e/client.Dockerfile | 3 + e2e/docker-compose.yml | 3 + e2e/main.go | 3 + e2e/server.Dockerfile | 3 + e2e/tcpdump.Dockerfile | 3 + e2e/test.sh | 3 + e2e/turnserver.conf | 191 +------------------- errorcode.go | 3 + errorcode_test.go | 3 + errors.go | 3 + errors_test.go | 3 + fingerprint.go | 3 + fingerprint_debug.go | 3 + fingerprint_test.go | 3 + fuzz_test.go | 3 + go.test.sh | 21 --- helpers.go | 3 + helpers_test.go | 3 + iana_test.go | 4 + integrity.go | 3 + integrity_debug.go | 3 + integrity_test.go | 3 + internal/hmac/hmac.go | 5 +- internal/hmac/hmac_test.go | 5 +- internal/hmac/pool.go | 3 + internal/hmac/pool_test.go | 3 + internal/hmac/vendor.sh | 7 +- internal/testutil/allocs.go | 3 + internal/testutil/norace.go | 3 + internal/testutil/race.go | 4 + message.go | 3 + message_test.go | 5 +- rfc5769_test.go | 3 + stun.go | 3 + stun_test.go | 3 + stuntest/udp_server.go | 3 + testdata/ex1_chrome.stun.license | 2 + testdata/frombrowsers.csv | 2 + testdata/stun-parameters-2.csv | 2 + testdata/stun-parameters-4.csv | 2 + testdata/stun-parameters-6.csv | 2 + textattrs.go | 3 + textattrs_test.go | 3 + uattrs.go | 3 + uattrs_test.go | 3 + uri.go | 3 + uri_test.go | 3 + xoraddr.go | 3 + xoraddr_test.go | 3 + 78 files changed, 355 insertions(+), 241 deletions(-) create mode 120000 LICENSE create mode 100644 LICENSES/BSD-3-Clause.txt create mode 100644 LICENSES/CC0-1.0.txt rename LICENSE.md => LICENSES/MIT.txt (94%) delete mode 100644 appveyor.yml rename cmd/stun-traversal/{Readme.md => README.md} (100%) delete mode 100755 go.test.sh create mode 100644 testdata/ex1_chrome.stun.license diff --git a/.github/.ci.conf b/.github/.ci.conf index 8032945..3c221be 100755 --- a/.github/.ci.conf +++ b/.github/.ci.conf @@ -1,7 +1,9 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + TEST_BENCH_OPTION= TEST_HOOK=_test_hook EXCLUDED_CONTRIBUTORS=('fossabot' 'John Bradley') -DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES="cmd example" function _test_hook(){ set -e diff --git a/.reuse/dep5 b/.reuse/dep5 index ccc710a..dee338c 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -2,6 +2,10 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Pion Source: https://github.com/pion/ -Files: README.md AUTHORS.txt renovate.json +Files: README.md **/README.md AUTHORS.txt renovate.json go.mod go.sum Copyright: 2023 The Pion community License: MIT + +Files: testdata/fuzz/* api/*.txt +Copyright: 2023 The Pion community +License: CC0-1.0 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 120000 index 0000000..31ff787 --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +LICENSES/MIT.txt \ No newline at end of file diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 0000000..ea890af --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,11 @@ +Copyright (c) . + +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. + +3. Neither the name of the copyright holder 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 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. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSE.md b/LICENSES/MIT.txt similarity index 94% rename from LICENSE.md rename to LICENSES/MIT.txt index 5cc9cbd..2071b23 100644 --- a/LICENSE.md +++ b/LICENSES/MIT.txt @@ -1,4 +1,6 @@ -Copyright 2018 Pion LLC +MIT License + +Copyright (c) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/Makefile b/Makefile index 3e93f27..ebfcd33 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + VERSION := $(shell git describe --tags | sed -e 's/^v//g' | awk -F "-" '{print $$1}') ITERATION := $(shell git describe --tags --long | awk -F "-" '{print $$2}') GO_VERSION=$(shell gobuild -v) diff --git a/addr.go b/addr.go index 6aedb09..d15e2bb 100644 --- a/addr.go +++ b/addr.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/addr_test.go b/addr_test.go index 69a1106..3984b5d 100644 --- a/addr_test.go +++ b/addr_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/agent.go b/agent.go index 66c7ba3..f03efa3 100644 --- a/agent.go +++ b/agent.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/agent_test.go b/agent_test.go index d77c8ec..b473945 100644 --- a/agent_test.go +++ b/agent_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/api/check.sh b/api/check.sh index 19852b7..8c560a0 100755 --- a/api/check.sh +++ b/api/check.sh @@ -1,2 +1,6 @@ #!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + api -c $(ls -dm stun*.txt | tr -d ' \n') -except except.txt github.com/pion/stun diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 664099d..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "{build}" - -platform: x64 - -branches: - only: - - master - -skip_tags: true - -clone_folder: c:\gopath\src\github.com\pion\stun - -environment: - GOPATH: c:\gopath - GOVERSION: 1.12 - -install: - - go version - - go get -v -t . - -build_script: - - go test -v . diff --git a/attributes.go b/attributes.go index 4513003..8a1aa21 100644 --- a/attributes.go +++ b/attributes.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/attributes_debug.go b/attributes_debug.go index d7bb703..836d79f 100644 --- a/attributes_debug.go +++ b/attributes_debug.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build debug // +build debug diff --git a/attributes_debug_test.go b/attributes_debug_test.go index e7c3306..e2c537a 100644 --- a/attributes_debug_test.go +++ b/attributes_debug_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build debug // +build debug diff --git a/attributes_test.go b/attributes_test.go index 33ba5d2..c4255b2 100644 --- a/attributes_test.go +++ b/attributes_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/checks.go b/checks.go index 0acea02..6b678a0 100644 --- a/checks.go +++ b/checks.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !debug // +build !debug diff --git a/checks_debug.go b/checks_debug.go index 543ddcb..0b5c67c 100644 --- a/checks_debug.go +++ b/checks_debug.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build debug // +build debug diff --git a/client.go b/client.go index cb6ac13..153b512 100644 --- a/client.go +++ b/client.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/client_test.go b/client_test.go index 9cc2c9a..a0ba640 100644 --- a/client_test.go +++ b/client_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js diff --git a/cmd/stun-bench/main.go b/cmd/stun-bench/main.go index b472b22..bb1def6 100644 --- a/cmd/stun-bench/main.go +++ b/cmd/stun-bench/main.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package main implements benchmarks for the STUN package package main diff --git a/cmd/stun-client/stun_client.go b/cmd/stun-client/stun_client.go index 008f682..86c1e38 100644 --- a/cmd/stun-client/stun_client.go +++ b/cmd/stun-client/stun_client.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package main implements a CLI tool which acts as a STUN client package main diff --git a/cmd/stun-decode/main.go b/cmd/stun-decode/main.go index 8281ef3..787b0f5 100644 --- a/cmd/stun-decode/main.go +++ b/cmd/stun-decode/main.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package main implements a simple CLI tool to decode STUN messages package main diff --git a/cmd/stun-multiplex/main.go b/cmd/stun-multiplex/main.go index 2789168..1949379 100644 --- a/cmd/stun-multiplex/main.go +++ b/cmd/stun-multiplex/main.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Command stun-multiplex is example of doing UDP connection multiplexing // that splits incoming UDP packets to two streams, "STUN Data" and // "Application Data". diff --git a/cmd/stun-nat-behaviour/main.go b/cmd/stun-nat-behaviour/main.go index c7721bd..72026f0 100644 --- a/cmd/stun-nat-behaviour/main.go +++ b/cmd/stun-nat-behaviour/main.go @@ -1,4 +1,7 @@ -// This cmd implements RFC5780's tests: +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + +// This package implements RFC5780's tests: // - 4.3. Determining NAT Mapping Behavior // - 4.4. Determining NAT Filtering Behavior package main diff --git a/cmd/stun-traversal/Readme.md b/cmd/stun-traversal/README.md similarity index 100% rename from cmd/stun-traversal/Readme.md rename to cmd/stun-traversal/README.md diff --git a/cmd/stun-traversal/main.go b/cmd/stun-traversal/main.go index d44e3f1..222f14e 100644 --- a/cmd/stun-traversal/main.go +++ b/cmd/stun-traversal/main.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package main implements a simple CLI tools to perform NAT traversal via STUN package main diff --git a/e2e/capture.sh b/e2e/capture.sh index 7c9cb68..d340348 100644 --- a/e2e/capture.sh +++ b/e2e/capture.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + echo "net: $INTERFACE $SUBNET" tcpdump -U -v -i $INTERFACE \ src net $SUBNET and dst net $SUBNET \ diff --git a/e2e/client.Dockerfile b/e2e/client.Dockerfile index f800e7c..cbd18af 100644 --- a/e2e/client.Dockerfile +++ b/e2e/client.Dockerfile @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + ARG CI_GO_VERSION FROM golang:${CI_GO_VERSION} diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index 1d86ab7..343204a 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + version: '3' services: diff --git a/e2e/main.go b/e2e/main.go index bd32f6f..155b14d 100644 --- a/e2e/main.go +++ b/e2e/main.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package main implement end-to-end tests package main diff --git a/e2e/server.Dockerfile b/e2e/server.Dockerfile index febc790..b13dbfe 100644 --- a/e2e/server.Dockerfile +++ b/e2e/server.Dockerfile @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + FROM ubuntu:latest RUN apt-get update diff --git a/e2e/tcpdump.Dockerfile b/e2e/tcpdump.Dockerfile index cb577dd..57fa15f 100644 --- a/e2e/tcpdump.Dockerfile +++ b/e2e/tcpdump.Dockerfile @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + FROM ubuntu RUN apt-get update && apt-get install -y tcpdump RUN apt-get install net-tools -y diff --git a/e2e/test.sh b/e2e/test.sh index e54ce76..ff23725 100755 --- a/e2e/test.sh +++ b/e2e/test.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + export CURRENT_GO_VERSION=$(echo -n "$(go version)" | grep -o 'go1\.[0-9|\.]*' || true) CURRENT_GO_VERSION=${CURRENT_GO_VERSION#go} GO_VERSION=${GO_VERSION:-$CURRENT_GO_VERSION} diff --git a/e2e/turnserver.conf b/e2e/turnserver.conf index d8ffdd9..3b9c2e3 100644 --- a/e2e/turnserver.conf +++ b/e2e/turnserver.conf @@ -1,200 +1,21 @@ -# Coturn TURN SERVER configuration file +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT Verbose fingerprint -# Uncomment to use long-term credential mechanism. -# By default no credentials mechanism is used (any user allowed). -# +log-file=stdout + lt-cred-mech -# This option is opposite to lt-cred-mech. -# (TURN Server with no-auth option allows anonymous access). -# If neither option is defined, and no users are defined, -# then no-auth is default. If at least one user is defined, -# in this file or in command line or in usersdb file, then -# lt-cred-mech is default. -# -#no-auth - -# 'Static' user accounts for long term credentials mechanism, only. -# This option cannot be used with TURN REST API. -# 'Static' user accounts are NOT dynamically checked by the turnserver process, -# so that they can NOT be changed while the turnserver is running. -# -#user=username1:key1 -#user=username2:key2 -# OR: -#user=username1:password1 -#user=username2:password2 -# -# Keys must be generated by turnadmin utility. The key value depends -# on user name, realm, and password: -# -# Example: -# $ turnadmin -k -u ninefingers -r north.gov -p youhavetoberealistic -# Output: 0xbc807ee29df3c9ffa736523fb2c4e8ee -# ('0x' in the beginning of the key is what differentiates the key from -# password. If it has 0x then it is a key, otherwise it is a password). -# -# The corresponding user account entry in the config file will be: -# -#user=ninefingers:0xbc807ee29df3c9ffa736523fb2c4e8ee -# Or, equivalently, with open clear password (less secure): -#user=ninefingers:youhavetoberealistic -# - user=user:secret realm=realm -# Uncomment if no UDP client listener is desired. -# By default UDP client listener is always started. -# -#no-udp - -# Uncomment if no TCP client listener is desired. -# By default TCP client listener is always started. -# -# no-tcp - -# Uncomment if no TLS client listener is desired. -# By default TLS client listener is always started. -# +no-cli no-tls - -# Uncomment if no DTLS client listener is desired. -# By default DTLS client listener is always started. -# no-dtls - -# Uncomment if no UDP relay endpoints are allowed. -# By default UDP relay endpoints are enabled (like in RFC 5766). -# -#no-udp-relay - -# Uncomment if no TCP relay endpoints are allowed. -# By default TCP relay endpoints are enabled (like in RFC 6062). -# no-tcp-relay - -# Uncomment if extra security is desired, -# with nonce value having limited lifetime (600 secs). -# By default, the nonce value is unique for a session, -# but it has unlimited lifetime. With this option, -# the nonce lifetime is limited to 600 seconds, after that -# the client will get 438 error and will have to re-authenticate itself. -# -stale-nonce - -# Certificate file. -# Use an absolute path or path relative to the -# configuration file. -# -#cert=/usr/local/etc/turn_server_cert.pem - -# Private key file. -# Use an absolute path or path relative to the -# configuration file. -# Use PEM file format. -# -#pkey=/usr/local/etc/turn_server_pkey.pem - -# Private key file password, if it is in encoded format. -# This option has no default value. -# -#pkey-pwd=... - -# Allowed OpenSSL cipher list for TLS/DTLS connections. -# Default value is "DEFAULT". -# -#cipher-list="DEFAULT" - -# CA file in OpenSSL format. -# Forces TURN server to verify the client SSL certificates. -# By default it is not set: there is no default value and the client -# certificate is not checked. -# -# Example: -#CA-file=/etc/ssh/id_rsa.cert - -# Curve name for EC ciphers, if supported by OpenSSL -# library (TLS and DTLS). The default value is prime256v1, -# if pre-OpenSSL 1.0.2 is used. With OpenSSL 1.0.2+, -# an optimal curve will be automatically calculated, if not defined -# by this option. -# -#ec-curve-name=prime256v1 - -# Use 566 bits predefined DH TLS key. Default size of the key is 1066. -# -#dh566 - -# Use 2066 bits predefined DH TLS key. Default size of the key is 1066. -# -#dh2066 - -# Use custom DH TLS key, stored in PEM format in the file. -# Flags --dh566 and --dh2066 are ignored when the DH key is taken from a file. -# -#dh-file= - -# Flag to prevent stdout log messages. -# By default, all log messages are going to both stdout and to -# the configured log file. With this option everything will be -# going to the configured log only (unless the log file itself is stdout). -# -#no-stdout-log - -# Option to set the log file name. -# By default, the turnserver tries to open a log file in -# /var/log, /var/tmp, /tmp and current directories directories -# (which open operation succeeds first that file will be used). -# With this option you can set the definite log file name. -# The special names are "stdout" and "-" - they will force everything -# to the stdout. Also, the "syslog" name will force everything to -# the system log (syslog). -# In the runtime, the logfile can be reset with the SIGHUP signal -# to the turnserver process. -# -log-file=stdout - -# Option to redirect all log output into system log (syslog). -# -#syslog - -# Option to suppress TURN functionality, only STUN requests will be processed. -# Run as STUN server only, all TURN requests will be ignored. -# By default, this option is NOT set. -# stun-only - -# Option to suppress STUN functionality, only TURN requests will be processed. -# Run as TURN server only, all STUN requests will be ignored. -# By default, this option is NOT set. -# -#no-stun - -# Require authentication of the STUN Binding request. -# By default, the clients are allowed anonymous access to the STUN Binding functionality. -# secure-stun -# Mobility with ICE (MICE) specs support. -# -#mobility - -# User name to run the process. After the initialization, the turnserver process -# will make an attempt to change the current user ID to that user. -# -#proc-user= - -# Group name to run the process. After the initialization, the turnserver process -# will make an attempt to change the current group ID to that group. -# -#proc-group= - -# Turn OFF the CLI support. -# By default it is always ON. -# See also options cli-ip and cli-port. -# -no-cli +stale-nonce diff --git a/errorcode.go b/errorcode.go index f3a8db1..c852eed 100644 --- a/errorcode.go +++ b/errorcode.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/errorcode_test.go b/errorcode_test.go index 26e3a05..2d416df 100644 --- a/errorcode_test.go +++ b/errorcode_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js diff --git a/errors.go b/errors.go index cf4784c..d5f59ed 100644 --- a/errors.go +++ b/errors.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import "errors" diff --git a/errors_test.go b/errors_test.go index f21e4aa..1b5b462 100644 --- a/errors_test.go +++ b/errors_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/fingerprint.go b/fingerprint.go index e930c5a..b4126d2 100644 --- a/fingerprint.go +++ b/fingerprint.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/fingerprint_debug.go b/fingerprint_debug.go index 968bee8..0e3471d 100644 --- a/fingerprint_debug.go +++ b/fingerprint_debug.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build debug // +build debug diff --git a/fingerprint_test.go b/fingerprint_test.go index 68a7f42..f9c1831 100644 --- a/fingerprint_test.go +++ b/fingerprint_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js diff --git a/fuzz_test.go b/fuzz_test.go index ac566a3..93266d5 100644 --- a/fuzz_test.go +++ b/fuzz_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/go.test.sh b/go.test.sh deleted file mode 100755 index 9852d4f..0000000 --- a/go.test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e -touch coverage.txt - -# quick-test without -race -go test ./... - -# test with "debug" tag -go test -tags debug ./... - -# test concurrency -go test -race -cpu=1,2,4 -run TestClient_DoConcurrent - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [[ -f profile.out ]]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/helpers.go b/helpers.go index 145c96a..d405650 100644 --- a/helpers.go +++ b/helpers.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun // Interfaces that are implemented by message attributes, shorthands for them, diff --git a/helpers_test.go b/helpers_test.go index b33b43b..4ada926 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/iana_test.go b/iana_test.go index e5c3a5f..6b30dd6 100644 --- a/iana_test.go +++ b/iana_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js @@ -15,6 +18,7 @@ func loadCSV(t testing.TB, name string) [][]string { t.Helper() data := loadData(t, name) r := csv.NewReader(bytes.NewReader(data)) + r.Comment = '#' records, err := r.ReadAll() if err != nil { t.Fatal(err) diff --git a/integrity.go b/integrity.go index 1040a00..0fee0b0 100644 --- a/integrity.go +++ b/integrity.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( //nolint:gci diff --git a/integrity_debug.go b/integrity_debug.go index 0ea511f..27fd0e2 100644 --- a/integrity_debug.go +++ b/integrity_debug.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build debug // +build debug diff --git a/integrity_test.go b/integrity_test.go index 549f453..11e421c 100644 --- a/integrity_test.go +++ b/integrity_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/internal/hmac/hmac.go b/internal/hmac/hmac.go index 6b2cb5e..b4db5c9 100644 --- a/internal/hmac/hmac.go +++ b/internal/hmac/hmac.go @@ -1,6 +1,5 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// SPDX-FileCopyrightText: 2009 The Go Authors. All rights reserved. +// SPDX-License-Identifier: BSD-3-Clause /* Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as diff --git a/internal/hmac/hmac_test.go b/internal/hmac/hmac_test.go index f49da1e..a867f9a 100644 --- a/internal/hmac/hmac_test.go +++ b/internal/hmac/hmac_test.go @@ -1,6 +1,5 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// SPDX-FileCopyrightText: 2009 The Go Authors. All rights reserved. +// SPDX-License-Identifier: BSD-3-Clause package hmac diff --git a/internal/hmac/pool.go b/internal/hmac/pool.go index 762bf32..d2ac14a 100644 --- a/internal/hmac/pool.go +++ b/internal/hmac/pool.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package hmac import ( //nolint:gci diff --git a/internal/hmac/pool_test.go b/internal/hmac/pool_test.go index 077ceb7..87b6f6e 100644 --- a/internal/hmac/pool_test.go +++ b/internal/hmac/pool_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package hmac import ( //nolint:gci diff --git a/internal/hmac/vendor.sh b/internal/hmac/vendor.sh index 83a2b32..190d2b9 100755 --- a/internal/hmac/vendor.sh +++ b/internal/hmac/vendor.sh @@ -1,4 +1,7 @@ -#!/bin/bash +#!/bin/env bash + +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: MIT + cp -v $GOROOT/src/crypto/hmac/{hmac,hmac_test}.go . git diff {hmac,hmac_test}.go - diff --git a/internal/testutil/allocs.go b/internal/testutil/allocs.go index 4358d8b..f0c42f3 100644 --- a/internal/testutil/allocs.go +++ b/internal/testutil/allocs.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package testutil contains helpers and utilities for writing tests package testutil diff --git a/internal/testutil/norace.go b/internal/testutil/norace.go index d55aa17..d0d8563 100644 --- a/internal/testutil/norace.go +++ b/internal/testutil/norace.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !race // +build !race diff --git a/internal/testutil/race.go b/internal/testutil/race.go index aa20097..2851e8e 100644 --- a/internal/testutil/race.go +++ b/internal/testutil/race.go @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + +//go:build race // +build race package testutil diff --git a/message.go b/message.go index 62ccd68..6a828d6 100644 --- a/message.go +++ b/message.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/message_test.go b/message_test.go index 353f3bf..70d92c0 100644 --- a/message_test.go +++ b/message_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js @@ -574,7 +577,7 @@ func TestExampleChrome(t *testing.T) { func TestMessageFromBrowsers(t *testing.T) { // file contains udp-packets captured from browsers (WebRTC) reader := csv.NewReader(bytes.NewReader(loadData(t, "frombrowsers.csv"))) - reader.Comma = ',' + reader.Comment = '#' _, err := reader.Read() // skipping header if err != nil { t.Fatal("failed to skip header of csv: ", err) diff --git a/rfc5769_test.go b/rfc5769_test.go index 1c5e7bc..e9b5b41 100644 --- a/rfc5769_test.go +++ b/rfc5769_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/stun.go b/stun.go index 7ac5944..3a7954f 100644 --- a/stun.go +++ b/stun.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package stun implements Session Traversal Utilities for NAT (STUN) RFC 5389. // // The stun package is intended to use by package that implements extension diff --git a/stun_test.go b/stun_test.go index f5c97a0..0348e5a 100644 --- a/stun_test.go +++ b/stun_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/stuntest/udp_server.go b/stuntest/udp_server.go index 3571ee1..1115d00 100644 --- a/stuntest/udp_server.go +++ b/stuntest/udp_server.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + // Package stuntest contains helpers for testing STUN clients package stuntest diff --git a/testdata/ex1_chrome.stun.license b/testdata/ex1_chrome.stun.license new file mode 100644 index 0000000..307c9ec --- /dev/null +++ b/testdata/ex1_chrome.stun.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2023 The Pion community +SPDX-License-Identifier: CC0-1.0 \ No newline at end of file diff --git a/testdata/frombrowsers.csv b/testdata/frombrowsers.csv index fdbd6e8..210021e 100644 --- a/testdata/frombrowsers.csv +++ b/testdata/frombrowsers.csv @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: CC0-1.0 ip,message,crc,browser,version,system 213.87.135.35:5127,AAEAACESpEJaU3lNekUycUIveEc=,14955568470663943731,Chrome,55.0.2883.91,Android 5.1.1 213.87.135.35:35359,AAEACCESpEL/qLJHuDKc5PsGghOAKAAEqgN+GQ==,10276095995276579762,Firefox,50.0,Mobile diff --git a/testdata/stun-parameters-2.csv b/testdata/stun-parameters-2.csv index e744a77..5a4b2ee 100644 --- a/testdata/stun-parameters-2.csv +++ b/testdata/stun-parameters-2.csv @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: CC0-1.0 Value,Name,Reference 0x000,Reserved,[RFC5389] 0x001,Binding,[RFC5389] diff --git a/testdata/stun-parameters-4.csv b/testdata/stun-parameters-4.csv index af580ee..b808032 100644 --- a/testdata/stun-parameters-4.csv +++ b/testdata/stun-parameters-4.csv @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: CC0-1.0 Value,Name,Reference 0x0000,Reserved,[RFC8489] 0x0001,MAPPED-ADDRESS,[RFC8489] diff --git a/testdata/stun-parameters-6.csv b/testdata/stun-parameters-6.csv index 0887aa6..c414b20 100644 --- a/testdata/stun-parameters-6.csv +++ b/testdata/stun-parameters-6.csv @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: 2023 The Pion community +# SPDX-License-Identifier: CC0-1.0 Value,Name,Reference 0-299,Reserved, 300,Try Alternate,[RFC5389] diff --git a/textattrs.go b/textattrs.go index efdfbd9..a98915a 100644 --- a/textattrs.go +++ b/textattrs.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun // NewUsername returns Username with provided value. diff --git a/textattrs_test.go b/textattrs_test.go index 0e2d20b..649aba9 100644 --- a/textattrs_test.go +++ b/textattrs_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js diff --git a/uattrs.go b/uattrs.go index 238d32d..8b85d8a 100644 --- a/uattrs.go +++ b/uattrs.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import "errors" diff --git a/uattrs_test.go b/uattrs_test.go index 65a8b3a..acf5df0 100644 --- a/uattrs_test.go +++ b/uattrs_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/uri.go b/uri.go index dae3ede..a1c7946 100644 --- a/uri.go +++ b/uri.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/uri_test.go b/uri_test.go index beb4232..f118efd 100644 --- a/uri_test.go +++ b/uri_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import "testing" diff --git a/xoraddr.go b/xoraddr.go index 767047f..fc423be 100644 --- a/xoraddr.go +++ b/xoraddr.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + package stun import ( diff --git a/xoraddr_test.go b/xoraddr_test.go index 9ac5b66..61506c4 100644 --- a/xoraddr_test.go +++ b/xoraddr_test.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 The Pion community +// SPDX-License-Identifier: MIT + //go:build !js // +build !js