mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Log answer
This commit is contained in:
parent
5eb77569fe
commit
860898b733
3 changed files with 12 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,6 @@
|
||||||
*.swm
|
*.swm
|
||||||
.DS_Store
|
.DS_Store
|
||||||
datadir/
|
datadir/
|
||||||
client/snowflake
|
client/client
|
||||||
server/server
|
server/server
|
||||||
snowflake.log
|
snowflake.log
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
UseBridges 1
|
UseBridges 1
|
||||||
DataDirectory datadir
|
DataDirectory datadir
|
||||||
|
|
||||||
ClientTransportPlugin snowflake exec ./snowflake
|
ClientTransportPlugin snowflake exec ./client
|
||||||
Bridge snowflake 0.0.3.0:1
|
Bridge snowflake 0.0.3.0:1
|
||||||
|
|
|
@ -125,6 +125,11 @@ func makePeerConnection(config *webrtc.Configuration) (*webrtc.PeerConnection, e
|
||||||
log.Println("OnDataChannel")
|
log.Println("OnDataChannel")
|
||||||
datachannelHandler(&webRTCConn{pc: pc, dc: dc})
|
datachannelHandler(&webRTCConn{pc: pc, dc: dc})
|
||||||
}
|
}
|
||||||
|
pc.OnIceComplete = func() {
|
||||||
|
log.Printf("----------------")
|
||||||
|
fmt.Fprintln(logFile, pc.LocalDescription().Serialize())
|
||||||
|
log.Printf("----------------")
|
||||||
|
}
|
||||||
return pc, nil
|
return pc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +143,7 @@ func readSignalingMessages(signalChan chan *webrtc.SessionDescription, f *os.Fil
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
signalChan <- sdp
|
signalChan <- sdp
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if err := s.Err(); err != nil {
|
if err := s.Err(); err != nil {
|
||||||
log.Printf("signal FIFO: %s", err)
|
log.Printf("signal FIFO: %s", err)
|
||||||
|
@ -165,14 +171,14 @@ func listenWebRTC(config *webrtc.Configuration, signal string) (*os.File, error)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer signalFile.Close()
|
//defer signalFile.Close()
|
||||||
|
|
||||||
var signalChan = make(chan *webrtc.SessionDescription)
|
var signalChan = make(chan *webrtc.SessionDescription)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case sdp := <- signalChan:
|
case sdp := <-signalChan:
|
||||||
pc, err := makePeerConnection(config)
|
pc, err := makePeerConnection(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("makePeerConnection: %s", err)
|
log.Printf("makePeerConnection: %s", err)
|
||||||
|
@ -222,7 +228,8 @@ func main() {
|
||||||
pt.SmethodError(bindaddr.MethodName, err.Error())
|
pt.SmethodError(bindaddr.MethodName, err.Error())
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
pt.Smethod(bindaddr.MethodName, nil)
|
bindaddr.Addr.Port = 12345 // lies!!!
|
||||||
|
pt.Smethod(bindaddr.MethodName, bindaddr.Addr)
|
||||||
listeners = append(listeners, ln)
|
listeners = append(listeners, ln)
|
||||||
default:
|
default:
|
||||||
pt.SmethodError(bindaddr.MethodName, "no such method")
|
pt.SmethodError(bindaddr.MethodName, "no such method")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue