sluice

package
v1.6.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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

func ListenPacket(network, address string) (net.Listener, error)

ListenPacket creates a packet listener.

func ListenUDP

func ListenUDP(network, address string) (net.Listener, error)

ListenUDP creates a packet listener.

func StartSluice

func StartSluice(network, address string)

StartSluice starts a sluice listener at the given address.

Types

type ListenerFactory

type ListenerFactory func(network, address string) (net.Listener, error)

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.

func (*PacketConn) Write

func (conn *PacketConn) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

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

func (s *Sluice) AwaitRequest(r *Request) error

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

func (conn *UDPConn) Close() error

Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.

func (*UDPConn) LocalAddr

func (conn *UDPConn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*UDPConn) Read

func (conn *UDPConn) 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 (*UDPConn) RemoteAddr

func (conn *UDPConn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*UDPConn) SetDeadline

func (conn *UDPConn) SetDeadline(t time.Time) error

SetDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) SetReadDeadline

func (conn *UDPConn) SetReadDeadline(t time.Time) error

SetReadDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) SetWriteDeadline

func (conn *UDPConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) Write

func (conn *UDPConn) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL