Sin descripción

Jorropo 79071510cf Fixing version check (#12) hace 4 años
example 702cc4d699 Configurable host:port (#7) hace 6 años
.gitignore 3fa2f2ef68 Initial commit hace 10 años
LICENSE 3fa2f2ef68 Initial commit hace 10 años
README.md a421daf8d9 Added some Documentation and Example of using it with http.Transport hace 10 años
accept.go 702cc4d699 Configurable host:port (#7) hace 6 años
client.go 79071510cf Fixing version check (#12) hace 4 años
client_test.go 702cc4d699 Configurable host:port (#7) hace 6 años
dial.go 702cc4d699 Configurable host:port (#7) hace 6 años
go.mod 79071510cf Fixing version check (#12) hace 4 años
go.sum 35892cc097 go module hace 6 años
naming.go 622c39b6a5 spring cleaning hace 9 años
naming_test.go 701d7fcf03 fix tests hace 6 años
options.go 89742a3ec4 added reduce-on-idle and close-on-idle options (closes #9) hace 6 años
options_test.go 89742a3ec4 added reduce-on-idle and close-on-idle options (closes #9) hace 6 años
replyParser.go 2b14108a06 I don't know exactly why, but checking that the kvPair in replyParser.go is not nil fixes the crash on image-heavy sites. hace 6 años
replyParser_test.go 8d5c5f9d36 switch to strings.SplitN and apply gofmt, add test hace 6 años
sessions.go 702cc4d699 Configurable host:port (#7) hace 6 años
stream.go 622c39b6a5 spring cleaning hace 9 años

README.md

goSam

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"
)

func main() {
	// create a default sam client
	sam, err := goSam.NewDefaultClient()
	checkErr(err)

	log.Println("Client Created")

	// create a transport that uses SAM to dial TCP Connections
	tr := &http.Transport{
		Dial: sam.Dial,
	}

	// create  a client using this transport
	client := &http.Client{Transport: tr}

	// send a get request
	resp, err := client.Get("http://stats.i2p/")
	checkErr(err)
	defer resp.Body.Close()

	log.Printf("Get returned %+v\n", resp)

	// create a file for the response
	file, err := os.Create("stats.html")
	checkErr(err)
	defer file.Close()

	// copy the response to the file
	_, err = io.Copy(file, resp.Body)
	checkErr(err)

	log.Println("Done.")
}

func checkErr(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

TODO

  • Implement STREAM ACCEPT and STREAM FORWARD
  • Implement datagrams (Repliable and Anon)