public class Bindings extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Bindings.Protocol
Types of protocols.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT
The default port of TomP2P.
|
static int |
MAX_PORT
The number of maximum ports, 2^16.
|
static int |
MIN_DYN_PORT
IANA recommends to use ports higher than 49152.
|
Constructor and Description |
---|
Bindings()
Creates a binding class that binds to everything.
|
Bindings(Bindings.Protocol protocol)
Creates a Binding class that binds to a specified protocol.
|
Bindings(Bindings.Protocol protocol,
InetAddress externalAddress,
int externalTCPPort,
int externalUDPPort)
Creates a Binding class that binds to a specified protocol and provides
information about manual port forwarding.
|
Bindings(Bindings.Protocol protocol,
String iface)
Creates a Binding class that binds to a specified protocol and interface.
|
Bindings(Bindings.Protocol protocol,
String iface,
InetAddress bind)
Creates a Binding class that binds to a specified protocol and interface
and address.
|
Bindings(InetAddress bind)
Creates a binding class that binds to a specified address.
|
Bindings(InetAddress externalAddress,
int externalTCPPort,
int externalUDPPort)
Creates a Binding class that binds to everything and provides information
about manual port forwarding.
|
Bindings(String iface)
Creates a Binding class that binds to a specified interface.
|
Modifier and Type | Method and Description |
---|---|
Bindings |
add(Bindings other)
Adds the results from an other binding.
|
Bindings |
addAddress(InetAddress address)
Adds an address that we want to listen to.
|
Bindings |
addInterface(String interfaceHint)
Adds an interface that will be searched for.
|
void |
clear()
Clears all lists: listenInterfaceHints, listenAddresses,
broadcastAddresses.
|
boolean |
containsInterface(String name)
Checks if the user provided an interface hint.
|
List<InetAddress> |
getAddresses() |
List<InetAddress> |
getBroadcastAddresses() |
InetAddress |
getExternalAddress() |
List<InetAddress> |
getFoundAddresses()
Returns a list of InetAddresses to listen to.
|
List<String> |
getInterfaces() |
int |
getOutsideTCPPort() |
int |
getOutsideUDPPort() |
Bindings.Protocol |
getProtocol() |
boolean |
isAllAddresses() |
boolean |
isAllInterfaces() |
boolean |
isAllProtocols() |
boolean |
isExternalAddress() |
boolean |
isIPv4() |
boolean |
isIPv6() |
boolean |
isListenAll() |
boolean |
isSetExternalPortsManually() |
public static final int MAX_PORT
public static final int MIN_DYN_PORT
public static final int DEFAULT_PORT
public Bindings()
public Bindings(InetAddress bind)
bind
- the address to bind topublic Bindings(String iface)
iface
- The interface to bind topublic Bindings(Bindings.Protocol protocol)
protocol
- The protocol to bind topublic Bindings(Bindings.Protocol protocol, String iface)
protocol
- The protocol to bind toiface
- The interface to bind topublic Bindings(Bindings.Protocol protocol, String iface, InetAddress bind)
protocol
- The protocol to bind toiface
- The interface to bind tobind
- The address to bind topublic Bindings(InetAddress externalAddress, int externalTCPPort, int externalUDPPort)
externalAddress
- The external address, how other peers will see usexternalTCPPort
- The external port, how other peers will see usexternalUDPPort
- The external port, how other peers will see uspublic Bindings(Bindings.Protocol protocol, InetAddress externalAddress, int externalTCPPort, int externalUDPPort)
protocol
- The protocol to bind toexternalAddress
- The external address, how other peers will see us. Use null if
you don't want to use external addressexternalTCPPort
- The external port, how other peers will see us, if 0 is
provided, a random port will be usedexternalUDPPort
- The external port, how other peers will see us, if 0 is
provided, a random port will be usedpublic List<InetAddress> getFoundAddresses()
public Bindings addAddress(InetAddress address)
address
- The current classpublic List<InetAddress> getAddresses()
public List<InetAddress> getBroadcastAddresses()
public Bindings addInterface(String interfaceHint)
interfaceHint
- The interface, e.g. eth0public Bindings.Protocol getProtocol()
public void clear()
public boolean isAllAddresses()
public boolean isAllInterfaces()
public boolean isAllProtocols()
public boolean isIPv4()
public boolean isIPv6()
public boolean isListenAll()
public boolean containsInterface(String name)
name
- The name of the interface reported by the systempublic boolean isExternalAddress()
public InetAddress getExternalAddress()
public int getOutsideTCPPort()
public int getOutsideUDPPort()
public Bindings add(Bindings other)
other
- The other instance to get the results frompublic boolean isSetExternalPortsManually()
Copyright © 2013. All Rights Reserved.