var _ … type TunnelingConnection … // NewTunnelingConnection wraps the passed gorilla/websockets connection // with the TunnelingConnection struct (implementing net.Conn). func NewTunnelingConnection(name string, conn *gwebsocket.Conn) *TunnelingConnection { … } // Read implements "io.Reader" interface, reading from the stored connection // into the passed buffer "p". Returns the number of bytes read and an error. // Can keep track of the "inProgress" messsage from the tunneled connection. func (c *TunnelingConnection) Read(p []byte) (int, error) { … } // Write implements "io.Writer" interface, copying the data in the passed // byte array "p" into the stored tunneled connection. Returns the number // of bytes written and an error. func (c *TunnelingConnection) Write(p []byte) (n int, err error) { … } // Close implements "io.Closer" interface, signaling the other tunneled connection // endpoint, and closing the tunneled connection only once. func (c *TunnelingConnection) Close() error { … } // LocalAddr implements part of the "net.Conn" interface, returning the local // endpoint network address of the tunneled connection. func (c *TunnelingConnection) LocalAddr() net.Addr { … } // LocalAddr implements part of the "net.Conn" interface, returning the remote // endpoint network address of the tunneled connection. func (c *TunnelingConnection) RemoteAddr() net.Addr { … } // SetDeadline sets the *absolute* time in the future for both // read and write deadlines. Returns an error if one occurs. func (c *TunnelingConnection) SetDeadline(t time.Time) error { … } // SetDeadline sets the *absolute* time in the future for the // read deadlines. Returns an error if one occurs. func (c *TunnelingConnection) SetReadDeadline(t time.Time) error { … } // SetDeadline sets the *absolute* time in the future for the // write deadlines. Returns an error if one occurs. func (c *TunnelingConnection) SetWriteDeadline(t time.Time) error { … }