public PomeloClient(ClientProtocolType type = ClientProtocolType.NORMAL, byte[] clientcert = null, string clientpwd = "", string cathumbprint = null) { this.client_type = type; switch (this.client_type) { case ClientProtocolType.TLS: { transport = new TransporterSSL(clientcert, clientpwd, cathumbprint); } break; case ClientProtocolType.NORMAL: { transport = new TransporterTCP(); } break; default: break; } this.protocol = new Protocol(transport, processMessage, OnProtocolClose); this.transport.setOnStateChanged(OnTransportStateChange); eventManager = new EventManager(); }
internal PluginClient(IPEndPoint proxyServer, ClientProtocolType type, string domain, byte[] passwordHash) { _proxyServer = proxyServer; _protocolType = type; _domain = domain; _passwordHash = passwordHash; switch (type) { case ClientProtocolType.Tcp: case ClientProtocolType.Udp: _tcpClient = new TcpClient(proxyServer.AddressFamily); break; default: throw new NotImplementedException(); } }
//TODO TLS "C7773B9D1BF0C5C956C88C60440FA23C3889A403" public bool ConnectServer(string host, int port, ClientProtocolType eProtoType = ClientProtocolType.NORMAL, string HandShakeCache = "", byte[] clientcert = null, string clientpwd = "", string cathumbprint = null) { //if (eProtoType == ClientProtocolType.TLS) //{ // if (clientcert == null || cathumbprint == null) // { // return false; // } //} //this.CloseClient(); pc = new PomeloClient(eProtoType, clientcert, "", cathumbprint); pc.Connect(host, port, HandShakeCache, delegate() { if (pc.IsConnected) { this.UpdateClient(); pc.HandShake(null, delegate(JsonData data) { if (this.connectEvent != null) { this.connectEvent(); } }); } }, delegate() { if (this.closeEvent != null) { this.closeEvent(); } } ); return(true); }
internal PluginClient(IPEndPoint proxyServer, ClientProtocolType type, Algorithm algorithm, byte key) { _proxyServer = proxyServer; _type = type; switch (type) { case ClientProtocolType.Tcp: _tcpClient = new TcpClient(proxyServer.AddressFamily); break; case ClientProtocolType.Udp: _udpClient = new UdpClient(proxyServer.AddressFamily); break; default: throw new NotImplementedException(); } _algorithm = algorithm; _key = key; }
public IPluginClient Build(IPEndPoint proxyServer, ClientProtocolType protocolType) => new PluginClient(proxyServer, protocolType, _domain, _passwordHash);
public IPluginClient Build(IPEndPoint proxyServer, ClientProtocolType protocolType) { return(new PluginClient(proxyServer, protocolType, _algorithm, _key)); }