@@ -198,7 +198,7 @@ public int NumConnectedClients
198
198
199
199
#endregion
200
200
201
- public Server ( int maxSlots , string address , int port , ulong protocolID , byte [ ] privateKey )
201
+ public Server ( int maxSlots , int port , ulong protocolID , byte [ ] privateKey )
202
202
{
203
203
this . tickrate = 60 ;
204
204
@@ -210,7 +210,7 @@ public Server(int maxSlots, string address, int port, ulong protocolID, byte[] p
210
210
this . clientSlots = new RemoteClient [ maxSlots ] ;
211
211
this . encryptionManager = new EncryptionManager ( maxSlots ) ;
212
212
213
- this . listenEndpoint = new IPEndPoint ( IPAddress . Parse ( address ) , port ) ;
213
+ this . listenEndpoint = new IPEndPoint ( IPAddress . Any , port ) ;
214
214
215
215
if ( this . listenEndpoint . AddressFamily == AddressFamily . InterNetwork )
216
216
this . listenSocket = new UDPSocketContext ( AddressFamily . InterNetwork ) ;
@@ -226,7 +226,7 @@ public Server(int maxSlots, string address, int port, ulong protocolID, byte[] p
226
226
KeyUtils . GenerateKey ( this . challengeKey ) ;
227
227
}
228
228
229
- internal Server ( ISocketContext socketContext , int maxSlots , string address , int port , ulong protocolID , byte [ ] privateKey )
229
+ internal Server ( ISocketContext socketContext , int maxSlots , int port , ulong protocolID , byte [ ] privateKey )
230
230
{
231
231
this . tickrate = 60 ;
232
232
@@ -238,7 +238,7 @@ internal Server(ISocketContext socketContext, int maxSlots, string address, int
238
238
this . clientSlots = new RemoteClient [ maxSlots ] ;
239
239
this . encryptionManager = new EncryptionManager ( maxSlots ) ;
240
240
241
- this . listenEndpoint = new IPEndPoint ( IPAddress . Parse ( address ) , port ) ;
241
+ this . listenEndpoint = new IPEndPoint ( IPAddress . Any , port ) ;
242
242
243
243
this . listenSocket = socketContext ;
244
244
@@ -699,12 +699,18 @@ private void processConnectionRequest(ByteArrayReaderWriter reader, int size, En
699
699
}
700
700
701
701
// if this server's public IP is not in the list of endpoints, packet is not valid
702
+ /*
703
+ * We run in Docker, so our listen endpoint (0.0.0.0:40000) won't ever appear in the connect
704
+ * token's IP endpoint (<public IP>:40000). We don't really need this "security", since the
705
+ * private keypair secures servers anyway.
706
+ *
702
707
bool serverAddressInEndpoints = privateConnectToken.ConnectServers.Any(x => x.Endpoint.CompareEndpoint(this.listenEndpoint, this.Port));
703
708
if (!serverAddressInEndpoints)
704
709
{
705
710
log("Server address not listen in token", NetcodeLogLevel.Debug);
706
711
return;
707
712
}
713
+ */
708
714
709
715
// if a client from packet source IP / port is already connected, ignore the packet
710
716
if ( clientSlots . Any ( x => x != null && x . RemoteEndpoint . Equals ( sender ) ) )
0 commit comments