This is an automated email from the git hooks/post-receive script.
itchyonion pushed a change to branch main in repository pluggable-transports/snowflake.
from b443e99 Bring client torrc up to date with Tor Browser fc89e8b1. new a6a18c1 Parse ICE servers with pion/ice library function new 66269c0 Update README to correctly reflec the type of ICE servers we currently support new 990fcb4 Filter out non stun: server addresses in ParseIceServers
The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: client/README.md | 2 +- client/lib/lib_test.go | 16 ++++++---------- client/lib/snowflake.go | 28 +++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 14 deletions(-)
This is an automated email from the git hooks/post-receive script.
itchyonion pushed a commit to branch main in repository pluggable-transports/snowflake.
commit a6a18c1a9b004bda644b0b790ca756af0c6b1e51 Author: itchyonion itchyonion@torproject.org AuthorDate: Tue Dec 6 15:52:59 2022 -0800
Parse ICE servers with pion/ice library function --- client/lib/lib_test.go | 13 +++++++++---- client/lib/snowflake.go | 11 ++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/client/lib/lib_test.go b/client/lib/lib_test.go index e1b6427..93fe0ad 100644 --- a/client/lib/lib_test.go +++ b/client/lib/lib_test.go @@ -195,15 +195,20 @@ func TestICEServerParser(t *testing.T) { 1, }, { - []string{"stun:stun.l.google.com:19302", "stun.ekiga.net"}, - [][]string{[]string{"stun:stun.l.google.com:19302"}, []string{"stun.ekiga.net"}}, + []string{"stun:stun.l.google.com", "stuns:stun.ekiga.net"}, + [][]string{[]string{"stun:stun.l.google.com:3478"}, []string{"stuns:stun.ekiga.net:5349"}}, 2, }, { - []string{"stun:stun.l.google.com:19302", "stun.ekiga.net"}, - [][]string{[]string{"stun:stun.l.google.com:19302"}, []string{"stun.ekiga.net"}}, + []string{"stuns:stun.l.google.com:19302", "turn:relay.metered.ca:80"}, + [][]string{[]string{"stuns:stun.l.google.com:19302"}, []string{"turn:relay.metered.ca:80?transport=udp"}}, 2, }, + { + []string{"stun:stun1.l.google.com:19302", "stun.ekiga.net", "stun:stun.example.com:1234/path?query", "https://example.com%22%7D, + [][]string{[]string{"stun:stun1.l.google.com:19302"}}, + 1, + }, } { servers := parseIceServers(test.input)
diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go index c587e6d..5d19c55 100644 --- a/client/lib/snowflake.go +++ b/client/lib/snowflake.go @@ -37,6 +37,7 @@ import ( "git.torproject.org/pluggable-transports/snowflake.git/v2/common/event" "git.torproject.org/pluggable-transports/snowflake.git/v2/common/nat" "git.torproject.org/pluggable-transports/snowflake.git/v2/common/turbotunnel" + "github.com/pion/ice/v2" "github.com/pion/webrtc/v3" "github.com/xtaci/kcp-go/v5" "github.com/xtaci/smux" @@ -269,8 +270,16 @@ func parseIceServers(addresses []string) []webrtc.ICEServer { } for _, url := range addresses { url = strings.TrimSpace(url) + + // add default port, other sanity checks + parsedURL, err := ice.ParseURL(url) + if err != nil { + log.Printf("Warning: Parsing ICE server %v resulted in error: %v, skipping", url, err) + continue + } + servers = append(servers, webrtc.ICEServer{ - URLs: []string{url}, + URLs: []string{parsedURL.String()}, }) } return servers
This is an automated email from the git hooks/post-receive script.
itchyonion pushed a commit to branch main in repository pluggable-transports/snowflake.
commit 66269c07d8a3968cd468797f9bb278b6bac65aba Author: itchyonion itchyonion@torproject.org AuthorDate: Tue Dec 20 06:42:07 2022 -0800
Update README to correctly reflec the type of ICE servers we currently support --- client/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/README.md b/client/README.md index 3e68090..3cfcbaa 100644 --- a/client/README.md +++ b/client/README.md @@ -45,7 +45,7 @@ Bridge snowflake 192.0.2.3:1
`-front` is an optional front domain for the broker request.
-`-ice` is a comma-separated list of ICE servers. These can be STUN or TURN servers. We recommend using servers that have implemented NAT discovery. See our wiki page on [NAT traversal](https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowf...) for more information. +`-ice` is a comma-separated list of ICE servers. These must be STUN (over UDP) servers with the form stun:<var>host</var>[:<var>port</var>]. We recommend using servers that have implemented NAT discovery. See our wiki page on [NAT traversal](https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowf...) for more information.
To bootstrap Tor, run: ```
This is an automated email from the git hooks/post-receive script.
itchyonion pushed a commit to branch main in repository pluggable-transports/snowflake.
commit 990fcb41274f8d983c23b035636a22e4491290d8 Author: itchyonion itchyonion@torproject.org AuthorDate: Wed Jan 4 15:25:52 2023 -0800
Filter out non stun: server addresses in ParseIceServers --- client/lib/lib_test.go | 17 ++++------------- client/lib/snowflake.go | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/client/lib/lib_test.go b/client/lib/lib_test.go index 93fe0ad..d53482c 100644 --- a/client/lib/lib_test.go +++ b/client/lib/lib_test.go @@ -190,22 +190,13 @@ func TestICEServerParser(t *testing.T) { length int }{ { - []string{"stun:stun.l.google.com:19302"}, - [][]string{[]string{"stun:stun.l.google.com:19302"}}, - 1, - }, - { - []string{"stun:stun.l.google.com", "stuns:stun.ekiga.net"}, - [][]string{[]string{"stun:stun.l.google.com:3478"}, []string{"stuns:stun.ekiga.net:5349"}}, - 2, - }, - { - []string{"stuns:stun.l.google.com:19302", "turn:relay.metered.ca:80"}, - [][]string{[]string{"stuns:stun.l.google.com:19302"}, []string{"turn:relay.metered.ca:80?transport=udp"}}, + []string{"stun:stun.l.google.com:19302", "stun:stun.ekiga.net"}, + [][]string{[]string{"stun:stun.l.google.com:19302"}, []string{"stun:stun.ekiga.net:3478"}}, 2, }, { - []string{"stun:stun1.l.google.com:19302", "stun.ekiga.net", "stun:stun.example.com:1234/path?query", "https://example.com%22%7D, + []string{"stun:stun1.l.google.com:19302", "stun.ekiga.net", "stun:stun.example.com:1234/path?query", + "https://example.com", "turn:relay.metered.ca:80?transport=udp"}, [][]string{[]string{"stun:stun1.l.google.com:19302"}}, 1, }, diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go index 5d19c55..cc0005c 100644 --- a/client/lib/snowflake.go +++ b/client/lib/snowflake.go @@ -31,6 +31,7 @@ import ( "log" "math/rand" "net" + "net/url" "strings" "time"
@@ -268,13 +269,25 @@ func parseIceServers(addresses []string) []webrtc.ICEServer { if len(addresses) == 0 { return nil } - for _, url := range addresses { - url = strings.TrimSpace(url) + for _, address := range addresses { + address = strings.TrimSpace(address) + + // ice.ParseURL recognizes many types of ICE servers, + // but we only support stun over UDP currently + u, err := url.Parse(address) + if err != nil { + log.Printf("Warning: Parsing ICE server %v resulted in error: %v, skipping", address, err) + continue + } + if u.Scheme != "stun" { + log.Printf("Warning: Only stun: (STUN over UDP) servers are supported currently, skipping %v", address) + continue + }
// add default port, other sanity checks - parsedURL, err := ice.ParseURL(url) + parsedURL, err := ice.ParseURL(address) if err != nil { - log.Printf("Warning: Parsing ICE server %v resulted in error: %v, skipping", url, err) + log.Printf("Warning: Parsing ICE server %v resulted in error: %v, skipping", address, err) continue }
tor-commits@lists.torproject.org