Move Unordered field around

This commit is contained in:
Andy Wang 2019-08-16 23:20:24 +01:00
parent d73462653d
commit e28df86a55
3 changed files with 7 additions and 6 deletions

View File

@ -242,6 +242,7 @@ func main() {
remotePort = os.Getenv("SS_REMOTE_PORT")
config = os.Getenv("SS_PLUGIN_OPTIONS")
} else {
// TODO: allow proxy method to be set here as a flag so different cloak instances may share the same config file
flag.StringVar(&localHost, "i", "127.0.0.1", "localHost: Cloak listens to proxy clients on this ip")
flag.StringVar(&localPort, "l", "1984", "localPort: Cloak listens to proxy clients on this port")
flag.StringVar(&remoteHost, "s", "", "remoteHost: IP of your proxy server")
@ -312,9 +313,11 @@ func main() {
} else {
var network string
if udp {
network = "udp"
network = "UDP"
sta.Unordered = true
} else {
network = "tcp"
network = "TCP"
sta.Unordered = false
}
log.Infof("Listening on %v %v:%v for proxy clients", network, listeningIP, sta.LocalPort)
}

View File

@ -19,7 +19,6 @@ type rawConfig struct {
UID string
PublicKey string
BrowserSig string
Unordered bool
NumConn int
}
@ -29,6 +28,7 @@ type State struct {
LocalPort string
RemoteHost string
RemotePort string
Unordered bool
Now func() time.Time
SessionID uint32
@ -41,7 +41,6 @@ type State struct {
EncryptionMethod byte
ServerName string
NumConn int
Unordered bool
}
func InitState(localHost, localPort, remoteHost, remotePort string, nowFunc func() time.Time) *State {
@ -125,7 +124,6 @@ func (sta *State) ParseConfig(conf string) (err error) {
sta.ProxyMethod = preParse.ProxyMethod
sta.ServerName = preParse.ServerName
sta.NumConn = preParse.NumConn
sta.Unordered = preParse.Unordered
uid, err := base64.StdEncoding.DecodeString(preParse.UID)
if err != nil {

View File

@ -206,7 +206,7 @@ func composeReply(ch *ClientHello, sharedSecret []byte, sessionKey []byte) ([]by
}
shBytes := addRecordLayer(sh, []byte{0x16}, TLS12)
ccsBytes := addRecordLayer([]byte{0x01}, []byte{0x14}, TLS12)
cert := make([]byte, 68) // this is always 68 bytes
cert := make([]byte, 68) // TODO: add some different lengths maybe?
rand.Read(cert)
encryptedCertBytes := addRecordLayer(cert, []byte{0x17}, TLS12)
ret := append(shBytes, ccsBytes...)