mirror of
https://github.com/go-i2p/goSam.git
synced 2025-07-07 03:08:32 -04:00
get rid of outdated examples
This commit is contained in:
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -1,6 +1,7 @@
|
|||||||
golang-github-eyedeekay-gosam (0.3.2.1) bionic; urgency=medium
|
golang-github-eyedeekay-gosam (0.3.2.1) bionic; urgency=medium
|
||||||
|
|
||||||
* Get rid of the debug directory, just move it into the source
|
* Get rid of the debug directory, just move it into the source
|
||||||
|
* Get rid of the old example, just use the one in the README
|
||||||
|
|
||||||
-- idk <hankhill19580@gmail.com> Fri, 18 May 2019 18:12:21 -0500
|
-- idk <hankhill19580@gmail.com> Fri, 18 May 2019 18:12:21 -0500
|
||||||
|
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/eyedeekay/goSam"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
//In order to enable debugging, pass the SetDebug(true) option.
|
|
||||||
//sam, err := goSam.NewClientFromOptions(SetDebug(true))
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
}
|
|
4
go.mod
4
go.mod
@ -4,8 +4,8 @@ require github.com/eyedeekay/sam3 v0.32.2
|
|||||||
|
|
||||||
//replace github.com/eyedeekay/gosam v0.1.1-0.20190814195658-27e786578944 => github.com/eyedeekay/goSam ./
|
//replace github.com/eyedeekay/gosam v0.1.1-0.20190814195658-27e786578944 => github.com/eyedeekay/goSam ./
|
||||||
|
|
||||||
replace github.com/eyedeekay/gosam v0.1.1-0.20190814195658-27e786578944 => ./
|
replace github.com/eyedeekay/gosam v0.32.1 => ./
|
||||||
|
|
||||||
replace github.com/eyedeekay/goSam v0.1.0 => ./
|
replace github.com/eyedeekay/goSam v0.32.1 => ./
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
Reference in New Issue
Block a user