예제 #1
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);
        }
예제 #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);

		}
예제 #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);
 }
예제 #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);
                    }
                }
            }
        }
예제 #5
0
		public override void OnException(ProxyClient sender, Exception ex)
		{
			IsConnected = false;
			base.OnException(sender, ex);
		}
예제 #6
0
		public override void OnConnect(ProxyClient sender)
		{
			IsConnected = true;
			base.OnConnect(sender);
		}
예제 #7
0
 public virtual void OnConnect(ProxyClient sender)
 {
 }
예제 #8
0
 public virtual void OnReceive(ProxyClient sender, byte[] buffer, int idx, int len)
 {
 }
예제 #9
0
 public override void OnException(ProxyClient sender, Exception ex)
 {
     IsConnected = false;
     base.OnException(sender, ex);
 }
예제 #10
0
 public override void OnConnect(ProxyClient sender)
 {
     IsConnected = true;
     base.OnConnect(sender);
 }
예제 #11
0
		public virtual void OnConnect(ProxyClient sender)
		{
			
		}
예제 #12
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);
		}
예제 #13
0
		public virtual void OnReceive(ProxyClient sender, byte[] buffer, int idx, int len)
		{
		}