5.4 KiB
stream
-- import "github.com/go-i2p/go-sam-go/stream"
Usage
type SAM
type SAM struct {
*common.SAM
}
SAM wraps common.SAM to provide stream-specific functionality
func (*SAM) NewStreamSession
func (s *SAM) NewStreamSession(id string, keys i2pkeys.I2PKeys, options []string) (*StreamSession, error)
NewStreamSession creates a new streaming session with the SAM bridge
func (*SAM) NewStreamSessionWithPorts
func (s *SAM) NewStreamSessionWithPorts(id, fromPort, toPort string, keys i2pkeys.I2PKeys, options []string) (*StreamSession, error)
NewStreamSessionWithPorts creates a new streaming session with port specifications
func (*SAM) NewStreamSessionWithSignature
func (s *SAM) NewStreamSessionWithSignature(id string, keys i2pkeys.I2PKeys, options []string, sigType string) (*StreamSession, error)
NewStreamSessionWithSignature creates a new streaming session with custom signature type
type StreamConn
type StreamConn struct {
}
StreamConn implements net.Conn for I2P streaming connections
func (*StreamConn) Close
func (c *StreamConn) Close() error
Close closes the connection
func (*StreamConn) LocalAddr
func (c *StreamConn) LocalAddr() net.Addr
LocalAddr returns the local network address
func (*StreamConn) Read
func (c *StreamConn) Read(b []byte) (int, error)
Read reads data from the connection
func (*StreamConn) RemoteAddr
func (c *StreamConn) RemoteAddr() net.Addr
RemoteAddr returns the remote network address
func (*StreamConn) SetDeadline
func (c *StreamConn) SetDeadline(t time.Time) error
SetDeadline sets the read and write deadlines
func (*StreamConn) SetReadDeadline
func (c *StreamConn) SetReadDeadline(t time.Time) error
SetReadDeadline sets the deadline for future Read calls
func (*StreamConn) SetWriteDeadline
func (c *StreamConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the deadline for future Write calls
func (*StreamConn) Write
func (c *StreamConn) Write(b []byte) (int, error)
Write writes data to the connection
type StreamDialer
type StreamDialer struct {
}
StreamDialer handles client-side connection establishment
func (*StreamDialer) Dial
func (d *StreamDialer) Dial(destination string) (*StreamConn, error)
Dial establishes a connection to the specified destination
func (*StreamDialer) DialContext
func (d *StreamDialer) DialContext(ctx context.Context, destination string) (*StreamConn, error)
DialContext establishes a connection with context support
func (*StreamDialer) DialI2P
func (d *StreamDialer) DialI2P(addr i2pkeys.I2PAddr) (*StreamConn, error)
DialI2P establishes a connection to the specified I2P address
func (*StreamDialer) DialI2PContext
func (d *StreamDialer) DialI2PContext(ctx context.Context, addr i2pkeys.I2PAddr) (*StreamConn, error)
DialI2PContext establishes a connection to an I2P address with context support
func (*StreamDialer) SetTimeout
func (d *StreamDialer) SetTimeout(timeout time.Duration) *StreamDialer
SetTimeout sets the default timeout for new dialers
type StreamListener
type StreamListener struct {
}
StreamListener implements net.Listener for I2P streaming connections
func (*StreamListener) Accept
func (l *StreamListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener
func (*StreamListener) AcceptStream
func (l *StreamListener) AcceptStream() (*StreamConn, error)
AcceptStream waits for and returns the next I2P streaming connection
func (*StreamListener) Addr
func (l *StreamListener) Addr() net.Addr
Addr returns the listener's network address
func (*StreamListener) Close
func (l *StreamListener) Close() error
Close closes the listener
type StreamSession
type StreamSession struct {
*common.BaseSession
}
StreamSession represents a streaming session that can create listeners and dialers
func NewStreamSession
func NewStreamSession(sam *common.SAM, id string, keys i2pkeys.I2PKeys, options []string) (*StreamSession, error)
NewStreamSession creates a new streaming session
func (*StreamSession) Addr
func (s *StreamSession) Addr() i2pkeys.I2PAddr
Addr returns the I2P address of this session
func (*StreamSession) Close
func (s *StreamSession) Close() error
Close closes the streaming session and all associated resources
func (*StreamSession) Dial
func (s *StreamSession) Dial(destination string) (*StreamConn, error)
Dial establishes a connection to the specified I2P destination
func (*StreamSession) DialContext
func (s *StreamSession) DialContext(ctx context.Context, destination string) (*StreamConn, error)
DialContext establishes a connection with context support
func (*StreamSession) DialI2P
func (s *StreamSession) DialI2P(addr i2pkeys.I2PAddr) (*StreamConn, error)
DialI2P establishes a connection to the specified I2P address
func (*StreamSession) Listen
func (s *StreamSession) Listen() (*StreamListener, error)
Listen creates a StreamListener that accepts incoming connections
func (*StreamSession) NewDialer
func (s *StreamSession) NewDialer() *StreamDialer
NewDialer creates a StreamDialer for establishing outbound connections