interfaces.go 816 B

1234567891011121314151617181920212223242526272829303132333435
  1. package lib
  2. import (
  3. "net"
  4. )
  5. // Interface for catching Snowflakes. (aka the remote dialer)
  6. type Tongue interface {
  7. Catch() (*WebRTCPeer, error)
  8. // Get the maximum number of snowflakes
  9. GetMax() int
  10. }
  11. // Interface for collecting some number of Snowflakes, for passing along
  12. // ultimately to the SOCKS handler.
  13. type SnowflakeCollector interface {
  14. // Add a Snowflake to the collection.
  15. // Implementation should decide how to connect and maintain the webRTCConn.
  16. Collect() (*WebRTCPeer, error)
  17. // Remove and return the most available Snowflake from the collection.
  18. Pop() *WebRTCPeer
  19. // Signal when the collector has stopped collecting.
  20. Melted() <-chan struct{}
  21. }
  22. // Interface to adapt to goptlib's SocksConn struct.
  23. type SocksConnector interface {
  24. Grant(*net.TCPAddr) error
  25. Reject() error
  26. net.Conn
  27. }