Transport
public class NTCPTransport extends TransportImpl
Transport.AddressSource
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static int |
DEFAULT_COST |
|
static int |
ESTABLISH_TIMEOUT |
how long from initial connection attempt (accept() or connect()) until
the con must be established to avoid premature close()ing
|
static java.lang.String |
MIN_SIGTYPE_VERSION |
RI sigtypes supported in 0.9.16
|
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_I2NP_NTCP_AUTO_IP |
|
static java.lang.String |
PROP_I2NP_NTCP_AUTO_PORT |
|
static java.lang.String |
PROP_I2NP_NTCP_HOSTNAME |
|
static java.lang.String |
PROP_I2NP_NTCP_PORT |
|
static java.lang.String |
STYLE |
_context, _currentAddresses, ADJUST_COST, CONGESTION_COST_ADJUSTMENT
コンストラクタ | 説明 |
---|---|
NTCPTransport(RouterContext ctx,
DHSessionKeyBuilder.Factory dh) |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
afterSend(OutNetMessage msg,
boolean sendSuccessful,
boolean allowRequeue,
long msToSend) |
The transport is done sending this message.
|
boolean |
allowConnection() |
|
TransportBid |
bid(RouterInfo toAddress,
long dataSize) |
|
int |
countActivePeers() |
How many peers have we talked to in the last 5 minutes?
As of 0.9.20, actually returns active peer count, not total.
|
int |
countActiveSendPeers() |
How many peers are we actively sending messages to (this minute)
|
int |
countPeers() |
How many peers are we connected to?
|
(package private) void |
establishing(NTCPConnection con) |
add us to the establishment timeout process
|
(package private) void |
expireTimedOut() |
called in the EventPumper no more than once a second or so, closing
any unconnected/unestablished connections
|
void |
externalAddressReceived(Transport.AddressSource source,
byte[] ip,
int port) |
UDP changed addresses, tell NTCP and (possibly) restart
|
void |
externalAddressRemoved(Transport.AddressSource source,
boolean ipv6) |
Notify a transport of an external address change.
|
void |
forwardPortStatus(byte[] ip,
int port,
int externalPort,
boolean success,
java.lang.String reason) |
If we didn't used to be forwarded, and we have an address,
and we are configured to use UPnP, update our RouterAddress
Don't do anything now.
|
java.util.Vector<java.lang.Long> |
getClockSkews() |
Return our peer clock skews on this transport.
|
(package private) DHSessionKeyBuilder |
getDHBuilder() |
|
java.util.Collection<NTCPConnection> |
getPeers() |
For /peers UI only.
|
(package private) EventPumper |
getPumper() |
Hook for NTCPConnection
|
CommSystemFacade.Status |
getReachabilityStatus() |
Maybe we should trust UPnP here and report OK if it opened the port, but
for now we don't.
|
(package private) Reader |
getReader() |
Hook for NTCPConnection
|
int |
getRequestedPort() |
What INTERNAL port would the transport like to have forwarded by UPnP.
|
java.lang.String |
getStyle() |
The unique identity of this Transport
|
(package private) Writer |
getWriter() |
Hook for NTCPConnection
|
(package private) NTCPConnection |
inboundEstablished(NTCPConnection con) |
|
boolean |
isAlive() |
|
boolean |
isBacklogged(Hash dest) |
|
boolean |
isEstablished(Hash dest) |
|
(package private) boolean |
isHXHIValid(byte[] hxhi) |
Incoming connection replay detection.
|
void |
mayDisconnect(Hash peer) |
Tell the transport that we may disconnect from this peer.
|
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) NTCPConnection |
removeCon(NTCPConnection con) |
|
void |
renderStatusHTML(java.io.Writer out,
int sortFlags) |
|
void |
renderStatusHTML(java.io.Writer out,
java.lang.String urlBase,
int sortFlags) |
推奨されていません。
as of 0.9.31
|
(package private) void |
returnUnused(DHSessionKeyBuilder builder) |
Return an unused DH key builder
to be put back onto the queue for reuse.
|
(package private) void |
sendComplete(OutNetMessage msg) |
queue up afterSend call, which can take some time w/ jobs, etc
|
(package private) void |
setLastBadSkew(long skew) |
A positive number means our clock is ahead of theirs.
|
void |
startListening() |
Called by TransportManager.
|
void |
stopListening() |
This doesn't (completely) block, caller should check isAlive()
before calling startListening() or restartListening()
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
_t, _t, afterSend, afterSend, afterSend, allowLocal, getCurrentAddress, getCurrentAddresses, getIP, getIPv6Config, getMaxConnections, getMostRecentErrorMessages, getNextMessage, getSavedLocalAddresses, getTargetAddresses, hasCurrentAddress, haveCapacity, haveCapacity, isIPv4Firewalled, isIPv6Firewalled, isPubliclyRoutable, isUnreachable, markReachable, markUnreachable, messageReceived, ngettext, recheckReachability, removeAddress, removeAddress, renderStatusHTML, replaceAddress, saveLocalAddress, send, setIP, setListener, updateAddress, wasUnreachable
public static final java.lang.String PROP_I2NP_NTCP_HOSTNAME
public static final java.lang.String PROP_I2NP_NTCP_PORT
public static final java.lang.String PROP_I2NP_NTCP_AUTO_PORT
public static final java.lang.String PROP_I2NP_NTCP_AUTO_IP
public static final int DEFAULT_COST
public static final java.lang.String PROP_BIND_INTERFACE
public static final java.lang.String MIN_SIGTYPE_VERSION
public static final int ESTABLISH_TIMEOUT
public static final java.lang.String STYLE
public NTCPTransport(RouterContext ctx, DHSessionKeyBuilder.Factory dh)
NTCPConnection inboundEstablished(NTCPConnection con)
con
- that is establishedprotected void outboundMessageReady()
TransportImpl
outboundMessageReady
クラス内 TransportImpl
public void afterSend(OutNetMessage msg, boolean sendSuccessful, boolean allowRequeue, long msToSend)
TransportImpl
afterSend
クラス内 TransportImpl
msg
- message in questionsendSuccessful
- true if the peer received itallowRequeue
- true if we should try other transports if availablemsToSend
- how long it took to transfer the data to the peerpublic TransportBid bid(RouterInfo toAddress, long dataSize)
public boolean allowConnection()
void sendComplete(OutNetMessage msg)
public boolean isEstablished(Hash dest)
isEstablished
インタフェース内 Transport
isEstablished
クラス内 TransportImpl
public boolean isBacklogged(Hash dest)
isBacklogged
インタフェース内 Transport
isBacklogged
クラス内 TransportImpl
public void mayDisconnect(Hash peer)
mayDisconnect
インタフェース内 Transport
mayDisconnect
クラス内 TransportImpl
NTCPConnection removeCon(NTCPConnection con)
public int countPeers()
TransportImpl
countPeers
インタフェース内 Transport
countPeers
クラス内 TransportImpl
public java.util.Collection<NTCPConnection> getPeers()
public int countActivePeers()
countActivePeers
インタフェース内 Transport
countActivePeers
クラス内 TransportImpl
public int countActiveSendPeers()
countActiveSendPeers
インタフェース内 Transport
countActiveSendPeers
クラス内 TransportImpl
void setLastBadSkew(long skew)
skew
- in secondspublic java.util.Vector<java.lang.Long> getClockSkews()
getClockSkews
インタフェース内 Transport
getClockSkews
クラス内 TransportImpl
boolean isHXHIValid(byte[] hxhi)
hxhi
- 32 bytespublic void startListening()
public boolean isAlive()
Reader getReader()
Writer getWriter()
public java.lang.String getStyle()
Transport
EventPumper getPumper()
DHSessionKeyBuilder getDHBuilder()
void returnUnused(DHSessionKeyBuilder builder)
builder
- must not have a peerPublicValue setvoid establishing(NTCPConnection con)
void expireTimedOut()
public void externalAddressReceived(Transport.AddressSource source, byte[] ip, int port)
externalAddressReceived
インタフェース内 Transport
externalAddressReceived
クラス内 TransportImpl
ip
- typ. IPv4 or IPv6 non-local; may be null to indicate IPv4 failure or port info onlysource
- defined in Transport.javaport
- 0 for unknown or unchangedpublic void externalAddressRemoved(Transport.AddressSource source, boolean ipv6)
externalAddressRemoved
インタフェース内 Transport
externalAddressRemoved
クラス内 TransportImpl
source
- defined in Transport.javapublic void forwardPortStatus(byte[] ip, int port, int externalPort, boolean success, java.lang.String reason)
forwardPortStatus
インタフェース内 Transport
forwardPortStatus
クラス内 TransportImpl
ip
- 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.public int getRequestedPort()
TransportImpl
getRequestedPort
インタフェース内 Transport
getRequestedPort
クラス内 TransportImpl
public CommSystemFacade.Status getReachabilityStatus()
getReachabilityStatus
インタフェース内 Transport
getReachabilityStatus
クラス内 TransportImpl
public void stopListening()
public void renderStatusHTML(java.io.Writer out, int sortFlags) throws java.io.IOException
java.io.IOException
@Deprecated public void renderStatusHTML(java.io.Writer out, java.lang.String urlBase, int sortFlags) throws java.io.IOException
renderStatusHTML
インタフェース内 Transport
renderStatusHTML
クラス内 TransportImpl
java.io.IOException