Packages that use I2PSocket
Package
Description
API, interfaces, and factory for a TCP-like (reliable, authenticated, in order) set of sockets for communicating over IP-like (unreliable, unauthenticated, unordered) I2P messages.
Implementation of a TCP-like (reliable, authenticated, in order) set of sockets for communicating over the IP-like (unreliable, unauthenticated, unordered) I2P messages.
Implementation of preconfigured tunnels for clients and servers, including special-purpose tunnels for IRC, SOCKS, HTTP and streaming.
IRC tunnel support: DCC and CTCP handling for IRC clients using a client tunnel.
SOCKS 4, 4a and 5 server implementations exposing I2P client tunnels to SOCKS clients.
The SAM bridge: a simple text protocol server letting applications in any language use I2P streaming and datagram sessions without implementing the Invisible Internet Client Protocol (I2CP).
I2P version of the Snark BitTorrent client, enhanced for I2P: peers are I2P destinations, torrents can be served anonymously as hidden services, and metadata carries I2P-specific comment fields.
Uses of I2PSocket in net.i2p.client.streaming
Fields in net.i2p.client.streaming declared as I2PSocketModifier and TypeFieldDescriptionprivate I2PSocketI2PSocketEepGet._socketThis replaces _proxy in the superclass.Methods in net.i2p.client.streaming that return I2PSocketModifier and TypeMethodDescriptionprotected abstract I2PSocketAcceptingChannel.accept()Accept an incoming connection.I2PServerSocket.accept()Waits for the next socket connecting.I2PSocketManager.connect(Destination peer) Create a new connected socket (block until the socket is created).I2PSocketManager.connect(Destination peer, I2PSocketOptions options) Create a new connected socket (block until the socket is created).Methods in net.i2p.client.streaming that return types with arguments of type I2PSocketModifier and TypeMethodDescriptionI2PSocketManager.listSockets()Retrieve a set of currently connected I2PSockets, either initiated locally or remotely.Uses of I2PSocket in net.i2p.client.streaming.impl
Classes in net.i2p.client.streaming.impl that implement I2PSocketModifier and TypeClassDescription(package private) classBridge between the full streaming lib and the I2PSocket API.Fields in net.i2p.client.streaming.impl declared as I2PSocketModifier and TypeFieldDescriptionprivate final I2PSocketStandardSocket._socketThe streaming socket being wrapped.Methods in net.i2p.client.streaming.impl that return I2PSocketModifier and TypeMethodDescriptionI2PServerSocketFull.accept()Waits for the next socket connecting.I2PSocketManagerFull.connect(Destination peer) Create a new connected socket.I2PSocketManagerFull.connect(Destination peer, I2PSocketOptions options) Create a new connected socket.I2PSocketManagerFull.receiveSocket()The accept() call.Methods in net.i2p.client.streaming.impl that return types with arguments of type I2PSocketModifier and TypeMethodDescriptionI2PSocketManagerFull.listSockets()Retrieve a set of currently connected I2PSockets, either initiated locally or remotely.Constructors in net.i2p.client.streaming.impl with parameters of type I2PSocketModifierConstructorDescription(package private)StandardSocket(I2PSocket socket) Wraps an I2PSocket in a java.net.Socket.Uses of I2PSocket in net.i2p.i2ptunnel
Fields in net.i2p.i2ptunnel declared as I2PSocketModifier and TypeFieldDescriptionprivate final I2PSocketI2PTunnelHTTPServer.CompressedRequestor._browserThe browser's I2P socket.private final I2PSocketI2PTunnelServer.Handler._i2psThe I2P socket being served.private I2PSocketI2PTunnelHTTPClient.WarmSlot._sockThe socket currently in use, null until connected.private I2PSocketI2PTunnelRunner.i2psI2P socket (the tunnel connection).private final I2PSocketI2PTunnelHTTPClientRunner.I2PSocketCloser.sThe socket to close.(package private) final I2PSocketI2PTunnelRunner.RaceWin.sockThe socket that won the race, and so holds the connection the caller must use.Fields in net.i2p.i2ptunnel with type parameters of type I2PSocketModifier and TypeFieldDescriptionI2PTunnelClientBase.mySocketsList of active sockets.I2PTunnelRunner.sockListThe I2P sockets this session opened.Methods in net.i2p.i2ptunnel that return I2PSocketModifier and TypeMethodDescriptionI2PTunnelClientBase.createI2PSocket(Destination dest) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.I2PTunnelClientBase.createI2PSocket(Destination dest, int port) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.I2PTunnelClientBase.createI2PSocket(Destination dest, I2PSocketOptions opt) Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel.(package private) I2PSocketI2PTunnelClientBase.createI2PSocket(Destination dest, I2PSocketOptions opt, long deadlineMs) Create a new I2PSocket bounded by a shared request deadline.private I2PSocketI2PTunnelClientBase.createI2PSocketWithFailover(Destination dest, I2PSocketOptions opt, long deadlineMs) Create a new I2PSocket with retry/failover across the session's tunnel pool.private I2PSocketI2PTunnelHTTPClient.openEmptyReconnect(Destination dest, int port, int emptyBudget, long requestId, boolean quiet) Open a single fresh I2P socket for an empty-response / body-resume reconnect, with the standard attempt budget and dead-pool fail-fast.Supply the connection an empty or truncated response is retried on.default I2PSocket[]I2PTunnelRunner.ReconnectCallback.reconnectPair(Exception cause) Open one or two sockets for an empty-response retry.(package private) I2PSocketTake an installed socket for the request.Methods in net.i2p.i2ptunnel with parameters of type I2PSocketModifier and TypeMethodDescriptionprivate voidI2PTunnelHTTPServer.applySpoofedHost(I2PSocket socket, Map<String, List<String>> headers, Properties opts) Apply port-specific spoofed host header.protected voidI2PTunnelHTTPServer.blockingHandle(I2PSocket socket) Called by the thread pool of I2PSocket handlers.protected voidI2PTunnelIRCServer.blockingHandle(I2PSocket socket) Register one incoming IRC client connection, blocking until it closes.protected voidI2PTunnelServer.blockingHandle(I2PSocket socket) This is run in a thread from a limited-size thread pool viaHandler.run(), except for a standard server (this class, no extension, as determined in getUsePool()), it is run directly in the acceptor thread (see run()).protected voidI2PTunnelHTTPClientRunner.close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin, Socket s, I2PSocket i2ps, Thread t1, Thread t2) Closes all streams and sockets, respecting keep-alive settings.protected voidI2PTunnelRunner.close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin, Socket s, I2PSocket i2ps, Thread t1, Thread t2) Warning - overridden inI2PTunnelHTTPClientRunner.private static voidI2PTunnelHTTPClient.closeQuietly(I2PSocket sock) Closes a socket, ignoring any error.private static voidI2PTunnelRunner.closeQuietly(I2PSocket sock) Closes a socket, ignoring any error.private static voidI2PTunnelServer.closeSilently(I2PSocket s) Close an I2P socket silently, ignoring any exceptions.private static StringI2PTunnelIRCServer.filterRegistration(I2PSocket socket, String newHostname) Keep reading until we see USER or SERVER.private booleanI2PTunnelHTTPServer.handlePort443(I2PSocket socket) Handle port 443 (SSL passthrough).(package private) booleanInstall the socket produced by the attempt forgen.(package private) booleanI2PTunnelHTTPServer.isInproxyRejection(Map<String, List<String>> headers, I2PSocket socket, String peerB32, Properties opts) Reject requests that contain forwarded-for headers (inproxy detection).(package private) booleanI2PTunnelHTTPServer.isPostThrottled(StringBuilder command, Hash peerHash, I2PSocket socket, String peerB32) Check POST/PUT throttling for this peer.(package private) booleanI2PTunnelHTTPServer.isRefererRejection(Map<String, List<String>> headers, I2PSocket socket, String peerB32, Properties opts) Reject requests with absolute Referer URIs.(package private) booleanI2PTunnelHTTPServer.isUserAgentRejection(Map<String, List<String>> headers, I2PSocket socket, String peerB32, Properties opts) Reject requests with blacklisted User-Agent strings.(package private) static InputStreamI2PTunnelRunner.pickRedriveStream(InputStream supplied, I2PSocket sock) Choose the stream a re-driven receive forwarder reads from.private voidI2PTunnelHTTPServer.processBlocklist(I2PSocket socket, StringBuilder command) Check the request command against the HTTP blocklist.(package private) I2PTunnelRunner.RaceWinI2PTunnelRunner.raceEmptyPair(I2PSocket[] pair, byte[] request) Race two freshly connected sockets for an empty-response retry: write the buffered request to both, then the first socket to deliver a non-EOF byte wins.I2PTunnelHTTPServer.readHeaders(I2PSocket socket, InputStream in, StringBuilder command, String[] skipHeaders, I2PAppContext ctx, long initialTimeout) Read headers from the input stream, using an array of skip headers.I2PTunnelHTTPServer.readHeaders(I2PSocket socket, InputStream in, StringBuilder command, Set<String> skipHeaders, I2PAppContext ctx, long initialTimeout) From I2P to server: socket non-null, in null.I2PTunnelHTTPServer.readHeadersInternal(I2PSocket socket, InputStream in, StringBuilder command, Set<String> skipHeaders, I2PAppContext ctx, long initialTimeout) Read and parse HTTP headers, filtering out specified headers and enforcing size limits.private static voidI2PTunnelHTTPServer.readLine(I2PSocket socket, StringBuilder buf, long timeout) Read a line terminated by newline, with a total read timeout.private static StringRead a line terminated by newline, with a total read timeout.I2PTunnelHTTPServer.readRequestHeaders(I2PSocket socket, StringBuilder command, int requestCount, String peerB32, I2PAppContext ctx, Log log, String tunnelId) Read the request headers with the default timeouts.I2PTunnelHTTPServer.readRequestHeaders(I2PSocket socket, StringBuilder command, int requestCount, String peerB32, I2PAppContext ctx, Log log, String tunnelId, long headerTimeout, long keepAliveTimeout) Read the request headers, handling the specific errors that can occur by sending the appropriate error response to the client.protected voidI2PTunnelHTTPServer.rejectConnection(I2PSocket socket) Refuse an inbound connection when the gate cap is exceeded: send a 503 (SSL port 443 resets instead) and close.protected voidI2PTunnelHTTPServer.rejectConnection(I2PSocket socket, boolean queueFull) Refuse an inbound connection (queue-full or connection-cap): send a 503 (SSL port 443 resets instead) and close, then log the accurate reason.protected voidI2PTunnelServer.rejectConnection(I2PSocket socket) Refuse an inbound connection when the gate cap is exceeded.protected voidI2PTunnelServer.rejectConnection(I2PSocket socket, boolean queueFull) Refuse an inbound connection with an accurate reason.private static voidSend an error response to the client.private static voidI2PTunnelHTTPServer.sendErrorAndClose(I2PSocket socket) Send a 503 and close the socket, ignoring any failures.private voidI2PTunnelRunner.startRaceLeg(String label, I2PSocket sock, PushbackInputStream in, AtomicReference<I2PTunnelRunner.RaceWin> winner, AtomicInteger failures, CountDownLatch settled) One race leg: read a single first byte, unread it into a pushback stream, and publish the win.private voidI2PTunnelHTTPServer.validateRequestHost(Map<String, List<String>> headers, I2PSocket socket, String peerB32) Validate the request hostname against local/loopback/private addresses.Constructors in net.i2p.i2ptunnel with parameters of type I2PSocketModifierConstructorDescriptionCompressedRequestor(Socket webserver, I2PSocket browser, String headers, I2PAppContext ctx, Log log, boolean shouldCompress, boolean upgrade, ThreadPoolExecutor tpe, boolean keepalive, AtomicInteger waiter, java.util.function.Supplier<ThreadPoolExecutor> ioPool) Serves a gzipped response from the web server to the browser.CompressedRequestor(Socket webserver, I2PSocket browser, String headers, I2PAppContext ctx, Log log, boolean shouldCompress, boolean upgrade, ThreadPoolExecutor tpe, boolean keepalive, AtomicInteger waiter, java.util.function.Supplier<ThreadPoolExecutor> ioPool, String tunnelId) Serves a gzipped response, with an optional stall watchdog.Builds the handler for one socket.I2PSocketCloser(InputStream i2pin, OutputStream i2pout, I2PSocket i2ps) Closes one client socket in the background.I2PTunnelHTTPClientRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean allowKeepAliveI2P, boolean allowKeepAliveSocket, boolean isHead) Constructs a new HTTP client runner.privateI2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, Runnable onTimeout, I2PTunnelRunner.FailCallback onFail, boolean keepAliveI2P, boolean keepAliveSocket, boolean shouldStart) Base constructor with keepAlive args.I2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail) Recommended new constructor.privateI2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean shouldStart) Base constructor.I2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean keepAliveI2P, boolean keepAliveSocket) With keepAlive args.(package private)RaceWin(I2PSocket sock, InputStream in) Bind a winning socket to the stream that reads its response.Constructor parameters in net.i2p.i2ptunnel with type arguments of type I2PSocketModifierConstructorDescriptionI2PTunnelHTTPClientRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean allowKeepAliveI2P, boolean allowKeepAliveSocket, boolean isHead) Constructs a new HTTP client runner.privateI2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, Runnable onTimeout, I2PTunnelRunner.FailCallback onFail, boolean keepAliveI2P, boolean keepAliveSocket, boolean shouldStart) Base constructor with keepAlive args.I2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail) Recommended new constructor.privateI2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean shouldStart) Base constructor.I2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean keepAliveI2P, boolean keepAliveSocket) With keepAlive args.Uses of I2PSocket in net.i2p.i2ptunnel.irc
Fields in net.i2p.i2ptunnel.irc declared as I2PSocketModifier and TypeFieldDescriptionprivate final I2PSocketIrcInboundFilter.remoteThe I2P socket to the IRC server.private final I2PSocketIrcOutboundFilter.remoteThe I2P socket to the IRC server.I2PTunnelDCCServer.LocalAddress.socketThe socket connected to the address, once opened.Fields in net.i2p.i2ptunnel.irc with type parameters of type I2PSocketMethods in net.i2p.i2ptunnel.irc with parameters of type I2PSocketModifier and TypeMethodDescriptionprotected voidI2PTunnelDCCServer.blockingHandle(I2PSocket socket) An incoming DCC connection, only accept for a known port.Constructors in net.i2p.i2ptunnel.irc with parameters of type I2PSocketModifierConstructorDescriptionIrcInboundFilter(Socket lcl, I2PSocket rem, StringBuffer pong, Log log) Create an inbound filter without DCC support.IrcInboundFilter(Socket lcl, I2PSocket rem, StringBuffer pong, Log log, DCCHelper helper) Create an inbound filter with optional DCC support.IrcOutboundFilter(Socket lcl, I2PSocket rem, StringBuffer pong, Log log) Create an outbound filter without DCC support.IrcOutboundFilter(Socket lcl, I2PSocket rem, StringBuffer pong, Log log, DCCHelper helper) Create an outbound filter with optional DCC support.Does NOT start itself.Uses of I2PSocket in net.i2p.i2ptunnel.socks
Classes in net.i2p.i2ptunnel.socks that implement I2PSocketModifier and TypeClassDescription(package private) classI2PSocket implementation wrapping a standard TCP Socket obtained from an outproxy, which is itself a wrapper around the Orchid stream.Methods in net.i2p.i2ptunnel.socks that return I2PSocketModifier and TypeMethodDescriptionprivate I2PSocketSOCKS5Server.connectToDestination(I2PSOCKSTunnel t, DataOutputStream out) Connect to the requested destination via I2P, an outproxy plugin, or a configured outproxy.SOCKS4aServer.getDestinationI2PSocket(I2PSOCKSTunnel t) Get an I2PSocket for sending/receiving 8-bit clean data to/from the destination of the SOCKS connection.SOCKS5Server.getDestinationI2PSocket(I2PSOCKSTunnel t) Get an I2PSocket for sending/receiving 8-bit clean data to/from the destination of the SOCKS connection.abstract I2PSocketSOCKSServer.getDestinationI2PSocket(I2PSOCKSTunnel t) Get an I2PSocket for sending/receiving 8-bit clean data to/from the destination of the SOCKS connection.protected I2PSocketSOCKSServer.outproxyConnect(I2PSOCKSTunnel tun, String proxy) Act as a SOCKS 5 client to connect to an outproxy Caller must send success or error to local socks client.Methods in net.i2p.i2ptunnel.socks with parameters of type I2PSocketModifier and TypeMethodDescriptionvoidSOCKSServer.httpsConnect(I2PSocket destSock, OutputStream pout, String connHostName, int connPort, String configUser, String configPW) Act as a https client to connect to a CONNECT outproxy.Uses of I2PSocket in net.i2p.sam
Fields in net.i2p.sam declared as I2PSocketModifier and TypeFieldDescriptionprotected final I2PSocketSAMStreamSession.SAMStreamSessionSocketReader.i2pSocketThe tunnel socket this reader drains.protected final I2PSocketSAMStreamSession.StreamSender.i2pSocketi2pSocket.Fields in net.i2p.sam with type parameters of type I2PSocketModifier and TypeFieldDescriptionprivate final LinkedBlockingQueue<I2PSocket> SAMv3StreamSession._acceptQueueFor subsession only, null otherwise.Methods in net.i2p.sam that return I2PSocketModifier and TypeMethodDescriptionprivate I2PSocketSAMv3StreamSession.acceptSocket()Take a socket from the accept queue, with a timeout to avoid indefinite blocking on stale connections.Methods in net.i2p.sam with parameters of type I2PSocketModifier and TypeMethodDescriptionprotected intSAMStreamSession.createSocketHandler(I2PSocket s, int id) Create a new SAM STREAM session socket handler, detaching its thread.SAMStreamSession.newSAMStreamSessionSocketReader(I2PSocket s, int id) Create a new SAM STREAM session socket reader.SAMv2StreamSession.newSAMStreamSessionSocketReader(I2PSocket s, int id) Creates the version 2 socket reader for this session.protected SAMStreamSession.StreamSenderSAMStreamSession.newStreamSender(I2PSocket s, int id) Creates the sender that writes this socket's outgoing data.protected SAMStreamSession.StreamSenderSAMv2StreamSession.newStreamSender(I2PSocket s, int id) Lets us push data through the stream without blocking, (even after exceeding the I2PSocket's buffer).booleanSAMv3StreamSession.queueSocket(I2PSocket sock) Put a socket on the accept queue.Constructors in net.i2p.sam with parameters of type I2PSocketModifierConstructorDescriptionSAMStreamSessionSocketReader(I2PSocket s, int id) Create a new SAM STREAM session socket reader.SAMv1StreamSessionSocketReader(I2PSocket s, int id) Create a new SAM STREAM session socket reader.SAMv2StreamSessionSocketReader(I2PSocket s, int id) Create a new SAM STREAM session socket reader.StreamSender(I2PSocket s, int id) Create a new StreamSender.V1StreamSender(I2PSocket s, int id) V1StreamSender.V2StreamSender(I2PSocket s, int id) Builds the sender for one stream session.Uses of I2PSocket in org.klomp.snark
Fields in org.klomp.snark declared as I2PSocketModifier and TypeFieldDescriptionprivate final I2PSocketConnectionAcceptor.Handler._socketThe socket the peer connected on.private I2PSocketPeer.sockThe socket connected to the peer.Methods in org.klomp.snark that return I2PSocketModifier and TypeMethodDescription(package private) I2PSocketConnect to the given peer over the shared destination.(package private) I2PSocketConnect to the given destination through the torrent's own destination, or the shared destination if multi-dest is disabled or the torrent has no destination yet.private I2PSocketI2PSnarkUtil.connect(PeerID peer, I2PSocketManager mgr, Destination myDest) Connect to the given destination via the given socket manager.(package private) I2PSocketPeer.getI2PSocket()The I2PSocket of this connection, or null if never connected.Methods in org.klomp.snark with parameters of type I2PSocketModifier and TypeMethodDescriptionvoidPeerAcceptor.connection(I2PSocket socket, InputStream in, OutputStream out) Handle an incoming connection from a peer.private voidConnectionAcceptor.handleSocket(I2PSocket socket, Destination myDest, PeerAcceptor pa) Validate an accepted socket and dispatch it to a handler thread.Constructors in org.klomp.snark with parameters of type I2PSocketModifierConstructorDescriptionHandler(I2PSocket socket, PeerAcceptor pa) Builds the handler for one incoming peer.Peer(I2PSocket sock, InputStream in, OutputStream out, byte[] myId, byte[] infohash, MetaInfo metainfo) Incoming connection.