class

RNS::I2PInterfacePeer

Inherits RNS::Interface < Reference < Object

Constants

I2P_PROBE_AFTER = 10
I2P_PROBE_INTERVAL = 9
I2P_PROBES = 5
I2P_READ_TIMEOUT = ((I2P_PROBE_INTERVAL * I2P_PROBES) + I2P_PROBE_AFTER) * 2
I2P_USER_TIMEOUT = 45

I2P TCP socket timeouts (matching Python I2PInterfacePeer constants)

RECONNECT_MAX_TRIES = nil
RECONNECT_WAIT = 15
TUNNEL_STATE_ACTIVE = 1_u8
TUNNEL_STATE_INIT = 0_u8
TUNNEL_STATE_STALE = 2_u8

Constructors

new(parent_interface : Interface, owner_callback : Proc(Bytes, Interface, Nil) | Nil, name : String, connected_socket : TCPSocket, max_reconnect_tries : Int32 | Nil = nil)

Constructor for server-spawned peer (connected_socket provided)

Source
new(parent_interface : I2PInterface, owner_callback : Proc(Bytes, Interface, Nil) | Nil, name : String, target_i2p_dest : String, max_reconnect_tries : Int32 | Nil = nil)

Constructor for initiator peer (target_i2p_dest provided)

Source
new(name : String, initiator : Bool = false, kiss_framing : Bool = false, inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)

Minimal constructor for testing without actual I2P connections

Source

Instance methods

awaiting_i2p_tunnel
Source
awaiting_i2p_tunnel=(awaiting_i2p_tunnel : Bool)
Source
connect(initial : Bool = false) : Bool
Source
detach

Called when the interface is being detached/removed

Source
dir_in
Source
dir_in=(dir_in : Bool)
Source
dir_out
Source
dir_out=(dir_out : Bool)
Source
i2p_dest
Source
i2p_dest=(i2p_dest : String | Nil)
Source
i2p_tunnel_ready
Source
i2p_tunnel_ready=(i2p_tunnel_ready : Bool)
Source
i2p_tunnel_state
Source
i2p_tunnel_state=(i2p_tunnel_state : UInt8)
Source
i2p_tunneled
Source
i2p_tunneled=(i2p_tunneled : Bool)
Source
initiator
Source
initiator=(initiator : Bool)
Source
kiss_framing
Source
kiss_framing=(kiss_framing : Bool)
Source
last_read
Source
last_read=(last_read : Float64)
Source
last_write
Source
last_write=(last_write : Float64)
Source
max_reconnect_tries
Source
max_reconnect_tries=(max_reconnect_tries : Int32 | Nil)
Source
never_connected
Source
never_connected=(never_connected : Bool)
Source
parent_count
Source
parent_count=(parent_count : Bool)
Source
process_incoming(data : Bytes)
Source
process_outgoing(data : Bytes)

Send data out through the interface. Subclasses must implement this.

Source
read_watchdog
Source
reconnect
Source
reconnecting
Source
reconnecting=(reconnecting : Bool)
Source
shutdown_socket
Source
socket
Source
socket=(socket : TCPSocket | Nil)
Source
start_read_loop
Source
teardown

Tear down the interface, releasing any resources (sockets, fibers, etc.). Subclasses should override to close their specific resources.

Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
wants_tunnel
Source
wants_tunnel=(wants_tunnel : Bool)
Source
wd_reset
Source
wd_reset=(wd_reset : Bool)
Source
writing
Source
writing=(writing : Bool)
Source