|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.TransportImpl
net.i2p.router.transport.udp.UDPTransport
public class UDPTransport
The SSU transport
Field Summary | |
---|---|
static int |
DEFAULT_COST
|
static int |
DEFAULT_INTERNAL_PORT
Deprecated. unused |
static String |
DEFAULT_SOURCES
|
static int |
EXPIRE_TIMEOUT
|
static int |
MIN_EXPIRE_TIMEOUT
|
(package private) static int |
MIN_PEER_PORT
To prevent trouble. |
static String |
PROP_ALLOW_DIRECT
do we allow direct SSU connections, sans introducers? |
static String |
PROP_BIND_INTERFACE
this is rarely if ever used, default is to bind to wildcard address |
static String |
PROP_EXTERNAL_HOST
define this to explicitly set an external IP address |
static String |
PROP_EXTERNAL_PORT
define this to explicitly set an external port |
static String |
PROP_FORCE_INTRODUCERS
do we require introducers, regardless of our status? |
static String |
PROP_INTERNAL_PORT
|
static String |
PROP_IP
remember IP changes |
static String |
PROP_IP_CHANGE
|
static String |
PROP_LAPTOP_MODE
|
static String |
PROP_PREFER_UDP
If i2np.udp.preferred is set to "always", the UDP bids will always be under the bid from the TCP transport - even if a TCP connection already exists. |
static String |
PROP_SOURCES
allowed sources of address updates |
static int |
PUBLIC_RELAY_COUNT
how many relays offered to us will we use at a time? |
(package private) static long[] |
RATES
|
static String |
STYLE
|
Fields inherited from class net.i2p.router.transport.TransportImpl |
---|
_context, ADJUST_COST |
Fields inherited from interface net.i2p.router.transport.Transport |
---|
SOURCE_CONFIG, SOURCE_INTERFACE, SOURCE_UPNP |
Constructor Summary | |
---|---|
UDPTransport(RouterContext ctx,
DHSessionKeyBuilder.Factory dh)
|
Method Summary | |
---|---|
(package private) boolean |
addRemotePeerState(PeerState peer)
add the peer info, returning true if it went in properly, false if it was rejected (causes include peer ident already connected, or no remote host info known |
boolean |
allowConnection()
|
TransportBid |
bid(RouterInfo toAddress,
long dataSize)
|
(package private) boolean |
canIntroduce()
For EstablishmentManager |
void |
changePeerPort(PeerState peer,
int newPort)
Remove and add to peersByRemoteHost map |
int |
countActivePeers()
How many peers active in the last few minutes? |
int |
countActiveSendPeers()
How many peers are we actively sending messages to (this minute) |
int |
countPeers()
How many peers are we connected to? For NTCP, this is the same as active, but SSU actually looks at idle time for countActivePeers() |
(package private) void |
dropPeer(Hash peer,
boolean shouldShitlist,
String why)
|
(package private) void |
dropPeer(PeerState peer,
boolean shouldShitlist,
String why)
|
(package private) void |
externalAddressReceived(Hash from,
byte[] ourIP,
int ourPort)
Someone we tried to contact gave us what they think our IP address is. |
void |
externalAddressReceived(String source,
byte[] ip,
int port)
From config, UPnP, local i/f, ... |
void |
failed(OutboundMessageState msg)
|
(package private) void |
failed(OutboundMessageState msg,
boolean allowPeerFailure)
|
void |
failed(OutNetMessage msg,
String reason)
|
void |
forwardPortStatus(int port,
int externalPort,
boolean success,
String reason)
Callback from UPnP. |
Vector<Long> |
getClockSkews()
Return our peer clock skews on this transport. |
(package private) DHSessionKeyBuilder |
getDHBuilder()
|
(package private) DHSessionKeyBuilder.Factory |
getDHFactory()
|
(package private) EstablishmentManager |
getEstablisher()
For IntroductionManager |
(package private) byte[] |
getExternalIP()
|
int |
getExternalPort()
|
(package private) SessionKey |
getIntroKey()
Introduction key that people should use to contact us |
InetAddress |
getLocalAddress()
|
int |
getLocalPort()
Deprecated. unused |
(package private) int |
getMTU()
The MTU for the socket interface. |
(package private) int |
getPacketHandlerCount()
|
(package private) String |
getPacketHandlerStatus()
|
(package private) PeerState |
getPeerState(Hash remotePeer)
get the state for the peer with the given ident, or null if no state exists |
(package private) PeerState |
getPeerState(RemoteHostId hostInfo)
get the state for the peer at the given remote host/port, or null if no state exists |
(package private) List<PeerState> |
getPeerStatesByIP(RemoteHostId hostInfo)
Get the states for all peers at the given remote host, ignoring port. |
short |
getReachabilityStatus()
|
int |
getRequestedPort()
_externalListenPort should always be set (by startup()) before this is called, so the returned value should be > 0 |
String |
getStyle()
|
(package private) void |
inboundConnectionReceived()
|
boolean |
introducersRequired()
|
boolean |
isBacklogged(Hash dest)
|
boolean |
isEstablished(Hash dest)
|
(package private) boolean |
isInDropList(RemoteHostId peer)
|
boolean |
isValid(byte[] addr)
|
void |
messageReceived(I2NPMessage inMsg,
RouterIdentity remoteIdent,
Hash remoteIdentHash,
long msToReceive,
int bytesReceived)
infinite loop public RouterAddress getCurrentAddress() { if (needsRebuild()) rebuildExternalAddress(false); return super.getCurrentAddress(); } |
protected void |
outboundMessageReady()
This message is called whenever a new message is added to the send pool, and it should not block |
(package private) PeerState |
pickTestPeer(RemoteHostId dontInclude)
|
void |
recheckReachability()
|
void |
renderStatusHTML(Writer out,
String urlBase,
int sortFlags)
|
protected void |
replaceAddress(RouterAddress address)
Replace then tell NTCP that we changed. |
protected void |
replaceAddress(RouterAddress address,
RouterAddress oldAddress)
|
(package private) void |
send(I2NPMessage msg,
PeerState peer)
"injected" message from the EstablishmentManager |
void |
send(OutNetMessage msg)
Asynchronously send the message as requested in the message and, if the send is successful, queue up any msg.getOnSendJob job, and register it with the OutboundMessageRegistry (if it has a reply selector). |
(package private) void |
send(UDPPacket packet)
This sends it directly out, bypassing OutboundMessageFragments and the PacketPusher. |
(package private) void |
sendIfEstablished(OutNetMessage msg)
Send only if established, otherwise fail immediately. |
(package private) void |
setReachabilityStatus(short status)
|
void |
shutdown()
|
RouterAddress |
startListening()
|
void |
startup()
|
void |
stopListening()
|
void |
succeeded(OutboundMessageState msg)
|
RouterAddress |
updateAddress()
Rebuild to get updated cost and introducers. |
Methods inherited from class net.i2p.router.transport.TransportImpl |
---|
afterSend, afterSend, afterSend, afterSend, getContext, getCurrentAddress, getIP, getMaxConnections, getMostRecentErrorMessages, getNextMessage, haveCapacity, haveCapacity, isPubliclyRoutable, isUnreachable, markReachable, markUnreachable, markWasUnreachable, renderStatusHTML, setIP, setListener, wasUnreachable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String STYLE
public static final String PROP_INTERNAL_PORT
public static final int DEFAULT_INTERNAL_PORT
static final int MIN_PEER_PORT
public static final String PROP_EXTERNAL_HOST
public static final String PROP_EXTERNAL_PORT
public static final String PROP_PREFER_UDP
public static final String PROP_SOURCES
public static final String DEFAULT_SOURCES
public static final String PROP_IP
public static final String PROP_IP_CHANGE
public static final String PROP_LAPTOP_MODE
public static final String PROP_FORCE_INTRODUCERS
public static final String PROP_ALLOW_DIRECT
public static final String PROP_BIND_INTERFACE
public static final int PUBLIC_RELAY_COUNT
public static final int DEFAULT_COST
static final long[] RATES
public static final int EXPIRE_TIMEOUT
public static final int MIN_EXPIRE_TIMEOUT
Constructor Detail |
---|
public UDPTransport(RouterContext ctx, DHSessionKeyBuilder.Factory dh)
Method Detail |
---|
public void startup()
public void shutdown()
SessionKey getIntroKey()
public int getLocalPort()
public InetAddress getLocalAddress()
public int getExternalPort()
byte[] getExternalIP()
public int getRequestedPort()
getRequestedPort
in interface Transport
getRequestedPort
in class TransportImpl
int getMTU()
void inboundConnectionReceived()
public void externalAddressReceived(String source, byte[] ip, int port)
externalAddressReceived
in interface Transport
externalAddressReceived
in class TransportImpl
source
- used for logging onlyip
- publicly routable IPv4 onlyport
- 0 if unknownpublic void forwardPortStatus(int port, int externalPort, boolean success, String reason)
forwardPortStatus
in interface Transport
forwardPortStatus
in class TransportImpl
port
- the internal portexternalPort
- the external port, which for now should always be the same as
the internal port if the forwarding was successful.void externalAddressReceived(Hash from, byte[] ourIP, int ourPort)
from
- Hash of inbound destinationourIP
- publicly routable IPv4 onlyourPort
- >= 1024public final boolean isValid(byte[] addr)
addr
- may be nullPeerState getPeerState(RemoteHostId hostInfo)
List<PeerState> getPeerStatesByIP(RemoteHostId hostInfo)
PeerState getPeerState(Hash remotePeer)
public void changePeerPort(PeerState peer, int newPort)
EstablishmentManager getEstablisher()
boolean addRemotePeerState(PeerState peer)
public void messageReceived(I2NPMessage inMsg, RouterIdentity remoteIdent, Hash remoteIdentHash, long msToReceive, int bytesReceived)
messageReceived
in class TransportImpl
boolean isInDropList(RemoteHostId peer)
void dropPeer(Hash peer, boolean shouldShitlist, String why)
void dropPeer(PeerState peer, boolean shouldShitlist, String why)
void send(UDPPacket packet)
public TransportBid bid(RouterInfo toAddress, long dataSize)
bid
in interface Transport
public String getStyle()
getStyle
in interface Transport
public void send(OutNetMessage msg)
TransportImpl
send
in interface Transport
send
in class TransportImpl
void sendIfEstablished(OutNetMessage msg)
void send(I2NPMessage msg, PeerState peer)
protected void outboundMessageReady()
TransportImpl
outboundMessageReady
in class TransportImpl
public RouterAddress startListening()
startListening
in interface Transport
public void stopListening()
stopListening
in interface Transport
public RouterAddress updateAddress()
updateAddress
in interface Transport
updateAddress
in class TransportImpl
protected void replaceAddress(RouterAddress address)
replaceAddress
in class TransportImpl
protected void replaceAddress(RouterAddress address, RouterAddress oldAddress)
public boolean introducersRequired()
boolean canIntroduce()
String getPacketHandlerStatus()
int getPacketHandlerCount()
public void failed(OutboundMessageState msg)
void failed(OutboundMessageState msg, boolean allowPeerFailure)
public void failed(OutNetMessage msg, String reason)
failed
in interface TimedWeightedPriorityMessageQueue.FailedListener
public void succeeded(OutboundMessageState msg)
public int countPeers()
TransportImpl
countPeers
in interface Transport
countPeers
in class TransportImpl
public int countActivePeers()
TransportImpl
countActivePeers
in interface Transport
countActivePeers
in class TransportImpl
public int countActiveSendPeers()
TransportImpl
countActiveSendPeers
in interface Transport
countActiveSendPeers
in class TransportImpl
public boolean isEstablished(Hash dest)
isEstablished
in interface Transport
isEstablished
in class TransportImpl
public boolean isBacklogged(Hash dest)
isBacklogged
in interface Transport
isBacklogged
in class TransportImpl
public boolean allowConnection()
public Vector<Long> getClockSkews()
getClockSkews
in interface Transport
getClockSkews
in class TransportImpl
DHSessionKeyBuilder getDHBuilder()
DHSessionKeyBuilder.Factory getDHFactory()
public void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException
renderStatusHTML
in interface Transport
renderStatusHTML
in class TransportImpl
IOException
void setReachabilityStatus(short status)
public short getReachabilityStatus()
getReachabilityStatus
in interface Transport
getReachabilityStatus
in class TransportImpl
public void recheckReachability()
recheckReachability
in interface Transport
recheckReachability
in class TransportImpl
PeerState pickTestPeer(RemoteHostId dontInclude)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |