interfaces.go, SnowflakeCollector, better composition

This commit is contained in:
Serene Han 2016-05-24 15:18:54 -07:00
parent b2c9fcac5e
commit 556596cc5a
4 changed files with 217 additions and 140 deletions

30
client/interfaces.go Normal file
View 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
}