Transport, TimedWeightedPriorityMessageQueue.FailedListenerpublic class UDPTransport extends TransportImpl implements TimedWeightedPriorityMessageQueue.FailedListener
Transport.AddressSource| 修飾子とタイプ | フィールド | 説明 |
|---|---|---|
static int |
DEFAULT_COST |
|
static int |
DEFAULT_INTERNAL_PORT |
推奨されていません。
unused
|
static java.lang.String |
DEFAULT_SOURCES |
|
static int |
EXPIRE_TIMEOUT |
|
(package private) static long |
INTRODUCER_EXPIRATION_MARGIN |
|
static int |
MIN_EXPIRE_TIMEOUT |
|
static java.lang.String |
PROP_ALLOW_DIRECT |
do we allow direct SSU connections, sans introducers?
|
static java.lang.String |
PROP_BIND_INTERFACE |
this is rarely if ever used, default is to bind to wildcard address
|
static java.lang.String |
PROP_EXTERNAL_HOST |
define this to explicitly set an external IP address
|
static java.lang.String |
PROP_EXTERNAL_PORT |
define this to explicitly set an external port
|
static java.lang.String |
PROP_FORCE_INTRODUCERS |
do we require introducers, regardless of our status?
|
static java.lang.String |
PROP_INTERNAL_PORT |
|
static java.lang.String |
PROP_IP |
remember IP changes
|
static java.lang.String |
PROP_IP_CHANGE |
|
static java.lang.String |
PROP_LAPTOP_MODE |
|
static java.lang.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 java.lang.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 java.lang.String |
STYLE |
_context, _currentAddresses, ADJUST_COST, CONGESTION_COST_ADJUSTMENT| コンストラクタ | 説明 |
|---|---|
UDPTransport(RouterContext ctx,
DHSessionKeyBuilder.Factory dh) |
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
(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
|
(package private) void |
changePeerPort(PeerState peer,
int newPort) |
Remove and add to peersByRemoteHost map
|
int |
countActivePeers() |
How many peers are we currently connected to, that we have
sent a message to or received a message from in the last five minutes.
|
int |
countActiveSendPeers() |
How many peers are we currently connected to, that we have
sent a message to in the last minute.
|
int |
countPeers() |
How many peers are we connected to?
|
(package private) void |
dropPeer(Hash peer,
boolean shouldBanlist,
java.lang.String why) |
This does not send a session destroy, caller must do that if desired.
|
(package private) void |
dropPeer(PeerState peer,
boolean shouldBanlist,
java.lang.String why) |
This does not send a session destroy, caller must do that if desired.
|
(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(Transport.AddressSource source,
byte[] ip,
int port) |
From config, UPnP, local i/f, ...
|
void |
fail(UDPEndpoint endpoint) |
The endpoint has failed.
|
void |
failed(OutNetMessage msg,
java.lang.String reason) |
|
void |
failed(OutboundMessageState msg) |
|
(package private) void |
failed(OutboundMessageState msg,
boolean allowPeerFailure) |
|
void |
forwardPortStatus(byte[] ip,
int port,
int externalPort,
boolean success,
java.lang.String reason) |
Callback from UPnP.
|
java.util.Vector<java.lang.Long> |
getClockSkews() |
Return our peer clock skews on this transport.
|
(package private) DHSessionKeyBuilder |
getDHBuilder() |
|
(package private) DHSessionKeyBuilder.Factory |
getDHFactory() |
|
java.util.Set<Hash> |
getEstablished() |
Connected peers.
|
(package private) EstablishmentManager |
getEstablisher() |
For IntroductionManager
|
(package private) byte[] |
getExternalIP() |
IPv4 only
|
(package private) int |
getExternalPort(boolean ipv6) |
|
(package private) SessionKey |
getIntroKey() |
Introduction key that people should use to contact us
|
int |
getMTU(boolean ipv6) |
The MTU for the socket interface.
|
(package private) PacketHandler |
getPacketHandler() |
|
(package private) java.lang.String |
getPacketHandlerStatus() |
|
java.util.Collection<PeerState> |
getPeers() |
For /peers UI only.
|
(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) java.util.List<PeerState> |
getPeerStatesByIP(RemoteHostId hostInfo) |
Get the states for all peers at the given remote host, ignoring port.
|
CommSystemFacade.Status |
getReachabilityStatus() |
Previously returned short, now enum as of 0.9.20
|
int |
getRequestedPort() |
The current or configured internal IPv4 port.
|
java.lang.String |
getStyle() |
The unique identity of this Transport
|
(package private) RouterAddress |
getTargetAddress(RouterInfo target) |
Get first available address we can use.
|
(package private) boolean |
hasIPv6Address() |
For PeerTestManager
|
(package private) void |
inboundConnectionReceived(boolean isIPv6) |
|
(package private) boolean |
introducersMaybeRequired() |
MIGHT we require introducers?
This is like introducersRequired, but if we aren't sure, this returns true.
|
boolean |
introducersRequired() |
Do we require introducers?
|
boolean |
isBacklogged(Hash dest) |
|
boolean |
isEstablished(Hash dest) |
|
(package private) boolean |
isInDropList(RemoteHostId peer) |
|
(package private) boolean |
isTooClose(byte[] ip) |
Is this IP too close to ours to trust it for
things like relaying?
|
boolean |
isValid(byte[] addr) |
An IPv6 address is only valid if we are configured to support IPv6
AND we have a public IPv6 address.
|
void |
mayDisconnect(Hash peer) |
Tell the transport that we may disconnect from this peer.
|
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
Only used by NTCP.
|
(package private) PeerState |
pickTestPeer(PeerTestState.Role peerRole,
boolean isIPv6,
RemoteHostId dontInclude) |
Pick a Bob (if we are Alice) or a Charlie (if we are Bob).
|
void |
recheckReachability() |
推奨されていません。
unused
|
protected void |
removeAddress(boolean ipv6) |
Remove then tell NTCP that we changed.
|
protected void |
removeAddress(RouterAddress address) |
Remove then tell NTCP that we changed.
|
void |
renderStatusHTML(java.io.Writer out,
java.lang.String urlBase,
int sortFlags) |
推奨されていません。
as of 0.9.31
|
protected void |
replaceAddress(RouterAddress address) |
Replace then tell NTCP that we changed.
|
(package private) void |
send(java.util.List<I2NPMessage> msgs,
PeerState peer) |
"injected" messages from the EstablishmentManager.
|
(package private) void |
send(I2NPMessage msg,
java.util.List<OutNetMessage> msgs,
PeerState peer) |
"injected" message from the EstablishmentManager,
plus pending messages to send,
so the messages may be bundled efficiently.
|
(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.
|
(package private) void |
sendDestroy(PeerState peer) |
Send a session destroy message, bypassing OMF and PacketPusher.
|
(package private) void |
sendIfEstablished(OutNetMessage msg) |
Send only if established, otherwise fail immediately.
|
(package private) void |
setReachabilityStatus(CommSystemFacade.Status status,
boolean isIPv6) |
|
void |
shutdown() |
|
void |
startListening() |
|
void |
stopListening() |
|
void |
succeeded(OutboundMessageState msg) |
|
java.util.List<RouterAddress> |
updateAddress() |
Rebuild to get updated cost and introducers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait_t, _t, afterSend, afterSend, afterSend, afterSend, allowLocal, externalAddressRemoved, getCurrentAddress, getCurrentAddresses, getIP, getIPv6Config, getMaxConnections, getMostRecentErrorMessages, getNextMessage, getSavedLocalAddresses, getTargetAddresses, hasCurrentAddress, haveCapacity, haveCapacity, isIPv4Firewalled, isIPv6Firewalled, isPubliclyRoutable, isUnreachable, markReachable, markUnreachable, ngettext, renderStatusHTML, saveLocalAddress, setIP, setListener, wasUnreachablepublic static final java.lang.String STYLE
public static final java.lang.String PROP_INTERNAL_PORT
@Deprecated public static final int DEFAULT_INTERNAL_PORT
public static final java.lang.String PROP_EXTERNAL_HOST
public static final java.lang.String PROP_EXTERNAL_PORT
public static final java.lang.String PROP_PREFER_UDP
public static final java.lang.String PROP_SOURCES
public static final java.lang.String DEFAULT_SOURCES
public static final java.lang.String PROP_IP
public static final java.lang.String PROP_IP_CHANGE
public static final java.lang.String PROP_LAPTOP_MODE
public static final java.lang.String PROP_FORCE_INTRODUCERS
public static final java.lang.String PROP_ALLOW_DIRECT
public static final java.lang.String PROP_BIND_INTERFACE
public static final int PUBLIC_RELAY_COUNT
public static final int DEFAULT_COST
static final long[] RATES
static final long INTRODUCER_EXPIRATION_MARGIN
public static final int EXPIRE_TIMEOUT
public static final int MIN_EXPIRE_TIMEOUT
public UDPTransport(RouterContext ctx, DHSessionKeyBuilder.Factory dh)
public void shutdown()
public void fail(UDPEndpoint endpoint)
SessionKey getIntroKey()
int getExternalPort(boolean ipv6)
byte[] getExternalIP()
boolean hasIPv6Address()
boolean isTooClose(byte[] ip)
ip - IPv4 or IPv6public int getRequestedPort()
getRequestedPort インタフェース内 TransportgetRequestedPort クラス内 TransportImplpublic int getMTU(boolean ipv6)
void inboundConnectionReceived(boolean isIPv6)
public void externalAddressReceived(Transport.AddressSource source, byte[] ip, int port)
externalAddressReceived インタフェース内 TransportexternalAddressReceived クラス内 TransportImplsource - as defined in Transport.SOURCE_xxxip - publicly routable IPv4 or IPv6, null okport - 0 if unknownpublic void forwardPortStatus(byte[] ip,
int port,
int externalPort,
boolean success,
java.lang.String reason)
forwardPortStatus インタフェース内 TransportforwardPortStatus クラス内 TransportImplip - may be nullport - 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 null, returns falsePeerState getPeerState(RemoteHostId hostInfo)
java.util.List<PeerState> getPeerStatesByIP(RemoteHostId hostInfo)
PeerState getPeerState(Hash remotePeer)
public java.util.Collection<PeerState> getPeers()
public java.util.Set<Hash> getEstablished()
getEstablished インタフェース内 Transportvoid 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 クラス内 TransportImplinMsg - non-nullremoteIdent - may be nullremoteIdentHash - may be null, calculated from remoteIdent if nullboolean isInDropList(RemoteHostId peer)
void dropPeer(Hash peer, boolean shouldBanlist, java.lang.String why)
shouldBanlist - doesn't really, only sets unreachablevoid dropPeer(PeerState peer, boolean shouldBanlist, java.lang.String why)
shouldBanlist - doesn't really, only sets unreachablevoid send(UDPPacket packet)
void sendDestroy(PeerState peer)
public TransportBid bid(RouterInfo toAddress, long dataSize)
RouterAddress getTargetAddress(RouterInfo target)
public java.lang.String getStyle()
Transportpublic void send(OutNetMessage msg)
TransportImplsend インタフェース内 Transportsend クラス内 TransportImplvoid sendIfEstablished(OutNetMessage msg)
void send(I2NPMessage msg, PeerState peer)
peer - all messages MUST be going to this peervoid send(I2NPMessage msg, java.util.List<OutNetMessage> msgs, PeerState peer)
msg - may be null if nothing to injectmsgs - non-null, may be emptypeer - all messages MUST be going to this peervoid send(java.util.List<I2NPMessage> msgs, PeerState peer)
peer - all messages MUST be going to this peerprotected void outboundMessageReady()
TransportImploutboundMessageReady クラス内 TransportImplpublic void startListening()
startListening インタフェース内 Transportpublic void stopListening()
stopListening インタフェース内 Transportpublic java.util.List<RouterAddress> updateAddress()
updateAddress インタフェース内 TransportupdateAddress クラス内 TransportImplprotected void replaceAddress(RouterAddress address)
replaceAddress クラス内 TransportImpladdress - the new address or null to remove allprotected void removeAddress(RouterAddress address)
removeAddress クラス内 TransportImplprotected void removeAddress(boolean ipv6)
removeAddress クラス内 TransportImplipv6 - true to remove all IPv6 addresses, false to remove all IPv4 addressespublic boolean introducersRequired()
boolean introducersMaybeRequired()
boolean canIntroduce()
java.lang.String getPacketHandlerStatus()
PacketHandler getPacketHandler()
public void failed(OutboundMessageState msg)
void failed(OutboundMessageState msg, boolean allowPeerFailure)
public void failed(OutNetMessage msg, java.lang.String reason)
failed インタフェース内 TimedWeightedPriorityMessageQueue.FailedListenerpublic void succeeded(OutboundMessageState msg)
public int countPeers()
TransportImplcountPeers インタフェース内 TransportcountPeers クラス内 TransportImplpublic int countActivePeers()
TransportImplcountActivePeers インタフェース内 TransportcountActivePeers クラス内 TransportImplpublic int countActiveSendPeers()
TransportImplcountActiveSendPeers インタフェース内 TransportcountActiveSendPeers クラス内 TransportImplpublic boolean isEstablished(Hash dest)
isEstablished インタフェース内 TransportisEstablished クラス内 TransportImplpublic boolean isBacklogged(Hash dest)
isBacklogged インタフェース内 TransportisBacklogged クラス内 TransportImplpublic void mayDisconnect(Hash peer)
mayDisconnect インタフェース内 TransportmayDisconnect クラス内 TransportImplpublic boolean allowConnection()
public java.util.Vector<java.lang.Long> getClockSkews()
getClockSkews インタフェース内 TransportgetClockSkews クラス内 TransportImplDHSessionKeyBuilder getDHBuilder()
DHSessionKeyBuilder.Factory getDHFactory()
@Deprecated
public void renderStatusHTML(java.io.Writer out,
java.lang.String urlBase,
int sortFlags)
throws java.io.IOException
renderStatusHTML インタフェース内 TransportrenderStatusHTML クラス内 TransportImpljava.io.IOExceptionvoid setReachabilityStatus(CommSystemFacade.Status status, boolean isIPv6)
isIPv6 - Is the change an IPv6 change?public CommSystemFacade.Status getReachabilityStatus()
getReachabilityStatus インタフェース内 TransportgetReachabilityStatus クラス内 TransportImpl@Deprecated public void recheckReachability()
recheckReachability インタフェース内 TransportrecheckReachability クラス内 TransportImplPeerState pickTestPeer(PeerTestState.Role peerRole, boolean isIPv6, RemoteHostId dontInclude)
peerRole - The role of the peer we are looking for, BOB or CHARLIE only (NOT our role)isIPv6 - true to get a v6-capable peer backdontInclude - may be null