Documentation ¶
Overview ¶
Package obfs4 provides an implementation of the Tor Project's obfs4 obfuscation protocol.
Index ¶
- Constants
- Variables
- func MakePayload(pktType uint8, data []byte, padLen uint16) []byte
- func MakeUnpaddedPayload(pktType uint8, data []byte) []byte
- func ParseCert(args *pt.Args) (nodeID *ntor.NodeID, publicKey *ntor.PublicKey, err error)
- type ClientArgs
- type ClientFactory
- type Conn
- type InvalidAuthError
- type InvalidMacError
- type ServerFactory
- type Transport
Constants ¶
const ( PacketOverhead = f.LengthLength + f.TypeLength MaxPacketPayloadLength = framing.MaximumFramePayloadLength - PacketOverhead SeedPacketPayloadLength = seedLength )
Variables ¶
var ErrInvalidHandshake = errors.New("handshake: Failed to find M_[C,S]")
ErrInvalidHandshake is the error returned when the obfs4 handshake fails due to the peer not sending the correct mark. This error is fatal and the connection MUST be dropped.
var ErrMarkNotFoundYet = errors.New("handshake: M_[C,S] not found yet")
ErrMarkNotFoundYet is the error returned when the obfs4 handshake is incomplete and requires more data to continue. This error is non-fatal and is the equivalent to EAGAIN/EWOULDBLOCK.
var ErrNtorFailed = errors.New("handshake: ntor handshake failure")
ErrNtorFailed is the error returned when the ntor handshake fails. This error is fatal and the connection MUST be dropped.
var ErrReplayedHandshake = errors.New("handshake: Replay detected")
ErrReplayedHandshake is the error returned when the obfs4 handshake fails due it being replayed. This error is fatal and the connection MUST be dropped.
Functions ¶
func MakeUnpaddedPayload ¶
Types ¶
type ClientArgs ¶
type ClientFactory ¶
func (*ClientFactory) ParseArgs ¶
func (cf *ClientFactory) ParseArgs(args *pt.Args) (interface{}, error)
func (*ClientFactory) Transport ¶
func (cf *ClientFactory) Transport() base.Transport
type Conn ¶
func NewClientConn ¶
func NewClientConn(conn net.Conn, args *ClientArgs) (c *Conn, err error)
func (*Conn) GetDummyTraffic ¶
getDummyTraffic must be of type sharknado.DummyTrafficFunc and return `n` bytes of dummy traffic that's ready to be written to the wire.
type InvalidAuthError ¶
InvalidAuthError is the error returned when the ntor AUTH tags do not match. This error is fatal and the connection MUST be dropped.
func (*InvalidAuthError) Error ¶
func (e *InvalidAuthError) Error() string
type InvalidMacError ¶
InvalidMacError is the error returned when the handshake MACs do not match. This error is fatal and the connection MUST be dropped.
func (*InvalidMacError) Error ¶
func (e *InvalidMacError) Error() string
type ServerFactory ¶
type ServerFactory struct {
// contains filtered or unexported fields
}
func NewServerFactory ¶
func NewServerFactory(t base.Transport, stateDir string, args *pt.Args) (*ServerFactory, error)
func (*ServerFactory) Args ¶
func (sf *ServerFactory) Args() *pt.Args
func (*ServerFactory) Transport ¶
func (sf *ServerFactory) Transport() base.Transport
type Transport ¶
type Transport struct{}
Transport is the obfs4 implementation of the base.Transport interface.
func (*Transport) ClientFactory ¶
func (t *Transport) ClientFactory(stateDir string) (base.ClientFactory, error)
ClientFactory returns a new ClientFactory instance.
func (*Transport) ServerFactory ¶
func (t *Transport) ServerFactory(stateDir string, args *pt.Args) (base.ServerFactory, error)
ServerFactory returns a new ServerFactory instance.