mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Add proxy event for when client has connected
This enables the usage of callbacks that will be called when a client has opened a data channel connection to the proxy.
This commit is contained in:
parent
0d8bd159ec
commit
aaf8826560
2 changed files with 9 additions and 0 deletions
|
@ -67,6 +67,14 @@ func (e EventOnProxyStarting) String() string {
|
||||||
return "Proxy starting"
|
return "Proxy starting"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EventOnProxyClientConnected struct {
|
||||||
|
SnowflakeEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e EventOnProxyClientConnected) String() string {
|
||||||
|
return fmt.Sprintf("client connected")
|
||||||
|
}
|
||||||
|
|
||||||
type EventOnProxyConnectionOver struct {
|
type EventOnProxyConnectionOver struct {
|
||||||
SnowflakeEvent
|
SnowflakeEvent
|
||||||
InboundTraffic int64
|
InboundTraffic int64
|
||||||
|
|
|
@ -449,6 +449,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(
|
||||||
|
|
||||||
dc.OnOpen(func() {
|
dc.OnOpen(func() {
|
||||||
log.Printf("Data Channel %s-%d open\n", dc.Label(), dc.ID())
|
log.Printf("Data Channel %s-%d open\n", dc.Label(), dc.ID())
|
||||||
|
sf.EventDispatcher.OnNewSnowflakeEvent(event.EventOnProxyClientConnected{})
|
||||||
|
|
||||||
if sf.OutboundAddress != "" {
|
if sf.OutboundAddress != "" {
|
||||||
selectedCandidatePair, err := pc.SCTP().Transport().ICETransport().GetSelectedCandidatePair()
|
selectedCandidatePair, err := pc.SCTP().Transport().ICETransport().GetSelectedCandidatePair()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue