mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Separate peers.go file with improved documentation and more solid interfaces
This commit is contained in:
parent
556596cc5a
commit
c63f5cfc0a
5 changed files with 186 additions and 120 deletions
|
@ -1,30 +1,36 @@
|
|||
// In the Client context, "Snowflake" refers to a remote browser proxy.
|
||||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// Interface for collecting and releasing snowflakes.
|
||||
type SnowflakeCollector interface {
|
||||
Collect() (*webRTCConn, error)
|
||||
Release() *webRTCConn
|
||||
}
|
||||
|
||||
// Interface for catching those wild Snowflakes.
|
||||
// Interface for catching Snowflakes. (aka the remote dialer)
|
||||
type Tongue interface {
|
||||
Catch() (*webRTCConn, error)
|
||||
}
|
||||
|
||||
// Interface which primarily adapts to goptlib's SocksConn struct.
|
||||
// Interface for collecting some number of Snowflakes, for passing along
|
||||
// ultimately to the SOCKS handler.
|
||||
type SnowflakeCollector interface {
|
||||
|
||||
// Add a Snowflake to the collection.
|
||||
// Implementation should decide how to connect and maintain the webRTCConn.
|
||||
Collect() error
|
||||
|
||||
// Remove and return the most available Snowflake from the collection.
|
||||
Pop() *webRTCConn
|
||||
}
|
||||
|
||||
// Interface to adapt to goptlib's SocksConn struct.
|
||||
type SocksConnector interface {
|
||||
Grant(*net.TCPAddr) error
|
||||
Reject() error
|
||||
net.Conn
|
||||
}
|
||||
|
||||
// Interface for the Snowflake's transport.
|
||||
// (Specifically, webrtc.DataChannel)
|
||||
type SnowflakeChannel interface {
|
||||
// Interface for the Snowflake's transport. (Typically just webrtc.DataChannel)
|
||||
type SnowflakeDataChannel interface {
|
||||
Send([]byte)
|
||||
Close() error
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue