Move MockDomainList to LocalConnConfig as the list doesn't need to be sent to the remote

This commit is contained in:
Andy Wang 2021-03-25 20:02:27 +00:00
parent 4a66426e30
commit b9cccbe815
No known key found for this signature in database
GPG Key ID: 181B49F9F38F3374
2 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ func main() {
// sessionID is usergenerated. There shouldn't be a security concern because the scope of // sessionID is usergenerated. There shouldn't be a security concern because the scope of
// sessionID is limited to its UID. // sessionID is limited to its UID.
authInfo.MockDomain = authInfo.MockDomainList[rand.Intn(len(authInfo.MockDomainList))] authInfo.MockDomain = localConfig.MockDomainList[rand.Intn(len(localConfig.MockDomainList))]
quad := make([]byte, 4) quad := make([]byte, 4)
common.RandRead(authInfo.WorldState.Rand, quad) common.RandRead(authInfo.WorldState.Rand, quad)
authInfo.SessionId = binary.BigEndian.Uint32(quad) authInfo.SessionId = binary.BigEndian.Uint32(quad)

View File

@ -49,8 +49,9 @@ type RemoteConnConfig struct {
} }
type LocalConnConfig struct { type LocalConnConfig struct {
LocalAddr string LocalAddr string
Timeout time.Duration Timeout time.Duration
MockDomainList []string
} }
type AuthInfo struct { type AuthInfo struct {
@ -61,7 +62,6 @@ type AuthInfo struct {
Unordered bool Unordered bool
ServerPubKey crypto.PublicKey ServerPubKey crypto.PublicKey
MockDomain string MockDomain string
MockDomainList []string
WorldState common.WorldState WorldState common.WorldState
} }
@ -154,8 +154,8 @@ func (raw *RawConfig) ProcessRawConfig(worldState common.WorldState) (local Loca
return nullErr("ServerName") return nullErr("ServerName")
} }
auth.MockDomain = raw.ServerName auth.MockDomain = raw.ServerName
auth.MockDomainList = raw.AlternativeNames local.MockDomainList = raw.AlternativeNames
auth.MockDomainList = append(auth.MockDomainList, auth.MockDomain) local.MockDomainList = append(local.MockDomainList, auth.MockDomain)
if raw.ProxyMethod == "" { if raw.ProxyMethod == "" {
return nullErr("ServerName") return nullErr("ServerName")
} }