mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 11:25:13 +01:00
Parse received header / TLS
This commit is contained in:
@@ -41,6 +41,7 @@ import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateParsingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
@@ -501,6 +502,20 @@ public class ConnectionHelper {
|
||||
return addr;
|
||||
}
|
||||
|
||||
static boolean isLocalIPAddress(String host) {
|
||||
boolean numeric = ConnectionHelper.jni_is_numeric_address(host);
|
||||
if (!numeric)
|
||||
return false;
|
||||
|
||||
try {
|
||||
InetAddress addr = ConnectionHelper.from6to4(InetAddress.getByName(host));
|
||||
return (addr.isSiteLocalAddress() || addr.isLinkLocalAddress());
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static List<String> getCommonNames(Context context, String domain, int port, int timeout) throws IOException {
|
||||
List<String> result = new ArrayList<>();
|
||||
InetSocketAddress address = new InetSocketAddress(domain, port);
|
||||
|
||||
Reference in New Issue
Block a user