Documentation ¶
Index ¶
- func AddRecordLayer(input []byte, typ []byte, ver []byte) []byte
- func BtoInt(b []byte) int
- func ComposeReply(ch *ClientHello) []byte
- func IsSS(input *ClientHello, sta *State) bool
- func PeelRecordLayer(data []byte) []byte
- func PsudoRandBytes(length int, seed int64) (ret []byte)
- func ReadTillDrain(conn net.Conn) (ret []byte, err error)
- type ClientHello
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRecordLayer ¶
AddRecordLayer adds record layer to data
func BtoInt ¶
BtoInt converts a byte slice into int in Big Endian order Uint methods from binary package can be used, but they are messy
func ComposeReply ¶
func ComposeReply(ch *ClientHello) []byte
ComposeReply composes the ServerHello, ChangeCipherSpec and Finished messages together with their respective record layers into one byte slice. The content of these messages are random and useless for this plugin
func IsSS ¶
func IsSS(input *ClientHello, sta *State) bool
IsSS checks if a ClientHello belongs to shadowsocks
func PeelRecordLayer ¶
PeelRecordLayer peels off the record layer
func PsudoRandBytes ¶
PsudoRandBytes returns a byte slice filled with psudorandom bytes generated by the seed
Types ¶
type ClientHello ¶
type ClientHello struct {
// contains filtered or unexported fields
}
ClientHello contains every field in a ClientHello message
func ParseClientHello ¶
func ParseClientHello(data []byte) (ret *ClientHello, err error)
ParseClientHello parses everything on top of the TLS layer (including the record layer) into ClientHello type
type State ¶
type State struct { WebServerAddr string Key string AESKey []byte Now func() time.Time SS_LOCAL_HOST string SS_LOCAL_PORT string SS_REMOTE_HOST string SS_REMOTE_PORT string M sync.RWMutex UsedRandom map[[32]byte]int }
State type stores the global state of the program
func (*State) DelUsedRandom ¶
DelUsedRandom deletes a random field from the map
func (*State) ParseConfig ¶
ParseConfig parses the config file into a State variable
func (*State) PutUsedRandom ¶
PutUsedRandom adds a random field into map UsedRandom