C# Class TrotiNet.AbstractProxyLogic

Abstract class for all HTTP proxy logic implementations
One instance of a derived class will be created per client connection.
Mostrar archivo Open project: Gizeta/Nekoxy-fiddler Class Usage Examples

Protected Properties

Property Type Description
DestinationHostName string
DestinationPort int
RelayHttpProxyHost string
RelayHttpProxyOverride string
RelayHttpProxyPort int
SocketBP HttpSocket
SocketPS HttpSocket

Public Methods

Method Description
LogicLoop ( ) : bool

Entry point to HTTP request handling

SetRelayProxy ( SystemProxySettings sps ) : void

In case of a proxy chain, set the next proxy to contact

ProxyOverride is ignored.

Protected Methods

Method Description
AbstractProxyLogic ( HttpSocket socketBP ) : System

Common constructor for proxies; one proxy instance is created per client connection

Connect ( string hostname, int port ) : void

If necessary, connect the remote SocketPS socket to the given host and port

If SocketPS is already connected to the right host and port, the socket is reused as is.

ParseDestinationHostAndPort ( HttpRequestLine hrl, HttpHeaders hh_rq, int &port ) : string

Extract the host and port to use from either the HTTP request line, or the HTTP headers; update the request line to remove the hostname and port

May modify the URI of hrl

TunnelBP ( byte msg, uint position, uint to_send ) : void

Message packet handler for tunneling data from PS to BP

TunnelPS ( byte msg, uint position, uint to_send ) : void

Message packet handler for tunneling data from BP to PS

Private Methods

Method Description
Resolve ( string hostname ) : System.Net.IPAddress[]

Method Details

AbstractProxyLogic() protected method

Common constructor for proxies; one proxy instance is created per client connection
protected AbstractProxyLogic ( HttpSocket socketBP ) : System
socketBP HttpSocket Client socket
return System

Connect() protected method

If necessary, connect the remote SocketPS socket to the given host and port
If SocketPS is already connected to the right host and port, the socket is reused as is.
protected Connect ( string hostname, int port ) : void
hostname string Remote host name
port int Remote port
return void

LogicLoop() public abstract method

Entry point to HTTP request handling
public abstract LogicLoop ( ) : bool
return bool

ParseDestinationHostAndPort() protected method

Extract the host and port to use from either the HTTP request line, or the HTTP headers; update the request line to remove the hostname and port
May modify the URI of hrl
protected ParseDestinationHostAndPort ( HttpRequestLine hrl, HttpHeaders hh_rq, int &port ) : string
hrl HttpRequestLine /// The HTTP request line; the URI will be updated to remove the /// host name and port number
hh_rq HttpHeaders The HTTP request headers
port int /// When this method returns, contains the request port ///
return string

SetRelayProxy() public method

In case of a proxy chain, set the next proxy to contact
ProxyOverride is ignored.
public SetRelayProxy ( SystemProxySettings sps ) : void
sps SystemProxySettings
return void

TunnelBP() protected method

Message packet handler for tunneling data from PS to BP
protected TunnelBP ( byte msg, uint position, uint to_send ) : void
msg byte
position uint
to_send uint
return void

TunnelPS() protected method

Message packet handler for tunneling data from BP to PS
protected TunnelPS ( byte msg, uint position, uint to_send ) : void
msg byte
position uint
to_send uint
return void

Property Details

DestinationHostName protected_oe property

Name of the host to which SocketBP is currently connected
protected string DestinationHostName
return string

DestinationPort protected_oe property

Port to which SocketBP is currently connected
protected int DestinationPort
return int

RelayHttpProxyHost protected_oe property

Set to a proxy host name if our proxy is not connecting to the internet, but to another proxy instead
protected string RelayHttpProxyHost
return string

RelayHttpProxyOverride protected_oe property

Set to a proxy bypass specification if our proxy is not connecting to the internet, but to another proxy instead
XXX Bypass not implemented
protected string RelayHttpProxyOverride
return string

RelayHttpProxyPort protected_oe property

Set to a proxy port if our proxy is not connecting to the internet, but to another proxy instead
protected int RelayHttpProxyPort
return int

SocketBP protected_oe property

Socket dedicated to the (client) browser-proxy communication
protected HttpSocket,TrotiNet SocketBP
return HttpSocket

SocketPS protected_oe property

Socket dedicated to the proxy-server (remote) communication
protected HttpSocket,TrotiNet SocketPS
return HttpSocket