private async void OnPlayerConnected(Player player) { //Kick anyone that doesn't have an IP address due to a 'Time Out' if (string.IsNullOrWhiteSpace(player.IP)) { Logger.Log("Kicking {0} for no address.", player); await Server.Kick(player, NoAddressReason); return; } //Kick anyone that is VPN but doesnt have an account. if (player.IsVPN && (!AllowVPN || (!AllowAnonymousVPN && player.IsAnonymous))) { Logger.Log("Kicking {0} for Anonymous VPN.", player); await Server.Kick(player, AnonymousVpnReason); return; } //Kick anyone that is IPv6 but doesnt have an account. if (VPNValidator.IsIPv6(player.IP) && player.IsAnonymous) { Logger.Log("Kicking {0} for Anonymous IPv6.", player); await Server.Kick(player, IPv6Reason); return; } //TODO: Check All Anonymous Connections //TODO: Implement DEFCON. We only want to check this on a high defcon. 10 levels of defcon maybe? }
public Connections(Server server) : base(server, "Connection") { try { string filepath = Configuration.GetString("vpn_ipv4", "Resources/vpn-ipv4.txt"); Configuration.Save(); Validator = new VPNValidator(); Validator.Load(filepath); } catch (Exception e) { Logger.LogError(e, "Failed to create VPN Validator: {0}"); Validator = null; } _playerSemaphore = new SemaphoreSlim(1, 1); }