mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
multiple arbitrary ice servers can be passed as client flag (close #24)
This commit is contained in:
parent
4e6bba559a
commit
9daa6c4b71
3 changed files with 8 additions and 6 deletions
|
@ -64,7 +64,6 @@ func dialWebRTC() (*webRTCConn, error) {
|
||||||
// TODO: [#3] Fetch ICE server information from Broker.
|
// TODO: [#3] Fetch ICE server information from Broker.
|
||||||
// TODO: [#18] Consider TURN servers here too.
|
// TODO: [#18] Consider TURN servers here too.
|
||||||
config := webrtc.NewConfiguration(iceServers...)
|
config := webrtc.NewConfiguration(iceServers...)
|
||||||
|
|
||||||
broker := NewBrokerChannel(brokerURL, frontDomain)
|
broker := NewBrokerChannel(brokerURL, frontDomain)
|
||||||
if nil == broker {
|
if nil == broker {
|
||||||
return nil, errors.New("Failed to prepare BrokerChannel")
|
return nil, errors.New("Failed to prepare BrokerChannel")
|
||||||
|
@ -160,10 +159,6 @@ func readSignalingMessages(f *os.File) {
|
||||||
func main() {
|
func main() {
|
||||||
// var err error
|
// var err error
|
||||||
webrtc.SetLoggingVerbosity(1)
|
webrtc.SetLoggingVerbosity(1)
|
||||||
flag.StringVar(&brokerURL, "url", "", "URL of signaling broker")
|
|
||||||
flag.StringVar(&frontDomain, "front", "", "front domain")
|
|
||||||
flag.Var(&iceServers, "ice", "comma-separated list of ICE servers")
|
|
||||||
flag.Parse()
|
|
||||||
logFile, err := os.OpenFile("snowflake.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
logFile, err := os.OpenFile("snowflake.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -172,6 +167,11 @@ func main() {
|
||||||
log.SetOutput(logFile)
|
log.SetOutput(logFile)
|
||||||
log.Println("\nStarting Snowflake Client...")
|
log.Println("\nStarting Snowflake Client...")
|
||||||
|
|
||||||
|
flag.StringVar(&brokerURL, "url", "", "URL of signaling broker")
|
||||||
|
flag.StringVar(&frontDomain, "front", "", "front domain")
|
||||||
|
flag.Var(&iceServers, "ice", "comma-separated list of ICE servers")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
// Expect user to copy-paste if
|
// Expect user to copy-paste if
|
||||||
// TODO: Maybe just get rid of copy-paste entirely.
|
// TODO: Maybe just get rid of copy-paste entirely.
|
||||||
if "" != brokerURL {
|
if "" != brokerURL {
|
||||||
|
|
|
@ -4,6 +4,6 @@ DataDirectory datadir
|
||||||
ClientTransportPlugin snowflake exec ./client \
|
ClientTransportPlugin snowflake exec ./client \
|
||||||
-url https://snowflake-reg.appspot.com/ \
|
-url https://snowflake-reg.appspot.com/ \
|
||||||
-front www.google.com \
|
-front www.google.com \
|
||||||
-ice stun:stun.l.google.com:19302
|
-ice stun:stun.l.google.com:19302,stun:s1.taraba.net
|
||||||
|
|
||||||
Bridge snowflake 0.0.3.0:1
|
Bridge snowflake 0.0.3.0:1
|
||||||
|
|
|
@ -19,8 +19,10 @@ func (i *IceServerList) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IceServerList) Set(s string) error {
|
func (i *IceServerList) Set(s string) error {
|
||||||
|
log.Println("IceServerList:")
|
||||||
for _, server := range strings.Split(s, ",") {
|
for _, server := range strings.Split(s, ",") {
|
||||||
// TODO: STUN / TURN url format validation?
|
// TODO: STUN / TURN url format validation?
|
||||||
|
log.Println(server)
|
||||||
option := webrtc.OptionIceServer(server)
|
option := webrtc.OptionIceServer(server)
|
||||||
*i = append(*i, option)
|
*i = append(*i, option)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue