Documentation ¶
Index ¶
- Constants
- Variables
- 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 ListenConfig
- type Listener
Constants ¶
const MaxHopPort = 65535
const MaxUDPLen uint = 65507
const MinHopPort = 49152
Variables ¶
var (
ErrCannotDial = errors.New("cannot dial")
)
var PortHopRange = MaxHopPort - MinHopPort
Functions ¶
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.
type ListenConfig ¶
type ListenConfig struct { ListenConfig net.ListenConfig 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) (*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.
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.