diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-11-29 18:12:40 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-11-29 18:14:21 +0100 |
commit | b25ec7c923924e53ddb65f9a34e9a669dcf066c7 (patch) | |
tree | 5ddabd18ad1cb880ee07ae8c950b99b99f150012 /pkg/snowflake/lib/interfaces.go | |
parent | c7148d9559dab0e1cdbc6dd5306a3c852615560e (diff) |
[feat] snowflake client support
Diffstat (limited to 'pkg/snowflake/lib/interfaces.go')
-rw-r--r-- | pkg/snowflake/lib/interfaces.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/snowflake/lib/interfaces.go b/pkg/snowflake/lib/interfaces.go new file mode 100644 index 0000000..5378f4a --- /dev/null +++ b/pkg/snowflake/lib/interfaces.go @@ -0,0 +1,34 @@ +package lib + +import ( + "net" +) + +// Interface for catching Snowflakes. (aka the remote dialer) +type Tongue interface { + Catch() (*WebRTCPeer, error) + + // Get the maximum number of snowflakes + GetMax() int +} + +// 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() (*WebRTCPeer, error) + + // Remove and return the most available Snowflake from the collection. + Pop() *WebRTCPeer + + // Signal when the collector has stopped collecting. + Melted() <-chan struct{} +} + +// Interface to adapt to goptlib's SocksConn struct. +type SocksConnector interface { + Grant(*net.TCPAddr) error + Reject() error + net.Conn +} |