update index.html
This commit is contained in:
119
index.html
119
index.html
@ -17,6 +17,11 @@
|
|||||||
<div id="shownav">
|
<div id="shownav">
|
||||||
<div id="hidenav">
|
<div id="hidenav">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="..">
|
||||||
|
Up one level ^
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="index.html">
|
<a href="index.html">
|
||||||
index
|
index
|
||||||
@ -35,20 +40,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<a id="returnhome" href="/">
|
||||||
|
/
|
||||||
|
</a>
|
||||||
<h1>
|
<h1>
|
||||||
<a href="#gosam" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
goSam
|
goSam
|
||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
A go library for using the
|
A go library for using the
|
||||||
<a href="https://geti2p.net/en/" rel="nofollow">
|
<a href="https://geti2p.net/en/">
|
||||||
I2P
|
I2P
|
||||||
</a>
|
</a>
|
||||||
Simple Anonymous
|
Simple Anonymous
|
||||||
Messaging (
|
Messaging (
|
||||||
<a href="https://geti2p.net/en/docs/api/samv3" rel="nofollow">
|
<a href="https://geti2p.net/en/docs/api/samv3">
|
||||||
SAM version 3.0
|
SAM version 3.0
|
||||||
</a>
|
</a>
|
||||||
) bridge. It
|
) bridge. It
|
||||||
@ -58,17 +63,11 @@
|
|||||||
STATUS: This project is maintained. I will respond to issues, pull requests, and feature requests within a few days. I am primarily maintaining functionality. This is widely used and easy to use, but thusfar, mostly by me. It sees a lot of testing and no breaking changes to the API are expected.
|
STATUS: This project is maintained. I will respond to issues, pull requests, and feature requests within a few days. I am primarily maintaining functionality. This is widely used and easy to use, but thusfar, mostly by me. It sees a lot of testing and no breaking changes to the API are expected.
|
||||||
</p>
|
</p>
|
||||||
<h2>
|
<h2>
|
||||||
<a href="#installation" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
Installation
|
Installation
|
||||||
</h2>
|
</h2>
|
||||||
<pre><code>go get github.com/eyedeekay/goSam
|
<pre><code>go get github.com/eyedeekay/goSam
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h2>
|
<h2>
|
||||||
<a href="#using-it-for-http-transport" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
Using it for HTTP Transport
|
Using it for HTTP Transport
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
@ -79,18 +78,17 @@
|
|||||||
<code>
|
<code>
|
||||||
net.Dial
|
net.Dial
|
||||||
</code>
|
</code>
|
||||||
so you can use go's library packages like http.
|
so you can use go’s library packages like http.
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<pre><code class="language-go">package main
|
||||||
<pre>package main
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/cryptix/goSam"
|
"github.com/cryptix/goSam"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -98,7 +96,7 @@ func main() {
|
|||||||
sam, err := goSam.NewDefaultClient()
|
sam, err := goSam.NewDefaultClient()
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
log.Println("Client Created")
|
log.Println("Client Created")
|
||||||
|
|
||||||
// create a transport that uses SAM to dial TCP Connections
|
// create a transport that uses SAM to dial TCP Connections
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
@ -109,14 +107,14 @@ func main() {
|
|||||||
client := &http.Client{Transport: tr}
|
client := &http.Client{Transport: tr}
|
||||||
|
|
||||||
// send a get request
|
// send a get request
|
||||||
resp, err := client.Get("http://stats.i2p/")
|
resp, err := client.Get("http://stats.i2p/")
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
log.Printf("Get returned %+v\n", resp)
|
log.Printf("Get returned %+v\n", resp)
|
||||||
|
|
||||||
// create a file for the response
|
// create a file for the response
|
||||||
file, err := os.Create("stats.html")
|
file, err := os.Create("stats.html")
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
@ -124,7 +122,7 @@ func main() {
|
|||||||
_, err = io.Copy(file, resp.Body)
|
_, err = io.Copy(file, resp.Body)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
log.Println("Done.")
|
log.Println("Done.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkErr(err error) {
|
func checkErr(err error) {
|
||||||
@ -133,34 +131,29 @@ func checkErr(err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</pre>
|
</code></pre>
|
||||||
</div>
|
|
||||||
<h3>
|
<h3>
|
||||||
<a href="#using-sam-by-default-as-a-proxy-for-all-http-clients-used-by-a-go-application" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
Using SAM by default, as a proxy for all HTTP Clients used by a Go application
|
Using SAM by default, as a proxy for all HTTP Clients used by a Go application
|
||||||
</h3>
|
</h3>
|
||||||
<p>
|
<p>
|
||||||
This will make the SAM transport dialer the default for all HTTP clients.
|
This will make the SAM transport dialer the default for all HTTP clients.
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<pre><code class="language-go">package main
|
||||||
<pre>package main
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/cryptix/goSam"
|
"github.com/cryptix/goSam"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
sam, err := goSam.NewDefaultClient()
|
sam, err := goSam.NewDefaultClient()
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
|
||||||
log.Println("Client Created")
|
log.Println("Client Created")
|
||||||
|
|
||||||
// create a transport that uses SAM to dial TCP Connections
|
// create a transport that uses SAM to dial TCP Connections
|
||||||
httpClient := &http.Client{
|
httpClient := &http.Client{
|
||||||
@ -178,12 +171,8 @@ func checkErr(err error) {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</code></pre>
|
||||||
</div>
|
|
||||||
<h2>
|
<h2>
|
||||||
<a href="#using-it-as-a-socks-proxy" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
Using it as a SOCKS proxy
|
Using it as a SOCKS proxy
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
@ -191,7 +180,7 @@ func checkErr(err error) {
|
|||||||
client
|
client
|
||||||
</code>
|
</code>
|
||||||
also implements a resolver compatible with
|
also implements a resolver compatible with
|
||||||
<a href="https://github.com/getlantern/go-socks5" rel="nofollow">
|
<a href="https://github.com/getlantern/go-socks5">
|
||||||
<code>
|
<code>
|
||||||
getlantern/go-socks5
|
getlantern/go-socks5
|
||||||
</code>
|
</code>
|
||||||
@ -199,20 +188,19 @@ func checkErr(err error) {
|
|||||||
,
|
,
|
||||||
making it very easy to implement a SOCKS5 server.
|
making it very easy to implement a SOCKS5 server.
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<pre><code class="language-go">package main
|
||||||
<pre>package main
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"github.com/eyedeekay/goSam"
|
"github.com/eyedeekay/goSam"
|
||||||
"github.com/getlantern/go-socks5"
|
"github.com/getlantern/go-socks5"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
samaddr = flag.String("sam", "127.0.0.1:7656", "SAM API address to use")
|
samaddr = flag.String("sam", "127.0.0.1:7656", "SAM API address to use")
|
||||||
socksaddr = flag.String("socks", "127.0.0.1:7675", "SOCKS address to use")
|
socksaddr = flag.String("socks", "127.0.0.1:7675", "SOCKS address to use")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -220,7 +208,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
log.Println("Client Created")
|
log.Println("Client Created")
|
||||||
|
|
||||||
// create a transport that uses SAM to dial TCP Connections
|
// create a transport that uses SAM to dial TCP Connections
|
||||||
conf := &socks5.Config{
|
conf := &socks5.Config{
|
||||||
@ -233,16 +221,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create SOCKS5 proxy on localhost port 8000
|
// Create SOCKS5 proxy on localhost port 8000
|
||||||
if err := server.ListenAndServe("tcp", *socksaddr); err != nil {
|
if err := server.ListenAndServe("tcp", *socksaddr); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</code></pre>
|
||||||
</div>
|
|
||||||
<h3>
|
<h3>
|
||||||
<a href="#deb-package" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
.deb package
|
.deb package
|
||||||
</h3>
|
</h3>
|
||||||
<p>
|
<p>
|
||||||
@ -259,13 +243,10 @@ func main() {
|
|||||||
<pre><code> debuild -S
|
<pre><code> debuild -S
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>
|
<p>
|
||||||
will produce a viable source package for use with Launchpad PPA's and other
|
will produce a viable source package for use with Launchpad PPA’s and other
|
||||||
similar systems.
|
similar systems.
|
||||||
</p>
|
</p>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="#todo" rel="nofollow">
|
|
||||||
<span></span>
|
|
||||||
</a>
|
|
||||||
TODO
|
TODO
|
||||||
</h3>
|
</h3>
|
||||||
<ul>
|
<ul>
|
||||||
@ -282,6 +263,20 @@ func main() {
|
|||||||
Implement datagrams (Repliable and Anon)
|
Implement datagrams (Repliable and Anon)
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="sourcecode">
|
||||||
|
<span id="sourcehead">
|
||||||
|
<strong>
|
||||||
|
Get the source code:
|
||||||
|
</strong>
|
||||||
|
</span>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/eyedeekay/goSam">
|
||||||
|
Source Repository: (https://github.com/eyedeekay/goSam)
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href="#show">
|
<a href="#show">
|
||||||
Show license
|
Show license
|
||||||
|
@ -8,3 +8,8 @@
|
|||||||
#hidenav {display:block; }
|
#hidenav {display:block; }
|
||||||
#shownav:target {display: block; }
|
#shownav:target {display: block; }
|
||||||
#hidenav:target {display: none; }
|
#hidenav:target {display: none; }
|
||||||
|
|
||||||
|
#donate {display:none; }
|
||||||
|
#hidedonate {display:block; }
|
||||||
|
#donate:target {display: block; }
|
||||||
|
#hidedonate:target {display: none; }
|
||||||
|
10
style.css
10
style.css
@ -36,6 +36,7 @@ img {
|
|||||||
left: 5%;
|
left: 5%;
|
||||||
max-width: 60%;
|
max-width: 60%;
|
||||||
display: inline;
|
display: inline;
|
||||||
|
padding-right: 2%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -153,5 +154,12 @@ input {
|
|||||||
|
|
||||||
#navbar {
|
#navbar {
|
||||||
float: right;
|
float: right;
|
||||||
width: 10%;
|
width: 15%;
|
||||||
|
}
|
||||||
|
#returnhome {
|
||||||
|
font-size: xxx-large;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
display: inline;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user