You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A go library for using the I2P Simple Anonymous Messaging (SAM version 3.0) bridge
This is in an early development stage. I would love to hear about any issues or ideas for improvement.
Installation
go get github.com/cryptix/goSam
Using it for HTTP Transport
I implemented Client.Dial like net.Dial so you can use go's library packages like http.
package main
import (
"io""log""net/http""os""github.com/cryptix/goSam"
)
funcmain() {
// create a default sam clientsam, err:=goSam.NewDefaultClient()
checkErr(err)
log.Println("Client Created")
// create a transport that uses SAM to dial TCP Connectionstr:=&http.Transport{
Dial: sam.Dial,
}
// create a client using this transportclient:=&http.Client{Transport: tr}
// send a get requestresp, err:=client.Get("https://stats.i2p/")
checkErr(err)
deferresp.Body.Close()
log.Printf("Get returned %+v\n", resp)
// create a file for the responsefile, err:=os.Create("stats.html")
checkErr(err)
deferfile.Close()
// copy the response to the file_, err=io.Copy(file, resp.Body)
checkErr(err)
log.Println("Done.")
}
funccheckErr(errerror) {
iferr!=nil {
log.Fatal(err)
}
}
TODO
Implement STREAM ACCEPT and STREAM FORWARD
Implement datagrams (Repliable and Anon)
About
A go library for using the I2P Simple Anonymous Messaging (SAM version 3.0) bridge