Fix domain fronting for old android versions

This commit is contained in:
NekoInverter committed 2020-12-16 23:32:21 +08:00
1 parent 0565ad3292
commit e2eff79577
2 files changed
+19 -16

No files matched your search

@@ -8,6 +8,8 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
public class EhSSLSocketFactory extends SSLSocketFactory {
@@ -27,9 +29,12 @@ public class EhSSLSocketFactory extends SSLSocketFactory {
return ((SSLSocketFactory) getDefault()).createSocket(s, host, port, autoClose);
}
InetAddress address = s.getInetAddress();
Log.d("EhSSLSocketFactory", "Host: " + host + " Address: " + address.getHostAddress());
if (autoClose) s.close();
return getDefault().createSocket(address, port);
SSLSocket socket = (SSLSocket) getDefault().createSocket(address, port);
SSLSession sslSession = socket.getSession();
Log.d("EhSSLSocketFactory", "Host: " + host + " Address: " + address.getHostAddress() + " Protocol:" + sslSession.getProtocol() + " CipherSuite:" + sslSession.getCipherSuite());
socket.setEnabledProtocols(socket.getSupportedProtocols());
return socket;
}
@Override