public override void OnConnect(ProxyClient sender)
        {
            var source = (SslStream)sender.SourceStream;
            var remote = (SslStream)sender.RemoteStream;

            source.AuthenticateAsServer(Certificate, false, SslProtocols.Default, false);
            remote.AuthenticateAsClient(RemoteAddress);

            base.OnConnect(sender);
        }
Esempio n. 2
0
		public override void OnConnect(ProxyClient sender)
		{
			var source = (SslStream)sender.SourceStream;
			var remote = (SslStream)sender.RemoteStream;

			source.AuthenticateAsServer(Certificate, false, SslProtocols.Default, false);
			remote.AuthenticateAsClient(RemoteAddress);

			base.OnConnect(sender);

		}
Esempio n. 3
0
 public virtual void OnException(ProxyClient sender, Exception ex)
 {
     lock (Clients)
     {
         int idx = Clients.IndexOf(sender);
         if (idx != -1)
         {
             Clients.RemoveAt(idx);
         }
     }
     sender.Dispose();
     StaticLogger.Debug(ex);
 }
Esempio n. 4
0
        protected virtual void OnAccept(IAsyncResult ar)
        {
            ProxyClient client = null;

            try
            {
                if (!IsListening)
                {
                    return;
                }

                client = NewClient(Listener.EndAcceptTcpClient(ar));
                Listener.BeginAcceptTcpClient(OnAccept, null);

                lock (Clients)
                    Clients.Add(client);

                client.Start(RemoteAddress, RemotePort);

                if (client.SourceTcp.Client != null)
                {
                    StaticLogger.Info(string.Format("Client {0} connected", client.SourceTcp.Client.RemoteEndPoint));
                }
            }
            catch (Exception ex)
            {
                if (client != null)
                {
                    OnException(client, ex);
                }
                else
                {
                    //Ignore objectdisposed, happens when stopping
                    if (!(ex is ObjectDisposedException))
                    {
                        StaticLogger.Error(ex);
                    }
                }
            }
        }
Esempio n. 5
0
		public override void OnException(ProxyClient sender, Exception ex)
		{
			IsConnected = false;
			base.OnException(sender, ex);
		}
Esempio n. 6
0
		public override void OnConnect(ProxyClient sender)
		{
			IsConnected = true;
			base.OnConnect(sender);
		}
Esempio n. 7
0
 public virtual void OnConnect(ProxyClient sender)
 {
 }
Esempio n. 8
0
 public virtual void OnReceive(ProxyClient sender, byte[] buffer, int idx, int len)
 {
 }
Esempio n. 9
0
		public virtual void OnConnect(ProxyClient sender)
		{
			
		}
Esempio n. 10
0
		public virtual void OnException(ProxyClient sender, Exception ex)
		{
			lock (Clients)
			{
				int idx = Clients.IndexOf(sender);
				if (idx != -1)
					Clients.RemoveAt(idx);
			}
			sender.Dispose();
			StaticLogger.Debug(ex);
		}
Esempio n. 11
0
		public virtual void OnReceive(ProxyClient sender, byte[] buffer, int idx, int len)
		{
		}
Esempio n. 12
0
 public override void OnException(ProxyClient sender, Exception ex)
 {
     IsConnected = false;
     base.OnException(sender, ex);
 }
Esempio n. 13
0
 public override void OnConnect(ProxyClient sender)
 {
     IsConnected = true;
     base.OnConnect(sender);
 }