Files
sam3/README.md

89 lines
2.1 KiB
Markdown
Raw Normal View History

2014-06-26 02:35:25 +02:00
# README #
go library for the I2P SAMv3 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
2014-06-29 21:01:46 +02:00
* Resolving domain names to I2P destinations
2014-06-26 02:36:27 +02:00
* .b32.i2p hashes
* Generating keys/i2p destinations
2014-06-26 02:35:25 +02:00
* Streaming
2014-06-26 02:36:27 +02:00
* DialI2P() - Connecting to stuff in I2P
* Listen()/Accept() - Handling incomming connections
2014-06-29 19:58:34 +02:00
* Implements net.Conn and net.Listener
* Datagrams
* Implements net.PacketConn
2014-06-29 21:01:46 +02:00
* Raw datagrams
* Like datagrams, but without addresses
2014-06-26 02:35:25 +02:00
**Does not work:**
2014-06-29 21:01:46 +02:00
* Everything works! :D
* Probably needs some real-world testing
2014-06-26 02:35:25 +02:00
## Documentation ##
* Enter `godoc -http=:8081` into your terminal and hit enter.
* Goto http://localhost:8081, click packages, and navigate to sam3
2014-06-29 21:01:46 +02:00
## Examples ##
´´´go
package main
import (
"bitbucket.org/kallevedin/sam3"
"fmt"
)
const yoursam = "127.0.0.1:7656" // sam bridge
func client(server I2PAddr) {
sam, _ := NewSAM(yoursam)
keys, _ := sam.NewKeys()
stream, _ := sam2.NewStreamSession("clientTun", keys, 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()
go client(keys.Addr())
stream, _ := sam.NewStreamSession("serverTun", keys, Options_Medium)
listener, _ := stream.Listen()
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:
```text
Client: Connecting to zjnvfh4hs3et5vtz35ogwzrws26zvwkcad5uo5esecvg4qpk5b4a.b32.i2p
Server received: Hello world!
```
Error handling was omitted in the above code for readability.
2014-06-26 02:35:25 +02:00
## Testing ##
2014-06-29 21:01:46 +02:00
* `go test` runs the whole suite (takes 90+ sec to perform!)
* `go test -short` runs the shorter variant, does not connect to anything
2014-06-26 02:35:25 +02:00
## License ##
Public domain.
## Author ##
Kalle Vedin `kalle.vedin@fripost.org`