Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCipherMethod(method string) error
- func NewSSUDPConn(c net.PacketConn, cipher *StreamCipher) net.PacketConn
- func Pack(dst, plaintext []byte, s *StreamCipher) ([]byte, error)
- func ProtectSocket(clientConn net.Conn) (newTCPConn *net.TCPConn, err error)
- func TfoDial(net, addr string, data []byte) (net.Conn, error)
- func TfoListen(net, addr string) (net.Listener, error)
- func Unpack(dst, pkt []byte, s *StreamCipher) ([]byte, error)
- type DecOrEnc
- type Filter
- type SSTCPConn
- type SSUDPConn
- type StreamCipher
Constants ¶
const ( TCP_FASTOPEN = 23 TCP_FASTOPEN_VAL = 5 )
Variables ¶
var ENotImpl = errors.New("function not implemented")
var ErrShortPacket = errors.New("short packet")
ErrShortPacket means the packet is too short to be a valid encrypted packet.
var ( // ProtectSocketPathPrefix prefix of file path that used for Unix socket communication ProtectSocketPathPrefix string )
Functions ¶
func CheckCipherMethod ¶
func NewSSUDPConn ¶
func NewSSUDPConn(c net.PacketConn, cipher *StreamCipher) net.PacketConn
NewPacketConn wraps a net.PacketConn with stream cipher encryption/decryption.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a set of regexp targeted to work around SSPanel policy
func (*Filter) AddPattern ¶
AddPattern to the pattern set
type SSTCPConn ¶
type SSTCPConn struct { net.Conn sync.RWMutex *StreamCipher IObfs obfs.IObfs IProtocol protocol.IProtocol IFilter Filter // contains filtered or unexported fields }
SSTCPConn the struct that override the net.Conn methods
func Dial ¶
func Dial(host string, cipher *StreamCipher, priorityInterfaceAddress string) (c *SSTCPConn, err error)
rawaddr shoud contain part of the data in socks request, starting from the ATYP field. (Refer to rfc1928 for more information.)
func NewSSTCPConn ¶
func NewSSTCPConn(c net.Conn, cipher *StreamCipher) *SSTCPConn
func TfoDialWithRawAddr ¶
func TfoDialWithRawAddr(rawaddr []byte, server string, cipher *StreamCipher) (c *SSTCPConn, err error)
This is intended for use by users implementing a local socks proxy. rawaddr shoud contain part of the data in socks request, starting from the ATYP field. (Refer to rfc1928 for more information.)
type SSUDPConn ¶
type SSUDPConn struct { net.PacketConn *StreamCipher IFilter Filter }
type StreamCipher ¶
type StreamCipher struct {
// contains filtered or unexported fields
}
func NewStreamCipher ¶
func NewStreamCipher(method, password string) (c *StreamCipher, err error)
NewStreamCipher creates a cipher that can be used in Dial() etc. Use cipher.Copy() to create a new cipher with the same method and password to avoid the cost of repeated cipher initialization.
func (*StreamCipher) Copy ¶
func (c *StreamCipher) Copy() *StreamCipher
Copy creates a new cipher at it's initial state.
func (*StreamCipher) IV ¶
func (c *StreamCipher) IV() ([]byte, int)
func (*StreamCipher) Key ¶
func (c *StreamCipher) Key() (key []byte, keyLen int)