Change network mask to limit number of peers to 65k (#339)

This commit is contained in:
Misha Bragin 2022-05-28 12:54:09 +02:00 committed by GitHub
parent feff6dc966
commit 59a964eed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -267,7 +267,7 @@ func TestAccountManager_AddAccount(t *testing.T) {
expectedSetupKeysSize := 2
expectedNetwork := net.IPNet{
IP: net.IP{100, 64, 0, 0},
Mask: net.IPMask{255, 192, 0, 0},
Mask: net.IPMask{255, 255, 0, 0},
}
account, err := manager.AddAccount(expectedId, userId, "")

View File

@ -365,7 +365,7 @@ func toWiretrusteeConfig(config *Config, turnCredentials *TURNCredentials) *prot
func toPeerConfig(peer *Peer) *proto.PeerConfig {
return &proto.PeerConfig{
Address: peer.IP.String() + "/24", // todo make it explicit
Address: peer.IP.String() + "/16", // todo make it explicit
}
}

View File

@ -251,7 +251,7 @@ func Test_SyncProtocol(t *testing.T) {
t.Fatal("expecting SyncResponse to have NetworkMap with a non-nil PeerConfig")
}
if networkMap.GetPeerConfig().GetAddress() != "100.64.0.1/24" {
if networkMap.GetPeerConfig().GetAddress() != "100.64.0.1/16" {
t.Fatal("expecting SyncResponse to have NetworkMap with a PeerConfig having valid Address")
}

View File

@ -107,7 +107,7 @@ var _ = Describe("Management service", func() {
err = encryption.DecryptMessage(serverPubKey, key, encryptedResponse.Body, resp)
Expect(err).NotTo(HaveOccurred())
Expect(resp.PeerConfig.Address).To(BeEquivalentTo("100.64.0.1/24"))
Expect(resp.PeerConfig.Address).To(BeEquivalentTo("100.64.0.1/16"))
expectedSignalConfig := &mgmtProto.HostConfig{
Uri: "signal.wiretrustee.com:10000",

View File

@ -33,7 +33,7 @@ type Network struct {
func NewNetwork() *Network {
return &Network{
Id: xid.New().String(),
Net: net.IPNet{IP: net.ParseIP("100.64.0.0"), Mask: net.IPMask{255, 192, 0, 0}},
Net: net.IPNet{IP: net.ParseIP("100.64.0.0"), Mask: net.IPMask{255, 255, 0, 0}},
Dns: "",
Serial: 0}
}