Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
Authenticate(addr net.Addr, auth string, tx uint64) (ok bool, id string)
}
Authenticator is an interface that provides authentication logic.
type BandwidthConfig ¶
BandwidthConfig describes the maximum bandwidth that the server can use, in bytes per second.
type Config ¶
type Config struct { TLSConfig TLSConfig QUICConfig QUICConfig Conn net.PacketConn Outbound Outbound BandwidthConfig BandwidthConfig IgnoreClientBandwidth bool DisableUDP bool UDPIdleTimeout time.Duration Authenticator Authenticator EventLogger EventLogger TrafficLogger TrafficLogger MasqHandler http.Handler }
type EventLogger ¶
type EventLogger interface { Connect(addr net.Addr, id string, tx uint64) Disconnect(addr net.Addr, id string, err error) TCPRequest(addr net.Addr, id, reqAddr string) TCPError(addr net.Addr, id, reqAddr string, err error) UDPRequest(addr net.Addr, id string, sessionID uint32, reqAddr string) UDPError(addr net.Addr, id string, sessionID uint32, err error) }
EventLogger is an interface that provides logging logic.
type Outbound ¶
type Outbound interface { TCP(reqAddr string) (net.Conn, error) UDP(reqAddr string) (UDPConn, error) }
Outbound provides the implementation of how the server should connect to remote servers. Although UDP includes a reqAddr, the implementation does not necessarily have to use it to make a "connected" UDP connection that does not accept packets from other addresses. In fact, the default implementation simply uses net.ListenUDP for a "full-cone" behavior.
type QUICConfig ¶
type QUICConfig struct { InitialStreamReceiveWindow uint64 MaxStreamReceiveWindow uint64 InitialConnectionReceiveWindow uint64 MaxConnectionReceiveWindow uint64 MaxIdleTimeout time.Duration MaxIncomingStreams int64 DisablePathMTUDiscovery bool // The server may still override this to true on unsupported platforms. }
QUICConfig contains the QUIC configuration fields that we want to expose to the user.
type TLSConfig ¶
type TLSConfig struct { Certificates []tls.Certificate GetCertificate func(info *tls.ClientHelloInfo) (*tls.Certificate, error) }
TLSConfig contains the TLS configuration fields that we want to expose to the user.
type TrafficLogger ¶
TrafficLogger is an interface that provides traffic logging logic. Tx/Rx in this context refers to the server-remote (proxy target) perspective. Tx is the bytes sent from the server to the remote. Rx is the bytes received by the server from the remote. Apart from logging, the Log function can also return false to signal that the client should be disconnected. This can be used to implement bandwidth limits or post-connection authentication, for example. The implementation of this interface must be thread-safe.