Documentation ¶
Index ¶
- Constants
- Variables
- func Manager(log *l.Logger, packets <-chan []byte, add <-chan Conn)
- func TCPServer(log *l.Logger, serveAddr string, add chan<- Conn)
- func ToHTTP(sendTo chan<- Conn, w http.ResponseWriter, _ *http.Request)
- func UDPServer(log *l.Logger, listenAddr string, add chan<- Conn)
- type Conn
Constants ¶
const ( // ConnChannelCap is the capacity of the channel to each connection wrapper ConnChannelCap = 20 // UDPTimeout is how long packets will be sent for after a received packet UDPTimeout = 5 * time.Second )
Variables ¶
var ClientLogLevel = l.Ignore
ClientLogLevel controls weither client IO errors should be logged
Functions ¶
func Manager ¶
Manager starts new forwarders and cancels them if they stop consuming packets. Returns when the packet channel is closed. forwarders do not merge buffered packets, but TCP-based connections might both merge and split packets.
func TCPServer ¶
TCPServer listens for TCP connections and passes the connection to add. Never returns, but any IO error from ResolveTCPAddr(), ListenTCP() or AcceptTCP() is fatal. As TCP is stream-oriented, packets might be split or merged even without delays to send bigger and fewer packets.
func ToHTTP ¶
func ToHTTP(sendTo chan<- Conn, w http.ResponseWriter, _ *http.Request)
ToHTTP sets up the writer for forwarding and passes it to add. Doesn't return until the client disconnects or there is an I/O error. Packets sent through this will be concatenated and split as the ResponseWriter sees fit.
Types ¶
type Conn ¶
type Conn interface { io.WriteCloser }
Conn abstracts away the actual trait from other files