public abstract class StrongBuilderBase<T extends StrongBuilderBase,C> extends java.lang.Object implements StrongBuilder<T,C>
StrongBuilder.Callback<C>
Modifier and Type | Field and Description |
---|---|
protected android.content.Context |
context |
protected java.net.Proxy.Type |
proxyType |
protected javax.net.ssl.SSLContext |
sslContext |
static java.lang.String |
TOR_CHECK_URL |
protected boolean |
useWeakCiphers |
protected boolean |
validateTor |
Constructor and Description |
---|
StrongBuilderBase(android.content.Context context)
Standard constructor.
|
StrongBuilderBase(StrongBuilderBase original)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
build(StrongBuilder.Callback<C> callback)
Asynchronous version of build(), one that uses OrbotInitializer
internally to get the status and checks the validity of the Tor
connection (if requested).
|
java.net.Proxy |
buildProxy(android.content.Intent status) |
protected javax.net.ssl.SSLSocketFactory |
buildSocketFactory() |
protected void |
checkTor(StrongBuilder.Callback<C> callback,
android.content.Intent status,
C connection) |
protected abstract java.lang.String |
get(android.content.Intent status,
C connection,
java.lang.String url)
Performs an HTTP GET request using the supplied connection
to a supplied URL, returning the String response or
throws an Exception (e.g., cannot reach the server).
|
int |
getHttpPort(android.content.Intent status) |
int |
getSocksPort(android.content.Intent status) |
javax.net.ssl.SSLContext |
getSSLContext() |
boolean |
supportsHttpProxy() |
boolean |
supportsSocksProxy() |
T |
withBestProxy()
Call this to configure the Tor proxy from the results
returned by Orbot, using the best available proxy
(SOCKS if possible, else HTTP)
|
T |
withHttpProxy()
Call this to configure the Tor proxy from the results
returned by Orbot, using the HTTP proxy.
|
T |
withSocksProxy()
Call this to configure the Tor proxy from the results
returned by Orbot, using the SOCKS proxy.
|
T |
withTorValidation()
Call this if you want the builder to confirm that we are
communicating over Tor, by reaching out to a Tor test
server and confirming our connection status.
|
T |
withTrustManagers(javax.net.ssl.TrustManager[] trustManagers)
Applies your own custom TrustManagers, such as for
replacing the stock keystore support with a custom
keystore.
|
T |
withWeakCiphers()
Call this if you want a weaker set of supported ciphers,
because you are running into compatibility problems with
some server due to a cipher mismatch.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public static final java.lang.String TOR_CHECK_URL
protected final android.content.Context context
protected java.net.Proxy.Type proxyType
@Nullable protected javax.net.ssl.SSLContext sslContext
protected boolean useWeakCiphers
protected boolean validateTor
public StrongBuilderBase(android.content.Context context)
context
- any Context will do; the StrongBuilderBase
will hold onto the Application singletonpublic StrongBuilderBase(StrongBuilderBase original)
original
- builder to cloneprotected abstract java.lang.String get(android.content.Intent status, C connection, java.lang.String url) throws java.lang.Exception
status
- the status Intent we got back from Orbotconnection
- a connection of the type for the builderurl
- an public Web pagejava.lang.Exception
public T withBestProxy()
withBestProxy
in interface StrongBuilder<T extends StrongBuilderBase,C>
public boolean supportsHttpProxy()
supportsHttpProxy
in interface StrongBuilder<T extends StrongBuilderBase,C>
public T withHttpProxy()
withHttpProxy
in interface StrongBuilder<T extends StrongBuilderBase,C>
public boolean supportsSocksProxy()
supportsSocksProxy
in interface StrongBuilder<T extends StrongBuilderBase,C>
public T withSocksProxy()
withSocksProxy
in interface StrongBuilder<T extends StrongBuilderBase,C>
public T withTrustManagers(javax.net.ssl.TrustManager[] trustManagers) throws java.security.NoSuchAlgorithmException, java.security.KeyManagementException
withTrustManagers
in interface StrongBuilder<T extends StrongBuilderBase,C>
trustManagers
- the TrustManagers to usejava.security.NoSuchAlgorithmException
java.security.KeyManagementException
public T withWeakCiphers()
withWeakCiphers
in interface StrongBuilder<T extends StrongBuilderBase,C>
public T withTorValidation()
withTorValidation
in interface StrongBuilder<T extends StrongBuilderBase,C>
@Nullable public javax.net.ssl.SSLContext getSSLContext()
public int getSocksPort(android.content.Intent status)
public int getHttpPort(android.content.Intent status)
@Nullable protected javax.net.ssl.SSLSocketFactory buildSocketFactory()
@Nullable public java.net.Proxy buildProxy(android.content.Intent status)
public void build(StrongBuilder.Callback<C> callback)
StrongBuilder
build
in interface StrongBuilder<T extends StrongBuilderBase,C>
callback
- Callback to get a connection handed to you
for use, already set up for NetCipherprotected void checkTor(StrongBuilder.Callback<C> callback, android.content.Intent status, C connection)