public void SetObfsPlugin(Server server, int head_len) { lock (server) // need a server lock { if (server.getProtocolData() == null) { server.setProtocolData(_protocol.InitData()); } if (server.getObfsData() == null) { server.setObfsData(_obfs.InitData()); } } int mss = MSS; string server_addr = server.server; OverHead = _protocol.GetOverhead() + _obfs.GetOverhead(); RecvBufferSize = RecvSize - OverHead; if (_proxy_server != null) { server_addr = _proxy_server; } _protocol.SetServerInfo(new ServerInfo(server_addr, server.server_port, server.protocolparam ?? "", server.getProtocolData(), _encryptor.getIV(), _password, _encryptor.getKey(), head_len, mss, OverHead, RecvBufferSize)); _obfs.SetServerInfo(new ServerInfo(server_addr, server.server_port, server.obfsparam ?? "", server.getObfsData(), _encryptor.getIV(), _password, _encryptor.getKey(), head_len, mss, OverHead, RecvBufferSize)); }
public void SetObfsPlugin(Server server, int head_len) { lock (server) // need a server lock { if (server.getProtocolData() == null) { server.setProtocolData(_protocol.InitData()); } if (server.getObfsData() == null) { server.setObfsData(_obfs.InitData()); } } int mss = 1460; string server_addr = server.server; if (_proxy_server != null) { server_addr = _proxy_server; } _protocol.SetServerInfo(new ServerInfo(server_addr, server.server_port, "", server.getProtocolData(), _encryptor.getIV(), _password, _encryptor.getKey(), head_len, mss)); _obfs.SetServerInfo(new ServerInfo(server_addr, server.server_port, server.obfsparam ?? "", server.getObfsData(), _encryptor.getIV(), _password, _encryptor.getKey(), head_len, mss)); }
public override void SetServerInfo(ServerInfo serverInfo) { if (subObfs == null && serverInfo.param != null && serverInfo.param.Length > 0) { try { string[] paramsList = serverInfo.param.Split(",".ToCharArray(), 2); string subParam = ""; if (paramsList.Length > 1) { subObfs = ObfsFactory.GetObfs(paramsList[0]); subParam = paramsList[1]; } else { subObfs = ObfsFactory.GetObfs(serverInfo.param); } if (((SubEncodeObfs)serverInfo.data).subObfs == null) { ((SubEncodeObfs)serverInfo.data).subObfs = subObfs.InitData(); } subObfs.SetServerInfo(new ServerInfo(serverInfo.host, serverInfo.port, serverInfo.tcp_mss, subParam, ((SubEncodeObfs)serverInfo.data).subObfs)); } catch (Exception) { // do nothing } serverInfo.param = null; } base.SetServerInfo(serverInfo); }