mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
prepare IceServerList client flag (#24)
This commit is contained in:
parent
d2e61e315c
commit
3ec771df01
2 changed files with 19 additions and 0 deletions
|
@ -22,6 +22,7 @@ var ptInfo pt.ClientInfo
|
||||||
// var logFile *os.File
|
// var logFile *os.File
|
||||||
var brokerURL string
|
var brokerURL string
|
||||||
var frontDomain string
|
var frontDomain string
|
||||||
|
var iceServers IceServerList
|
||||||
|
|
||||||
// When a connection handler starts, +1 is written to this channel; when it
|
// When a connection handler starts, +1 is written to this channel; when it
|
||||||
// ends, -1 is written.
|
// ends, -1 is written.
|
||||||
|
@ -109,6 +110,7 @@ func handler(conn *pt.SocksConn) error {
|
||||||
|
|
||||||
// TODO: Make SOCKS acceptance more independent from WebRTC so they can
|
// TODO: Make SOCKS acceptance more independent from WebRTC so they can
|
||||||
// be more easily interchanged.
|
// be more easily interchanged.
|
||||||
|
|
||||||
copyLoop(conn, remote)
|
copyLoop(conn, remote)
|
||||||
// <-remote.endChannel
|
// <-remote.endChannel
|
||||||
log.Println("----END---")
|
log.Println("----END---")
|
||||||
|
@ -161,6 +163,7 @@ func main() {
|
||||||
webrtc.SetLoggingVerbosity(1)
|
webrtc.SetLoggingVerbosity(1)
|
||||||
flag.StringVar(&brokerURL, "url", "", "URL of signaling broker")
|
flag.StringVar(&brokerURL, "url", "", "URL of signaling broker")
|
||||||
flag.StringVar(&frontDomain, "front", "", "front domain")
|
flag.StringVar(&frontDomain, "front", "", "front domain")
|
||||||
|
flag.Var(&iceServers, "ice", "comma-separated list of ICE servers")
|
||||||
flag.Parse()
|
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 {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -9,6 +11,20 @@ const (
|
||||||
LogTimeInterval = 5
|
LogTimeInterval = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type IceServerList []string
|
||||||
|
|
||||||
|
func (i *IceServerList) String() string {
|
||||||
|
return fmt.Sprint(*i)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *IceServerList) Set(s string) error {
|
||||||
|
for _, server := range strings.Split(s, ",") {
|
||||||
|
// TODO: STUN / TURN url format validation?
|
||||||
|
*i = append(*i, server)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type BytesInfo struct {
|
type BytesInfo struct {
|
||||||
outboundChan chan int
|
outboundChan chan int
|
||||||
inboundChan chan int
|
inboundChan chan int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue