mirror of https://github.com/cbeuw/Cloak
Unexport some client.State fields
This commit is contained in:
parent
b98a74f49b
commit
812ca1af99
|
|
@ -8,7 +8,7 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type Browser interface {
|
||||
type browser interface {
|
||||
composeClientHello(chHiddenData) []byte
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ func addExtRec(typ []byte, data []byte) []byte {
|
|||
|
||||
func PrepareConnection(sta *State, conn net.Conn) (sessionKey []byte, err error) {
|
||||
hd, sharedSecret := makeHiddenData(sta)
|
||||
chOnly := sta.Browser.composeClientHello(hd)
|
||||
chOnly := sta.browser.composeClientHello(hd)
|
||||
chWithRecordLayer := util.AddRecordLayer(chOnly, []byte{0x16}, []byte{0x03, 0x01})
|
||||
_, err = conn.Write(chWithRecordLayer)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func makeHiddenData(sta *State) (ret chHiddenData, sharedSecret []byte) {
|
|||
copy(plaintext, sta.UID)
|
||||
copy(plaintext[16:28], sta.ProxyMethod)
|
||||
plaintext[28] = sta.EncryptionMethod
|
||||
binary.BigEndian.PutUint64(plaintext[29:37], uint64(sta.Now().Unix()))
|
||||
binary.BigEndian.PutUint64(plaintext[29:37], uint64(sta.now().Unix()))
|
||||
binary.BigEndian.PutUint32(plaintext[37:41], atomic.LoadUint32(&sta.SessionID))
|
||||
|
||||
if sta.Unordered {
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ type State struct {
|
|||
RemotePort string
|
||||
Unordered bool
|
||||
|
||||
Now func() time.Time
|
||||
SessionID uint32
|
||||
UID []byte
|
||||
staticPub crypto.PublicKey
|
||||
|
||||
Browser Browser
|
||||
staticPub crypto.PublicKey
|
||||
now func() time.Time
|
||||
browser browser
|
||||
|
||||
ProxyMethod string
|
||||
EncryptionMethod byte
|
||||
|
|
@ -49,7 +49,7 @@ func InitState(localHost, localPort, remoteHost, remotePort string, nowFunc func
|
|||
LocalPort: localPort,
|
||||
RemoteHost: remoteHost,
|
||||
RemotePort: remotePort,
|
||||
Now: nowFunc,
|
||||
now: nowFunc,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
@ -114,9 +114,9 @@ func (sta *State) ParseConfig(conf string) (err error) {
|
|||
|
||||
switch strings.ToLower(preParse.BrowserSig) {
|
||||
case "chrome":
|
||||
sta.Browser = &Chrome{}
|
||||
sta.browser = &Chrome{}
|
||||
case "firefox":
|
||||
sta.Browser = &Firefox{}
|
||||
sta.browser = &Firefox{}
|
||||
default:
|
||||
return errors.New("unsupported browser signature")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue