Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszWojciechO committed Sep 18, 2024
1 parent 7f18c62 commit 5eb3557
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 81 deletions.
106 changes: 53 additions & 53 deletions daemon/pb/servers.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions daemon/rpc_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func serversListToServersMap(internalServers core.Servers, allowVirtual bool) []

sMap := make(serversMap)

numberOfServers := 0
for _, server := range internalServers {
if !allowVirtual && server.IsVirtualLocation() {
continue
Expand All @@ -71,7 +70,7 @@ func serversListToServersMap(internalServers core.Servers, allowVirtual bool) []
Id: server.ID,
HostName: server.Hostname,
Virtual: server.IsVirtualLocation(),
ServerGroup: groupFilter(server.Groups),
ServerGroups: groupFilter(server.Groups),
Technologies: technologiesToProtobuf(server.Technologies),
}

Expand All @@ -87,7 +86,6 @@ func serversListToServersMap(internalServers core.Servers, allowVirtual bool) []
}

sMap[countryCode][cityName] = append(sMap[countryCode][cityName], &s)
numberOfServers++
}

countries := []*pb.ServerCountry{}
Expand Down
48 changes: 24 additions & 24 deletions daemon/rpc_servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,30 +273,30 @@ func TestServers(t *testing.T) {
}

expectedServer1 := pb.Server{
Id: int64(server1ID),
HostName: server1Hostname,
Virtual: true,
ServerGroup: []config.ServerGroup{config.ServerGroup_P2P, config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server1ID),
HostName: server1Hostname,
Virtual: true,
ServerGroups: []config.ServerGroup{config.ServerGroup_P2P, config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_NORDLYNX,
pb.Technology_OPENVPN_TCP,
},
}
expectedServer2 := pb.Server{
Id: int64(server2ID),
HostName: server2Hostname,
Virtual: false,
ServerGroup: []config.ServerGroup{config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server2ID),
HostName: server2Hostname,
Virtual: false,
ServerGroups: []config.ServerGroup{config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_OPENVPN_TCP,
pb.Technology_OPENVPN_UDP,
},
}
expectedServer3 := pb.Server{
Id: int64(server3ID),
HostName: server3Hostname,
Virtual: false,
ServerGroup: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server3ID),
HostName: server3Hostname,
Virtual: false,
ServerGroups: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_OBFUSCATED_OPENVPN_TCP,
pb.Technology_OPENVPN_TCP,
Expand All @@ -310,10 +310,10 @@ func TestServers(t *testing.T) {
expectedServersOpenVPNTCP = addToServersMap(expectedServersOpenVPNTCP, "lt", "Vilnius", &expectedServer3)

expectedServer4 := pb.Server{
Id: int64(server4ID),
HostName: server4Hostname,
Virtual: true,
ServerGroup: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server4ID),
HostName: server4Hostname,
Virtual: true,
ServerGroups: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_OBFUSCATED_OPENVPN_UDP,
pb.Technology_OBFUSCATED_OPENVPN_TCP,
Expand All @@ -323,10 +323,10 @@ func TestServers(t *testing.T) {
},
}
expectedServer5 := pb.Server{
Id: int64(server5ID),
HostName: server5Hostname,
Virtual: false,
ServerGroup: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server5ID),
HostName: server5Hostname,
Virtual: false,
ServerGroups: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_OBFUSCATED_OPENVPN_UDP,
pb.Technology_OBFUSCATED_OPENVPN_TCP,
Expand All @@ -353,10 +353,10 @@ func TestServers(t *testing.T) {
"lt",
"Vilnius",
&pb.Server{
Id: int64(server3ID),
HostName: server3Hostname,
Virtual: false,
ServerGroup: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Id: int64(server3ID),
HostName: server3Hostname,
Virtual: false,
ServerGroups: []config.ServerGroup{config.ServerGroup_OBFUSCATED, config.ServerGroup_STANDARD_VPN_SERVERS},
Technologies: []pb.Technology{
pb.Technology_OBFUSCATED_OPENVPN_TCP,
pb.Technology_OPENVPN_TCP,
Expand Down
2 changes: 1 addition & 1 deletion protobuf/daemon/servers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ message Server {
int64 id = 1;
string host_name = 4;
bool virtual = 5;
repeated config.ServerGroup server_group = 6;
repeated config.ServerGroup server_groups = 6;
repeated Technology technologies = 7;
}

Expand Down

0 comments on commit 5eb3557

Please sign in to comment.