Documentation
¶
Index ¶
- Constants
- Variables
- func GetKCPDialer(kcpConfig KCPConfig, logger func(format string, a ...interface{})) func(network, address string) (net.Conn, error)
- func GetKCPStats() *kcp.Snmp
- func GetQUICDialer(ctx context.Context, logger func(format string, a ...interface{})) func(network, address string) (net.Conn, error)
- func NewServerState(stateDir string) error
- func ReadTCPFrameUDP(tcpConn net.Conn, datagramBuffer []byte, lengthBuffer []byte) ([]byte, error)
- func ReadUDPFrameTCP(udpConn *net.UDPConn, datagramBuffer []byte) ([]byte, *net.UDPAddr, error)
- type Dialer
- type IATMode
- type KCPConfig
- type ListenConfig
- type Listener
- type QUICConfig
- type QUICConn
- type QUICListener
Constants ¶
const ( DefaultKCPSendWindowSize int = 65535 DefaultKCPReceiveWindowSize int = 65535 DefaultKCPReadBuffer int = 16 * 1024 * 1024 DefaultKCPWriteBuffer int = 16 * 1024 * 1024 DefaultNoDelay bool = true DefaultInterval int = 10 DefaultResend int = 2 DefaultDisableFlowControl bool = true DefaultMTU int = 1400 )
const MaxHopPort uint = 65535
const MaxUDPLen uint = 65507
const MinHopPort uint = 49152
Variables ¶
Functions ¶
func GetKCPDialer ¶
func GetKCPStats ¶ added in v1.1.0
func GetKCPStats() *kcp.Snmp
func GetQUICDialer ¶ added in v1.3.0
func NewServerState ¶
NewServerState will create all the state (node-id, private-key, public-key, drbg-seed, iat-mode) that the OBFS4 server needs to function. It will write it into the passed stateDir folder.
func ReadTCPFrameUDP ¶
ReadTCPFrameUDP reads from a tcp connection and returns a framed UDP buffer
Types ¶
type Dialer ¶
type Dialer struct { Dialer net.Dialer NodeID *ntor.NodeID PublicKey *ntor.PublicKey IATMode IATMode DialFunc func(string, string) (net.Conn, error) // contains filtered or unexported fields }
Dialer contains options for connecting to an address and obfuscating traffic with the obfs4 protocol. It performs the ntor handshake on all dialed connections.
func NewDialerFromArgs ¶
NewDialerFromArgs creates a dialer from existing pluggable transport arguments.
func NewDialerFromCert ¶
NewDialerFromCert creates a dialer from a node certificate.
func (*Dialer) Args ¶
Args returns the dialers options as pluggable transport arguments. The args include valid args for the "new" (version >= 0.0.3) bridge lines that use a unified "cert" argument as well as the legacy lines that use a separate Node ID and Public Key.
func (*Dialer) Dial ¶
Dial creates an outbound net.Conn and performs the ntor handshake.
type KCPConfig ¶
type KCPConfig struct { Enabled bool `json:"enabled"` SendWindowSize int `json:"send_window_size"` ReceiveWindowSize int `json:"receive_window_size"` ReadBuffer int `json:"read_buffer"` WriteBuffer int `json:"write_buffer"` NoDelay bool `json:"no_delay"` Interval int `json:"interval"` Resend int `json:"resend"` DisableFlowControl bool `json:"disable_flow_control"` MTU int `json:"mtu"` }
https://github.com/skywind3000/kcp/blob/master/README.en.md#protocol-configuration
type ListenConfig ¶
type ListenConfig struct { ListenConfig net.ListenConfig KCPConfig KCPConfig QUICConfig QUICConfig NodeID *ntor.NodeID PrivateKey *ntor.PrivateKey PublicKey string Seed [ntor.KeySeedLength]byte StateDir string }
ListenConfig contains options for listening to an address. If Seed is not set it defaults to a randomized value. If StateDir is not set the current working directory is used.
func NewListenConfig ¶
func NewListenConfig(nodeIDStr, privKeyStr, pubKeyStr, seedStr, stateDir string, kcpConfig KCPConfig, quicConfig QUICConfig) (*ListenConfig, error)
NewListenConfig returns a ListenConfig and any error during the initialization. perhaps this is redundant, but using the same json format than ss for debug.
func NewListenConfigCert ¶
func NewListenConfigCert(cert string) (*ListenConfig, error)
NewListenConfigCert creates a listener config by unpacking the node ID from its certificate. The private key must still be specified.
func (*ListenConfig) Listen ¶
Listen listens on the local network address. See func net.Dial for a description of the network and address parameters.
func (*ListenConfig) Wrap ¶
Wrap takes an existing net.Listener and wraps it in a listener that is configured to perform the ntor handshake and copy data through the obfuscated conn. Values from the inner net.ListenConfig are ignored.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a network listener that accepts obfuscated connections and performs the ntor handshake on them.
func (*Listener) Accept ¶
Accept waits for and returns the next connection to the listener.
func (*Listener) Addr ¶
Addr returns the listener's network address.
type QUICConfig ¶ added in v1.3.0
type QUICConfig struct { Enabled bool TLSCert *tls.Certificate }
func DefaultQUICConfig ¶ added in v1.3.0
func DefaultQUICConfig() *QUICConfig
type QUICConn ¶ added in v1.3.0
type QUICConn struct { quic.Stream // contains filtered or unexported fields }
type QUICListener ¶ added in v1.3.0
type QUICListener struct {
// contains filtered or unexported fields
}
func (*QUICListener) Accept ¶ added in v1.3.0
func (q *QUICListener) Accept() (net.Conn, error)
func (*QUICListener) Addr ¶ added in v1.3.0
func (q *QUICListener) Addr() net.Addr
Addr returns the listener's network address.
func (*QUICListener) Close ¶ added in v1.3.0
func (q *QUICListener) Close() error