mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
interfaces.go, SnowflakeCollector, better composition
This commit is contained in:
parent
b2c9fcac5e
commit
556596cc5a
4 changed files with 217 additions and 140 deletions
30
client/interfaces.go
Normal file
30
client/interfaces.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// Interface for collecting and releasing snowflakes.
|
||||
type SnowflakeCollector interface {
|
||||
Collect() (*webRTCConn, error)
|
||||
Release() *webRTCConn
|
||||
}
|
||||
|
||||
// Interface for catching those wild Snowflakes.
|
||||
type Tongue interface {
|
||||
Catch() (*webRTCConn, error)
|
||||
}
|
||||
|
||||
// Interface which primarily adapts 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 {
|
||||
Send([]byte)
|
||||
Close() error
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue