# README
README
STATUS: This project is maintained. I will respond to issues, pull requests, and feature requests within a few days.
README
go library for the I2P SAMv3.0 bridge, used to build anonymous/pseudonymous end-to-end encrypted sockets.
This library is much better than ccondom (that use BOB), much more stable and much easier to maintain.
Support/TODO
What works:
- Utils
- Resolving domain names to I2P destinations
- .b32.i2p hashes
- Generating keys/i2p destinations
- Streaming
- DialI2P() - Connecting to stuff in I2P
- Listen()/Accept() - Handling incomming connections
- Implements net.Conn and net.Listener
- Datagrams
- Implements net.PacketConn
- Raw datagrams
- Like datagrams, but without addresses
Does not work:
- Stream Forwarding
- Probably needs some real-world testing
Documentation
- Latest version-documentation:
- set your GOPATH
- Enter
godoc -http=:8081
into your terminal and hit enter. - Goto http://localhost:8081, click packages, and navigate to sam3
Examples
package main
import (
"github.com/go-i2p/sam3"
"github.com/go-i2p/sam3/i2pkeys"
"fmt"
)
const yoursam = "127.0.0.1:7656" // sam bridge
func client(server i2pkeys.I2PAddr) {
sam, _ := sam3.NewSAM(yoursam)
keys, _ := sam.NewKeys()
stream, _ := sam.NewStreamSession("clientTun", keys, sam3.Options_Small)
fmt.Println("Client: Connecting to " + server.Base32())
conn, _ := stream.DialI2P(server)
conn.Write([]byte("Hello world!"))
return
}
func main() {
sam, _ := NewSAM(yoursam)
keys, _ := sam.NewKeys()
stream, _ := sam.NewStreamSession("serverTun", keys, sam3.Options_Medium)
listener, _ := stream.Listen()
go client(keys.Addr())
conn, _ := listener.Accept()
buf := make([]byte, 4096)
n, _ := conn.Read(buf)
fmt.Println("Server received: " + string(buf[:n]))
}
The above will write to the terminal:
Client: Connecting to zjnvfh4hs3et5vtz35ogwzrws26zvwkcad5uo5esecvg4qpk5b4a.b32.i2p
Server received: Hello world!
Error handling was omitted in the above code for readability.
Testing
go test -tags=nettest
runs the whole suite (takes 90+ sec to perform!)go test -short
runs the shorter variant, does not connect to anything
Verbosity
Logging can be enabled and configured using the DEBUG_I2P environment variable. By default, logging is disabled.
There are three available log levels:
- Debug
export DEBUG_I2P=debug
- Warn
export DEBUG_I2P=warn
- Error
export DEBUG_I2P=error
If DEBUG_I2P is set to an unrecognized variable, it will fall back to "debug".
License
Public domain.
Author
- Kalle Vedin
[email protected]
- Unknown Name (majestrate)
- idk
- qiwenmin
# Packages
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetSAM3Logger returns the initialized logger.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Creates a new controller for the I2P routers SAM bridge.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetAccessList tells the system to treat the AccessList as a whitelist.
SetAccessListType tells the system to treat the AccessList as a whitelist.
SetAllowZeroIn tells the tunnel to accept zero-hop peers.
SetAllowZeroOut tells the tunnel to accept zero-hop peers.
SetCloseIdle tells the connection to close it's tunnels during extended idle time.
SetCloseIdleTime sets the time to wait before closing tunnels to idle levels.
SetCloseIdleTimeMs sets the time to wait before closing tunnels to idle levels in milliseconds.
SetCompress tells clients to use compression.
SetEncrypt tells the router to use an encrypted leaseset.
SetFastRecieve tells clients to use compression.
SetInBackups sets the inbound tunnel backups.
SetInLength sets the number of hops inbound.
SetInQuantity sets the inbound tunnel quantity.
SetInVariance sets the variance of a number of hops inbound.
SetLeaseSetKey sets the host of the SAMEmit's SAM bridge.
SetLeaseSetPrivateKey sets the host of the SAMEmit's SAM bridge.
SetLeaseSetPrivateSigningKey sets the host of the SAMEmit's SAM bridge.
SetMessageReliability sets the host of the SAMEmit's SAM bridge.
SetName sets the host of the SAMEmit's SAM bridge.
SetOutBackups sets the inbound tunnel backups.
SetOutLength sets the number of hops outbound.
SetOutQuantity sets the outbound tunnel quantity.
SetOutVariance sets the variance of a number of hops outbound.
SetReduceIdle tells the connection to reduce it's tunnels during extended idle time.
SetReduceIdleQuantity sets minimum number of tunnels to reduce to during idle time.
SetReduceIdleTime sets the time to wait before reducing tunnels to idle levels.
SetReduceIdleTimeMs sets the time to wait before reducing tunnels to idle levels in milliseconds.
SetSAMAddress sets the SAM address all-at-once.
SetSAMHost sets the host of the SAMEmit's SAM bridge.
SetSAMPort sets the port of the SAMEmit's SAM bridge using a string.
SetType sets the type of the forwarder server.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
Sensible defaults for most people.
Suitable options if you are shuffling A LOT of traffic.
Suitable for shuffling a lot of traffic.
Suitable for shuffling medium amounts of traffic.
Suitable only for small dataflows, and very short lasting connections: You only have one tunnel in each direction, so if any of the nodes through which any of your two tunnels pass through go offline, there will be a complete halt in the dataflow, until a new tunnel is built.
Does not use any anonymization, you connect directly to others tunnel endpoints, thus revealing your identity but not theirs.
Suitable for shuffling a lot of traffic quickly with minimum anonymity.
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
Config is the config type for the sam connector api for i2p which allows applications to 'speak' with i2p.
The DatagramSession implements net.PacketConn.
I2PConfig is a struct which manages I2P configuration options.
Represents a primary session.
The RawSession provides no authentication of senders, and there is no sender address attached to datagrams, so all communication is anonymous.
Used for controlling I2Ps SAMv3.
import (
.
No description provided by the author
No description provided by the author
No description provided by the author
Represents a streaming session.