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