Пример #1
0
        public static void AddressCheckResponse(NatNegServer server, UDPPacket packet)
        {
            InitPacket initPacket = new InitPacket(packet.BytesRecieved);

            byte[] sendingBuffer = initPacket.CreateReplyPacket();
            server.Send(packet, sendingBuffer);
        }
Пример #2
0
        public static void NatifyResponse(NatNegServer server, byte[] recv)
        {
            InitPacket initPacket = new InitPacket(recv);

            byte[] sendingBuffer = initPacket.CreateReplyPacket();
            server.SendAsync(server.Socket.RemoteEndPoint, sendingBuffer);
        }
Пример #3
0
 public void Parse(InitPacket init)
 {
     Version     = init.Version;
     Cookie      = init.Cookie;
     PortType    = init.PortType;
     ClientIndex = init.ClientIndex;
 }
Пример #4
0
        protected override void CheckRequest()
        {
            _initPacket = new InitPacket();
            _initPacket.Parse(_recv);

            string key = _session.RemoteEndPoint.ToString() + "-" + _initPacket.PortType.ToString();

            if (!NatNegotiatorPool.Sessions.TryGetValue(key, out _))
            {
                NatNegotiatorPool.Sessions.TryAdd(key, _session);
            }
        }
Пример #5
0
        private void HandlePacket(InitPacket packet)
        {
            logger.LogDebug("Processing Init SFTP packet, version={Version}.", packet.Version);

            var version = new VersionPacket
            {
                // Version = Math.Min(packet.Version, 3)
                Version = 3
            };

            Send(version);
        }
Пример #6
0
 protected override void CheckRequest()
 {
     _initPacket = new InitPacket();
     _initPacket.Parse(_recv);
 }