mirror of https://github.com/cbeuw/Cloak
Move Unordered field around
This commit is contained in:
parent
d73462653d
commit
e28df86a55
|
|
@ -242,6 +242,7 @@ func main() {
|
||||||
remotePort = os.Getenv("SS_REMOTE_PORT")
|
remotePort = os.Getenv("SS_REMOTE_PORT")
|
||||||
config = os.Getenv("SS_PLUGIN_OPTIONS")
|
config = os.Getenv("SS_PLUGIN_OPTIONS")
|
||||||
} else {
|
} 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(&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(&localPort, "l", "1984", "localPort: Cloak listens to proxy clients on this port")
|
||||||
flag.StringVar(&remoteHost, "s", "", "remoteHost: IP of your proxy server")
|
flag.StringVar(&remoteHost, "s", "", "remoteHost: IP of your proxy server")
|
||||||
|
|
@ -312,9 +313,11 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
var network string
|
var network string
|
||||||
if udp {
|
if udp {
|
||||||
network = "udp"
|
network = "UDP"
|
||||||
|
sta.Unordered = true
|
||||||
} else {
|
} else {
|
||||||
network = "tcp"
|
network = "TCP"
|
||||||
|
sta.Unordered = false
|
||||||
}
|
}
|
||||||
log.Infof("Listening on %v %v:%v for proxy clients", network, listeningIP, sta.LocalPort)
|
log.Infof("Listening on %v %v:%v for proxy clients", network, listeningIP, sta.LocalPort)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ type rawConfig struct {
|
||||||
UID string
|
UID string
|
||||||
PublicKey string
|
PublicKey string
|
||||||
BrowserSig string
|
BrowserSig string
|
||||||
Unordered bool
|
|
||||||
NumConn int
|
NumConn int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,6 +28,7 @@ type State struct {
|
||||||
LocalPort string
|
LocalPort string
|
||||||
RemoteHost string
|
RemoteHost string
|
||||||
RemotePort string
|
RemotePort string
|
||||||
|
Unordered bool
|
||||||
|
|
||||||
Now func() time.Time
|
Now func() time.Time
|
||||||
SessionID uint32
|
SessionID uint32
|
||||||
|
|
@ -41,7 +41,6 @@ type State struct {
|
||||||
EncryptionMethod byte
|
EncryptionMethod byte
|
||||||
ServerName string
|
ServerName string
|
||||||
NumConn int
|
NumConn int
|
||||||
Unordered bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitState(localHost, localPort, remoteHost, remotePort string, nowFunc func() time.Time) *State {
|
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.ProxyMethod = preParse.ProxyMethod
|
||||||
sta.ServerName = preParse.ServerName
|
sta.ServerName = preParse.ServerName
|
||||||
sta.NumConn = preParse.NumConn
|
sta.NumConn = preParse.NumConn
|
||||||
sta.Unordered = preParse.Unordered
|
|
||||||
|
|
||||||
uid, err := base64.StdEncoding.DecodeString(preParse.UID)
|
uid, err := base64.StdEncoding.DecodeString(preParse.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ func composeReply(ch *ClientHello, sharedSecret []byte, sessionKey []byte) ([]by
|
||||||
}
|
}
|
||||||
shBytes := addRecordLayer(sh, []byte{0x16}, TLS12)
|
shBytes := addRecordLayer(sh, []byte{0x16}, TLS12)
|
||||||
ccsBytes := addRecordLayer([]byte{0x01}, []byte{0x14}, 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)
|
rand.Read(cert)
|
||||||
encryptedCertBytes := addRecordLayer(cert, []byte{0x17}, TLS12)
|
encryptedCertBytes := addRecordLayer(cert, []byte{0x17}, TLS12)
|
||||||
ret := append(shBytes, ccsBytes...)
|
ret := append(shBytes, ccsBytes...)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue