Documentation ¶
Index ¶
- Variables
- func AwaitRequest(connInfo *network.Connection, callbackFn RequestCallbackFunc) error
- func ListenPacket(network, address string) (net.Listener, error)
- func ListenUDP(network, address string) (net.Listener, error)
- func StartSluice(network, address string)
- type ListenerFactory
- type PacketConn
- func (conn *PacketConn) Close() error
- func (conn *PacketConn) LocalAddr() net.Addr
- func (conn *PacketConn) Read(b []byte) (n int, err error)
- func (conn *PacketConn) RemoteAddr() net.Addr
- func (conn *PacketConn) SetDeadline(t time.Time) error
- func (conn *PacketConn) SetReadDeadline(t time.Time) error
- func (conn *PacketConn) SetWriteDeadline(t time.Time) error
- func (conn *PacketConn) Write(b []byte) (n int, err error)
- type PacketListener
- type Request
- type RequestCallbackFunc
- type Sluice
- type SluiceModule
- type UDPConn
- func (conn *UDPConn) Close() error
- func (conn *UDPConn) LocalAddr() net.Addr
- func (conn *UDPConn) Read(b []byte) (n int, err error)
- func (conn *UDPConn) RemoteAddr() net.Addr
- func (conn *UDPConn) SetDeadline(t time.Time) error
- func (conn *UDPConn) SetReadDeadline(t time.Time) error
- func (conn *UDPConn) SetWriteDeadline(t time.Time) error
- func (conn *UDPConn) Write(b []byte) (n int, err error)
- type UDPListener
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported is returned when a protocol is not supported. ErrUnsupported = errors.New("unsupported protocol") // ErrSluiceOffline is returned when the sluice for a network is offline. ErrSluiceOffline = errors.New("is offline") )
var ( // EnableListener indicates if it should start the sluice listeners. Must be set at startup. EnableListener bool = true )
Functions ¶
func AwaitRequest ¶
func AwaitRequest(connInfo *network.Connection, callbackFn RequestCallbackFunc) error
AwaitRequest pre-registers a connection at the sluice for initializing it when it arrives.
func ListenPacket ¶
ListenPacket creates a packet listener.
func StartSluice ¶
func StartSluice(network, address string)
StartSluice starts a sluice listener at the given address.
Types ¶
type ListenerFactory ¶
ListenerFactory defines a function to create a listener.
type PacketConn ¶
type PacketConn struct {
// contains filtered or unexported fields
}
PacketConn simulates a connection for a stateless protocol.
func (*PacketConn) Close ¶
func (conn *PacketConn) Close() error
Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.
func (*PacketConn) LocalAddr ¶
func (conn *PacketConn) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*PacketConn) Read ¶
func (conn *PacketConn) Read(b []byte) (n int, err error)
Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*PacketConn) RemoteAddr ¶
func (conn *PacketConn) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.
func (*PacketConn) SetDeadline ¶
func (conn *PacketConn) SetDeadline(t time.Time) error
SetDeadline is a no-op as UDP connections share a single socket.
func (*PacketConn) SetReadDeadline ¶
func (conn *PacketConn) SetReadDeadline(t time.Time) error
SetReadDeadline is a no-op as UDP connections share a single socket.
func (*PacketConn) SetWriteDeadline ¶
func (conn *PacketConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline is a no-op as UDP connections share a single socket.
type PacketListener ¶
type PacketListener struct {
// contains filtered or unexported fields
}
PacketListener is a listener for packet based protocols.
func (*PacketListener) Accept ¶
func (ln *PacketListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
func (*PacketListener) Addr ¶
func (ln *PacketListener) Addr() net.Addr
Addr returns the listener's network address.
func (*PacketListener) Close ¶
func (ln *PacketListener) Close() error
Close closes the listener. Any blocked Accept operations will be unblocked and return errors.
type Request ¶
type Request struct { ConnInfo *network.Connection CallbackFn RequestCallbackFunc Expires time.Time }
Request holds request data for a sluice entry.
type RequestCallbackFunc ¶
type RequestCallbackFunc func(connInfo *network.Connection, conn net.Conn)
RequestCallbackFunc is called for taking a over handling connection that arrived at the sluice.
type Sluice ¶
type Sluice struct {
// contains filtered or unexported fields
}
Sluice is a tunnel entry listener.
func (*Sluice) AwaitRequest ¶
AwaitRequest pre-registers a connection.
type SluiceModule ¶ added in v1.6.19
type SluiceModule struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.6.19
func New(instance instance) (*SluiceModule, error)
New returns a new Config module.
func (*SluiceModule) Manager ¶ added in v1.6.19
func (s *SluiceModule) Manager() *mgr.Manager
func (*SluiceModule) Start ¶ added in v1.6.19
func (s *SluiceModule) Start() error
func (*SluiceModule) Stop ¶ added in v1.6.19
func (s *SluiceModule) Stop() error
type UDPConn ¶
type UDPConn struct {
// contains filtered or unexported fields
}
UDPConn simulates a connection for a stateless protocol.
func (*UDPConn) Close ¶
Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.
func (*UDPConn) Read ¶
Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*UDPConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*UDPConn) SetDeadline ¶
SetDeadline is a no-op as UDP connections share a single socket.
func (*UDPConn) SetReadDeadline ¶
SetReadDeadline is a no-op as UDP connections share a single socket.
func (*UDPConn) SetWriteDeadline ¶
SetWriteDeadline is a no-op as UDP connections share a single socket.
type UDPListener ¶
type UDPListener struct {
// contains filtered or unexported fields
}
UDPListener is a listener for UDP.
func (*UDPListener) Accept ¶
func (ln *UDPListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
func (*UDPListener) Addr ¶
func (ln *UDPListener) Addr() net.Addr
Addr returns the listener's network address.
func (*UDPListener) Close ¶
func (ln *UDPListener) Close() error
Close closes the listener. Any blocked Accept operations will be unblocked and return errors.