Exemplo n.º 1
0
 public GoIpExpiryEventArgs(string message, GoIpExpiryPacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
Exemplo n.º 2
0
        private void ExpiryData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Expiry event");

            GoIpExpiryPacket packet = new GoIpExpiryPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp Expiry event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("EXPIRY", packet.receiveid.ToString(), "Expiry event authentication error!"), host, port);
                OnExpiry?.Invoke(this, new GoIpExpiryEventArgs("GoIp Expiry event authentication error!", packet, host, port));
                return;
            }

            packet.password = "";  // Delete password for security reasons

            _logger.LogInformation("Received GoIp Expiry event. ReceiveId: {0} Expiry: {1}", packet.receiveid, packet.exp);

            Send(ACKPacketFactory.ACK("EXPIRY", packet.receiveid.ToString(), ""), host, port);
            OnExpiry?.Invoke(this, new GoIpExpiryEventArgs("OK", packet, host, port));
        }