Class NetworkAdminImpl
java.lang.Object
com.biglybt.core.networkmanager.admin.NetworkAdmin
com.biglybt.core.networkmanager.admin.impl.NetworkAdminImpl
- All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprotected classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate InetAddress[]private final Map<String, NetworkAdminImpl.AddressHistoryRecord> private longprivate static InetAddressprivate static InetAddressprivate final List<NetworkAdminASN> private final List<InetAddress> private static final intprivate final AsyncDispatcher(package private) final Map<InetAddress, NetworkAdminASN> private final AsyncDispatcherstatic final intstatic final int(package private) longprivate Object[](package private) Objectstatic final int(package private) booleanstatic final intprivate InetAddress[]private static final Stringprivate booleanprivate final AESemaphoreprivate longprivate longprivate final InetAddress[]private AESemaphoreprivate InetAddressprivate booleanprivate intprivate longprivate InetAddressprivate final Objectprivate booleanprivate booleanprivate booleanprivate booleanprivate static final intprivate booleanprivate final Patternprivate longprivate List<NetworkInterface> private final CopyOnWriteList<NetworkAdminPropertyChangeListener> private static InetAddressprivate static InetAddressprivate booleanprivate static final LogIDsprivate static final intprivate Set<NetworkInterface> private booleanprivate intprivate intprivate static final intprivate static final intprivate Map<InetAddress, String> private longprivate final Objectprivate static NetworkAdminImplprivate booleanprivate booleanprivate booleanprivate Set<Inet6Address> private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate voidvoidprotected voidprotected NetworkAdminASNImplASNFromMap(Map<String, Object> m) protected voidbind(ServerSocketChannel ssc, InetAddress address, int port) protected boolean[]bytesToBits(byte[] bytes) private InetAddress[]calcBindAddresses(String addressString, boolean enforceBind) protected booleancanBind(InetAddress bind_ip) protected booleancanConnectWithBind(InetAddress bind_address, int timeout) booleanprivate int(package private) voidprivate StringcheckBindAddresses(boolean log_alerts) (package private) voidprotected voidcheckDefaultBindAddress(boolean first_time) private void(package private) voidprotected booleancheckNetworkInterfaces(boolean first_time, boolean force) classifyRoute(InetAddress address) (package private) voidcreateInboundProtocol(Core core, int type, int port) createSocksProxy(String host, int port, String username, String password) private Inet6AddressextractIPv6(String input) private Enumeration<InetAddress> filter(Enumeration<InetAddress> addresses) protected voidfirePropertyChange(String property) voidgenerate(IndentWriter writer) voidprotected voidgenerateDiagnostics(IndentWriter iw, NetworkAdminProtocol[] protocols) getAllBindAddresses(boolean include_wildcard) Returns the list of current addresses that can successfully be bound to with an ephemeral portprivate InetAddress[]getBindableAddresses(boolean ignore_loopback, boolean ignore_link_local) intgetBindablePort(int prefer_port) Object[]private Object[]private StringgetConfigKey(NetworkInterface intf) getDefaultPublicAddress(boolean peek) protected NetworkAdminASNgetFromASHistory(InetAddress address) getInboundProtocols(Core core) Object[]getInterfaceForAddress(InetAddress address) getMultiHomedServiceBindAddresses(boolean nio) getNATDevices(Core core) getNetworkInterfacesAsString(boolean only_with_addresses) getOutboundProtocols(Core core) getRoute(InetAddress interface_address, InetAddress target, int max_millis, NetworkAdminRouteListener listener) getSingleHomedServiceBindAddress(int proto) Selects a bind address based on available host address and bind protocol familiesList<InetAddress[]> static NetworkAdminImplprivate StringgetString(InetAddress[] addresses) private StringgetString(List<InetAddress> addresses) private Set<Inet6Address> private Set<Inet6Address> protected InetAddressguessAddress(List<InetAddress> addresses) booleanbooleanbooleanbooleanhasIPV6Potential(boolean nio) booleanprivate voidinterfacesChanged(boolean first_time) booleanbooleanbooleanisRecentPublicIPAddress(InetAddress address) booleanprivate voidvoidlookupASN(InetAddress address) ad-hoc queryvoidlookupASN(InetAddress address, NetworkAdminASNListener listener) lookupCurrentASN(InetAddress address) Only call if the supplied address is believed to be the current public addressstatic voidprotected InetAddressmapAddressToBindIP(InetAddress address) private voidmaybeVPN(NetworkInterface intf) private booleanmaybeVPNDone(NetworkInterface intf) booleanmustBind()private List<InetAddress> parseAddresses(String str) private voidvoidresolveBindAddresses(String bind_to) Given an interface name etc this will return the corresponding ip addressesvoidrunInitialChecks(Core core) protected voidsetIPv6Enabled(boolean enabled, boolean start_of_day) private voidprivate voidtestProtocol(NetworkAdminProtocol protocol) private voidupdateRecentPublicAddresses(InetAddress address) Methods inherited from class NetworkAdmin
getNetworkInterfacesAsString, getSingleHomedServiceBindAddress, hasIPV6Potential
-
Field Details
-
singleton
-
LOGID
-
anyLocalAddressIPv4
-
anyLocalAddressIPv6
-
localhostV4
-
localhostV6
-
INTERFACE_CHECK_MILLIS
private static final int INTERFACE_CHECK_MILLIS- See Also:
-
ROUTE_CHECK_MILLIS
private static final int ROUTE_CHECK_MILLIS- See Also:
-
ROUTE_CHECK_TICKS
private static final int ROUTE_CHECK_TICKS- See Also:
-
temporary_ipv6_addresses
-
old_network_interfaces
-
address_history
-
address_history_update_time
private long address_history_update_time -
currentBindIPs
-
forceBind
private boolean forceBind -
supportsIPv6withNIO
private boolean supportsIPv6withNIO -
supportsIPv6
private boolean supportsIPv6 -
supportsIPv4
private boolean supportsIPv4 -
IPv6_enabled
private boolean IPv6_enabled -
preferIPv6
private boolean preferIPv6 -
ignore_v4
private volatile boolean ignore_v4 -
ignore_v6
private volatile boolean ignore_v6 -
ignore_v6_non_global
private volatile boolean ignore_v6_non_global -
ignore_v6_temporary
private volatile boolean ignore_v6_temporary -
additionalServiceBindIPs
-
testedIPv6Routing
private volatile boolean testedIPv6Routing -
roundRobinCounterV4
private int roundRobinCounterV4 -
roundRobinCounterV6
private int roundRobinCounterV6 -
logged_bind_force_issue
private boolean logged_bind_force_issue -
listeners
-
ASN_MIN_CHECK
private static final int ASN_MIN_CHECK- See Also:
-
last_asn_lookup_time
private long last_asn_lookup_time -
asn_ips_checked
-
as_history
-
async_dispatcher
-
async_asn_dispatcher
-
MAX_ASYNC_ASN_LOOKUPS
private static final int MAX_ASYNC_ASN_LOOKUPS- See Also:
-
async_asn_history
-
gdpa_lock
-
gdpa_sem
-
gdpa_last_fail
private long gdpa_last_fail -
gdpa_last_lookup
private long gdpa_last_lookup -
gdpa_initial_sem
-
gdpa6
-
gdpa6_count
private int gdpa6_count -
gdpa6_last_good
-
gdpa6_last_check
private long gdpa6_last_check -
gdpa6_checking
private boolean gdpa6_checking -
rpa_last_refresh
private volatile long rpa_last_refresh -
rpa_lock
-
rpa
-
DM_PAUSE_PENDING_KEY
- See Also:
-
last_getni_result
-
getni_lock
-
BS_INACTIVE
public static final int BS_INACTIVE- See Also:
-
BS_OK
public static final int BS_OK- See Also:
-
BS_WARNING
public static final int BS_WARNING- See Also:
-
BS_ERROR
public static final int BS_ERROR- See Also:
-
bs_lock
Object bs_lock -
bs_pending
boolean bs_pending -
bs_last_calc
long bs_last_calc -
bs_last_value
-
ipv6Pattern
-
-
Constructor Details
-
NetworkAdminImpl
public NetworkAdminImpl()
-
-
Method Details
-
getSingleton
-
setup
-
addKickAllPeerListener
-
removeKickAllPeerListener
-
checkDNSSPI
private void checkDNSSPI() -
setIPv6Enabled
protected void setIPv6Enabled(boolean enabled, boolean start_of_day) -
isIPV6Enabled
public boolean isIPV6Enabled()- Specified by:
isIPV6Enabledin classNetworkAdmin
-
checkNetworkInterfaces
protected boolean checkNetworkInterfaces(boolean first_time, boolean force) -
getMultiHomedOutgoingRoundRobinBindAddress
- Specified by:
getMultiHomedOutgoingRoundRobinBindAddressin classNetworkAdmin
-
setupAdditionalServiceBindIPs
-
getMultiHomedServiceBindAddresses
- Specified by:
getMultiHomedServiceBindAddressesin classNetworkAdmin
-
getSingleHomedServiceBindAddress
- Specified by:
getSingleHomedServiceBindAddressin classNetworkAdmin
-
getSingleHomedServiceBinding
public InetAddress[] getSingleHomedServiceBinding(String host) throws UnknownHostException, UnsupportedAddressTypeException Description copied from class:NetworkAdminSelects a bind address based on available host address and bind protocol families- Specified by:
getSingleHomedServiceBindingin classNetworkAdmin- Parameters:
host-- Returns:
- Array with 2 entries, first is selected host address, second is selected bind address (possibly null of course)
- Throws:
UnknownHostExceptionUnsupportedAddressTypeException
-
getSingleHomedServiceBindings
public List<InetAddress[]> getSingleHomedServiceBindings(String host) throws UnknownHostException, UnsupportedAddressTypeException - Specified by:
getSingleHomedServiceBindingsin classNetworkAdmin- Throws:
UnknownHostExceptionUnsupportedAddressTypeException
-
getAllBindAddresses
- Specified by:
getAllBindAddressesin classNetworkAdmin
-
resolveBindAddresses
Description copied from class:NetworkAdminGiven an interface name etc this will return the corresponding ip addresses- Specified by:
resolveBindAddressesin classNetworkAdmin- Parameters:
bind_to-- Returns:
-
parseAddresses
-
calcBindAddresses
-
checkBindAddresses
-
checkDefaultBindAddress
protected void checkDefaultBindAddress(boolean first_time) -
getNetworkInterfacesAsString
- Specified by:
getNetworkInterfacesAsStringin classNetworkAdmin
-
hasIPV4Potential
public boolean hasIPV4Potential()- Specified by:
hasIPV4Potentialin classNetworkAdmin
-
hasIPV6Potential
public boolean hasIPV6Potential(boolean nio) - Specified by:
hasIPV6Potentialin classNetworkAdmin
-
getLoopbackAddress
- Specified by:
getLoopbackAddressin classNetworkAdmin
-
getBindableAddresses
Description copied from class:NetworkAdminReturns the list of current addresses that can successfully be bound to with an ephemeral port- Specified by:
getBindableAddressesin classNetworkAdmin- Returns:
-
getBindableAddresses
-
canBind
-
getBindablePort
- Specified by:
getBindablePortin classNetworkAdmin- Throws:
IOException
-
bind
- Throws:
IOException
-
guessRoutableBindAddress
- Specified by:
guessRoutableBindAddressin classNetworkAdmin
-
getAlternativeProtocolBindAddress
- Specified by:
getAlternativeProtocolBindAddressin classNetworkAdmin
-
canConnectWithBind
-
mapAddressToBindIP
-
bytesToBits
protected boolean[] bytesToBits(byte[] bytes) -
guessAddress
-
interfacesChanged
private void interfacesChanged(boolean first_time) -
updateRecentPublicAddresses
-
loadRecentPublicIPs
private void loadRecentPublicIPs() -
isRecentPublicIPAddress
- Specified by:
isRecentPublicIPAddressin classNetworkAdmin
-
getDefaultPublicAddress
- Specified by:
getDefaultPublicAddressin classNetworkAdmin
-
getDefaultPublicAddress
- Specified by:
getDefaultPublicAddressin classNetworkAdmin
-
getDefaultPublicAddressV6
- Specified by:
getDefaultPublicAddressV6in classNetworkAdmin
-
hasDHTIPV4
public boolean hasDHTIPV4()- Specified by:
hasDHTIPV4in classNetworkAdmin
-
hasDHTIPV6
public boolean hasDHTIPV6()- Specified by:
hasDHTIPV6in classNetworkAdmin
-
firePropertyChange
-
getInterfaces
- Specified by:
getInterfacesin classNetworkAdmin
-
getOutboundProtocols
- Specified by:
getOutboundProtocolsin classNetworkAdmin
-
createInboundProtocol
- Specified by:
createInboundProtocolin classNetworkAdmin
-
getInboundProtocols
- Specified by:
getInboundProtocolsin classNetworkAdmin
-
testProtocol
- Specified by:
testProtocolin classNetworkAdmin- Throws:
NetworkAdminException
-
isSocksActive
public boolean isSocksActive()- Specified by:
isSocksActivein classNetworkAdmin
-
createSocksProxy
public NetworkAdminSocksProxy createSocksProxy(String host, int port, String username, String password) - Specified by:
createSocksProxyin classNetworkAdmin
-
getSocksProxies
- Specified by:
getSocksProxiesin classNetworkAdmin
-
getHTTPProxy
- Specified by:
getHTTPProxyin classNetworkAdmin
-
getNATDevices
- Specified by:
getNATDevicesin classNetworkAdmin
-
getCurrentASN
- Specified by:
getCurrentASNin classNetworkAdmin
-
ASNToMap
-
ASNFromMap
-
lookupCurrentASN
Description copied from class:NetworkAdminOnly call if the supplied address is believed to be the current public address- Specified by:
lookupCurrentASNin classNetworkAdmin- Parameters:
address-- Returns:
- Throws:
NetworkAdminException
-
lookupASN
Description copied from class:NetworkAdminad-hoc query- Specified by:
lookupASNin classNetworkAdmin- Parameters:
address-- Returns:
- Throws:
NetworkAdminException
-
lookupASN
- Specified by:
lookupASNin classNetworkAdmin
-
addToASHistory
-
getFromASHistory
-
runInitialChecks
- Specified by:
runInitialChecksin classNetworkAdmin
-
canTraceRoute
public boolean canTraceRoute()- Specified by:
canTraceRoutein classNetworkAdmin
-
getRoute
public NetworkAdminNode[] getRoute(InetAddress interface_address, InetAddress target, int max_millis, NetworkAdminRouteListener listener) throws NetworkAdminException - Throws:
NetworkAdminException
-
mustBind
public boolean mustBind()- Specified by:
mustBindin classNetworkAdmin
-
hasMissingForcedBind
public boolean hasMissingForcedBind()- Specified by:
hasMissingForcedBindin classNetworkAdmin
-
getBindStatus
- Specified by:
getBindStatusin classNetworkAdmin
-
getBindingStatus
-
getBindingStatusSupport
-
getString
-
checkConnectionRoutes
void checkConnectionRoutes() -
checkActiveConnections
void checkActiveConnections() -
checkIPV6Routing
void checkIPV6Routing() -
clearMaybeVPNs
void clearMaybeVPNs() -
maybeVPNDone
-
maybeVPN
-
getConfigKey
-
categoriseIntf
-
classifyRoute
- Specified by:
classifyRoutein classNetworkAdmin
-
getInterfaceForAddress
- Specified by:
getInterfaceForAddressin classNetworkAdmin- Parameters:
address-- Returns:
- { NetworkInterface, InetAddress (best intf address)}, {NetworkInterface} or {InetAddress (nomatch, same as arg)}
-
addPropertyChangeListener
- Specified by:
addPropertyChangeListenerin classNetworkAdmin
-
addAndFirePropertyChangeListener
- Specified by:
addAndFirePropertyChangeListenerin classNetworkAdmin
-
removePropertyChangeListener
- Specified by:
removePropertyChangeListenerin classNetworkAdmin
-
generate
- Specified by:
generatein interfaceAEDiagnosticsEvidenceGenerator
-
getString
-
generateDiagnostics
- Specified by:
generateDiagnosticsin classNetworkAdmin
-
generateDiagnostics
-
logNATStatus
- Specified by:
logNATStatusin classNetworkAdmin
-
filter
-
isIgnoredBindAddress
- Specified by:
isIgnoredBindAddressin classNetworkAdmin
-
getIgnoredTemporaryIPv6
- Specified by:
getIgnoredTemporaryIPv6in classNetworkAdmin
-
getTemporaryIPv6Addresses
-
getTemporaryIPv6AddressesSupport
-
extractIPv6
-
main
-