User's Guide:i2p.sam

From Python-I2P.

Module i2p.sam allows Python programs to access the SAM proxy.

With this module, a program can send stream data, datagrams, and raw packets across the I2P network.

Table of contents

Sockets

socket(session, type, samaddr='127.0.0.1:7656', **kwargs)

socket() object properties: poll()

resolve(host, samaddr='127.0.0.1:7656')

select(readlist, writelist, errlist, timeout=None)

Tunnels

Tunnels allow stream sockets to be joined, so that connections to a listening socket are relayed to one or more sending sockets. This allows an ordinary web server to be exposed as an I2P Destination, or an I2P Destination to be bound as a local port, and so on.

class Tunnel(self, receive, make_send, nconnect=-1, timeout=60.0)

close()

Tunnel Server

class TunnelServer(session, port, samaddr='127.0.0.1:7656', nconnect=-1, timeout=None, **kwargs)

TunnelServer properties:

Tunnel Client

class TunnelClient(session, port, dest, samaddr='127.0.0.1:7656', nconnect=-1, timeout=None, **kwargs)

TunnelClient properties:

Errors

class Error(i2p.Error)

class BlockError(Error) class ClosedError(Error) class NetworkError(Error)

Constants

Socket types

Packet sizes Flags for recv() Polling flags