Skip to content

Commit

Permalink
Revert commits that break public API
Browse files Browse the repository at this point in the history
Reverts 9f2193c^..30bbb28
  • Loading branch information
Sean-Der committed Nov 30, 2022
1 parent b6de406 commit 452b133
Show file tree
Hide file tree
Showing 45 changed files with 787 additions and 1,489 deletions.
23 changes: 13 additions & 10 deletions .github/generate-authors.sh
Expand Up @@ -12,10 +12,10 @@
set -e

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
GIT_WORKDIR=${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)}
AUTHORS_PATH="${GIT_WORKDIR}/AUTHORS.txt"
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"

if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
. ${SCRIPT_PATH}/.ci.conf
fi

Expand All @@ -31,7 +31,8 @@ EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion B
CONTRIBUTORS=()

shouldBeIncluded () {
for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
do
if [[ $1 =~ "$i" ]]; then
return 1
fi
Expand All @@ -41,23 +42,25 @@ shouldBeIncluded () {


IFS=$'\n' #Only split on newline
for CONTRIBUTOR in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf); do
if shouldBeIncluded ${CONTRIBUTOR}; then
CONTRIBUTORS+=("${CONTRIBUTOR}")
for contributor in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf)
do
if shouldBeIncluded $contributor; then
CONTRIBUTORS+=("$contributor")
fi
done
unset IFS

if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
cat >${AUTHORS_PATH} <<-'EOH'
cat >$AUTHORS_PATH <<-'EOH'
# Thank you to everyone that made Pion possible. If you are interested in contributing
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
#
# This file is auto generated, using git to list all individuals contributors.
# see `.github/generate-authors.sh` for the scripting
EOH
for i in "${CONTRIBUTORS[@]}"; do
echo "$i" >> ${AUTHORS_PATH}
for i in "${CONTRIBUTORS[@]}"
do
echo "$i" >> $AUTHORS_PATH
done
exit 0
fi
6 changes: 3 additions & 3 deletions .github/install-hooks.sh
Expand Up @@ -11,6 +11,6 @@

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"
cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg"
cp "$SCRIPT_PATH/hooks/pre-commit.sh" "$SCRIPT_PATH/../.git/hooks/pre-commit"
cp "$SCRIPT_PATH/hooks/pre-push.sh" "$SCRIPT_PATH/../.git/hooks/pre-push"
4 changes: 2 additions & 2 deletions .github/lint-commit-message.sh
Expand Up @@ -58,7 +58,7 @@ if [ "$#" -eq 1 ]; then
fi
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
else
for COMMIT in $(git rev-list --no-merges origin/master..); do
lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})"
for commit in $(git rev-list --no-merges origin/master..); do
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
done
fi
29 changes: 17 additions & 12 deletions .github/lint-disallowed-functions-in-library.sh
Expand Up @@ -13,31 +13,36 @@ set -e

# Disallow usages of functions that cause the program to exit in the library code
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
. ${SCRIPT_PATH}/.ci.conf
fi

EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"}
DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(')

FILES=$(
find "${SCRIPT_PATH}/.." -name "*.go" \
files=$(
find "$SCRIPT_PATH/.." -name "*.go" \
| grep -v -e '^.*_test.go$' \
| while read FILE; do
EXCLUDED=false
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then
EXCLUDED=true
| while read file
do
excluded=false
for ex in $EXCLUDE_DIRECTORIES
do
if [[ $file == */$ex/* ]]
then
excluded=true
break
fi
done
${EXCLUDED} || echo "${FILE}"
$excluded || echo "$file"
done
)

for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do
if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then
echo "${DISALLOWED_FUNCTION} may only be used in example code"
for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}"
do
if grep -e "\s$disallowedFunction" $files | grep -v -e 'nolint'; then
echo "$disallowedFunction may only be used in example code"
exit 1
fi
done
8 changes: 4 additions & 4 deletions .github/lint-filename.sh
Expand Up @@ -14,11 +14,11 @@ set -e
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$"

find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do
FILENAME=$(basename -- "${FULLPATH}")
find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
filename=$(basename -- "$fullpath")

if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then
echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported"
if ! [[ $filename =~ $GO_REGEX ]]; then
echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported"
exit 1
fi
done
24 changes: 14 additions & 10 deletions .github/lint-no-trailing-newline-in-log-messages.sh
Expand Up @@ -13,25 +13,29 @@ set -e

# Disallow usages of functions that cause the program to exit in the library code
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
. ${SCRIPT_PATH}/.ci.conf
fi

FILES=$(
find "${SCRIPT_PATH}/.." -name "*.go" \
| while read FILE; do
EXCLUDED=false
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then
EXCLUDED=true
files=$(
find "$SCRIPT_PATH/.." -name "*.go" \
| while read file
do
excluded=false
for ex in $EXCLUDE_DIRECTORIES
do
if [[ $file == */$ex/* ]]
then
excluded=true
break
fi
done
${EXCLUDED} || echo "${FILE}"
$excluded || echo "$file"
done
)

if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then
echo "Log format strings should have trailing new-line"
exit 1
fi
2 changes: 0 additions & 2 deletions AUTHORS.txt
Expand Up @@ -7,7 +7,6 @@ Adrian Cable <adrian.cable@gmail.com>
Atsushi Watanabe <atsushi.w@ieee.org>
backkem <mail@backkem.me>
Hugo Arregui <hugo.arregui@gmail.com>
Jeremiah Millay <jmillay@fastly.com>
Jozef Kralik <jojo.lwin@gmail.com>
Juliusz Chroboczek <jch@irif.fr>
Luke Curley <kixelated@gmail.com>
Expand All @@ -16,7 +15,6 @@ OrlandoCo <luisorlando.co@gmail.com>
Sean DuBois <duboisea@twitch.tv>
Sean DuBois <seaduboi@amazon.com>
Sean DuBois <sean@siobud.com>
Steffen Vogel <post@steffenvogel.de>
Winlin <winlin@vip.126.com>
Woodrow Douglass <wdouglass@carnegierobotics.com>
Yutaka Takeda <yt0916@gmail.com>
Expand Down
8 changes: 4 additions & 4 deletions connctx/connctx_test.go
Expand Up @@ -56,7 +56,7 @@ func TestReadTImeout(t *testing.T) {
b := make([]byte, 100)
n, err := c.ReadContext(ctx, b)
if err == nil {
t.Error("Read unexpectedly succeeded")
t.Error("Read unexpectedly successed")
}
if n != 0 {
t.Errorf("Wrong data length, expected %d, got %d", 0, n)
Expand All @@ -79,7 +79,7 @@ func TestReadCancel(t *testing.T) {
b := make([]byte, 100)
n, err := c.ReadContext(ctx, b)
if err == nil {
t.Error("Read unexpectedly succeeded")
t.Error("Read unexpectedly successed")
}
if n != 0 {
t.Errorf("Wrong data length, expected %d, got %d", 0, n)
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestWriteTimeout(t *testing.T) {
b := make([]byte, 100)
n, err := c.WriteContext(ctx, b)
if err == nil {
t.Error("Write unexpectedly succeeded")
t.Error("Write unexpectedly successed")
}
if n != 0 {
t.Errorf("Wrong data length, expected %d, got %d", 0, n)
Expand All @@ -174,7 +174,7 @@ func TestWriteCancel(t *testing.T) {
b := make([]byte, 100)
n, err := c.WriteContext(ctx, b)
if err == nil {
t.Error("Write unexpectedly succeeded")
t.Error("Write unexpectedly successed")
}
if n != 0 {
t.Errorf("Wrong data length, expected %d, got %d", 0, n)
Expand Down
8 changes: 1 addition & 7 deletions examples/vnet-udpproxy/main.go
@@ -1,5 +1,3 @@
// Package main implements an example for the virtual Net
// UDP proxy.
package main

import (
Expand Down Expand Up @@ -27,13 +25,9 @@ func main() {
}

// Create a network and add to router, for example, for client.
clientNetwork, err := vnet.NewNet(&vnet.NetConfig{
clientNetwork := vnet.NewNet(&vnet.NetConfig{
StaticIP: "10.0.0.11",
})
if err != nil {
panic(err)
}

if err = router.AddNet(clientNetwork); err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -6,7 +6,7 @@ retract v0.14.0

require (
github.com/pion/logging v0.2.2
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.7.1
golang.org/x/net v0.1.0
golang.org/x/sys v0.2.0
)
12 changes: 3 additions & 9 deletions go.sum
@@ -1,17 +1,12 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down Expand Up @@ -44,6 +39,5 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit 452b133

Please sign in to comment.