gqserver

package
v0.0.0-...-392571f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecordLayer

func AddRecordLayer(input []byte, typ []byte, ver []byte) []byte

AddRecordLayer adds record layer to data

func BtoInt

func BtoInt(b []byte) int

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

func PeelRecordLayer(data []byte) []byte

PeelRecordLayer peels off the record layer

func PsudoRandBytes

func PsudoRandBytes(length int, seed int64) []byte

PsudoRandBytes returns a byte slice filled with psudorandom bytes generated by the seed

func ReadTillDrain

func ReadTillDrain(conn net.Conn, buffer []byte) (n int, err error)

ReadTillDrain reads TLS data according to its record layer

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) ParseConfig

func (sta *State) ParseConfig(config string) (err error)

ParseConfig parses the config (either a path to json or in-line ssv config) into a State variable

func (*State) SetAESKey

func (sta *State) SetAESKey()

SetAESKey calculates the SHA256 of the string key

func (*State) UsedRandomCleaner

func (sta *State) UsedRandomCleaner()

UsedRandomCleaner clears the cache of used random fields every 12 hours

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL