13 Commits

Author SHA1 Message Date
idk
3ab932c170 Fix error in config directory 2020-01-05 13:51:07 -05:00
idk
6159dc47f0 Fix error in config directory 2020-01-05 13:48:30 -05:00
idk
bf6b920eff add go.mod 2019-12-31 21:57:35 -05:00
idk
aa52be69ff remove vendor dir 2019-10-21 13:53:41 -04:00
idk
d2f767dbe0 clean up conditional compilation 2019-09-28 00:10:36 -04:00
idk
b89d62e481 update the manager to include noui 2019-09-27 23:45:37 -04:00
idk
06113918ea update the manager to include noui 2019-09-27 23:31:32 -04:00
idk
a884fa4692 update the manager to include noui 2019-09-27 23:29:17 -04:00
idk
fc36f9cf6f fix go vet for ./interface 2019-09-11 23:18:29 -04:00
idk
3248dd789d fix go vet for ./interface 2019-09-11 23:12:33 -04:00
idk
71ca8cd65f add in http outproxy helpers 2019-09-08 17:01:05 -04:00
idk
60e9f15b18 add in the outproxy helpers 2019-09-08 16:20:30 -04:00
idk
ee8617deb0 fix helpers 2019-09-06 16:43:33 -04:00
20 changed files with 284 additions and 459 deletions

View File

@@ -17,7 +17,7 @@ LOG := log/
ETC := etc/
USR := usr/
LOCAL := local/
VERSION := 0.32.07
VERSION := 0.32.09
GO111MODULE=on
@@ -92,7 +92,7 @@ daemon-cli: bin/$(samcatd)-cli
bin/$(samcatd)-cli:
mkdir -p bin
cd samcatd && go build -a -tags "netgo" \
cd samcatd && go build -a -tags "netgo cli" \
-ldflags '-w -extldflags "-static"' \
-o ../bin/$(samcatd)-cli \
./*.go
@@ -240,3 +240,11 @@ tar:
sed:
sed -i 's|func(\*Conf)|func(samtunnel.SAMTunnel)|g' ./config/*.go
sed -i 's|func(c \*Conf)|func(c samtunnel.SAMTunnel)|g' ./config/*.go
tasks:
golint ./tcp
#golint ./udp
#golint ./config
#golint ./config
#golint ./config
#golint ./config

View File

@@ -6,7 +6,7 @@ import (
)
import (
"github.com/eyedeekay/sam-forwarder/i2pkeys"
sfi2pkeys "github.com/eyedeekay/sam-forwarder/i2pkeys"
"github.com/eyedeekay/sam3/i2pkeys"
)

View File

@@ -0,0 +1,130 @@
package i2ptunhelper
import (
"github.com/eyedeekay/outproxy"
"github.com/eyedeekay/sam-forwarder/config"
)
// NewOutProxyFromConf generates a SAMforwarder from *i2ptunconf.Conf
func NewOutProxyFromConf(config *i2ptunconf.Conf) (*outproxy.OutProxy, error) {
if config != nil {
return outproxy.NewOutProxyFromOptions(
outproxy.SetType(config.Type),
outproxy.SetSaveFile(config.SaveFile),
outproxy.SetFilePath(config.SaveDirectory),
outproxy.SetHost(config.TargetHost),
outproxy.SetPort(config.TargetPort),
outproxy.SetSAMHost(config.SamHost),
outproxy.SetSAMPort(config.SamPort),
outproxy.SetSigType(config.SigType),
outproxy.SetName(config.TunName),
outproxy.SetInLength(config.InLength),
outproxy.SetOutLength(config.OutLength),
outproxy.SetInVariance(config.InVariance),
outproxy.SetOutVariance(config.OutVariance),
outproxy.SetInQuantity(config.InQuantity),
outproxy.SetOutQuantity(config.OutQuantity),
outproxy.SetInBackups(config.InBackupQuantity),
outproxy.SetOutBackups(config.OutBackupQuantity),
outproxy.SetEncrypt(config.EncryptLeaseSet),
outproxy.SetLeaseSetKey(config.LeaseSetKey),
outproxy.SetLeaseSetPrivateKey(config.LeaseSetPrivateKey),
outproxy.SetLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
outproxy.SetAllowZeroIn(config.InAllowZeroHop),
outproxy.SetAllowZeroOut(config.OutAllowZeroHop),
outproxy.SetFastRecieve(config.FastRecieve),
outproxy.SetCompress(config.UseCompression),
outproxy.SetReduceIdle(config.ReduceIdle),
outproxy.SetReduceIdleTimeMs(config.ReduceIdleTime),
outproxy.SetReduceIdleQuantity(config.ReduceIdleQuantity),
outproxy.SetCloseIdle(config.CloseIdle),
outproxy.SetCloseIdleTimeMs(config.CloseIdleTime),
outproxy.SetAccessListType(config.AccessListType),
outproxy.SetAccessList(config.AccessList),
outproxy.SetMessageReliability(config.MessageReliability),
outproxy.SetKeyFile(config.KeyFilePath),
//outproxy.SetTargetForPort443(config.TargetForPort443),
)
}
return nil, nil
}
// NewOutProxyFromConfig generates a new OutProxy from a config file
func NewOutProxyFromConfig(iniFile, SamHost, SamPort string, label ...string) (*outproxy.HttpOutProxy, error) {
if iniFile != "none" {
config, err := i2ptunconf.NewI2PTunConf(iniFile, label...)
if err != nil {
return nil, err
}
if SamHost != "" && SamHost != "127.0.0.1" && SamHost != "localhost" {
config.SamHost = config.GetSAMHost(SamHost, config.SamHost)
}
if SamPort != "" && SamPort != "7656" {
config.SamPort = config.GetSAMPort(SamPort, config.SamPort)
}
return NewHttpOutProxyFromConf(config)
}
return nil, nil
}
// NewOutProxyFromConf generates a SAMforwarder from *i2ptunconf.Conf
func NewHttpOutProxyFromConf(config *i2ptunconf.Conf) (*outproxy.HttpOutProxy, error) {
if config != nil {
return outproxy.NewHttpOutProxydFromOptions(
outproxy.SetHttpType(config.Type),
outproxy.SetHttpSaveFile(config.SaveFile),
outproxy.SetHttpFilePath(config.SaveDirectory),
outproxy.SetHttpHost(config.TargetHost),
outproxy.SetHttpPort(config.TargetPort),
outproxy.SetHttpSAMHost(config.SamHost),
outproxy.SetHttpSAMPort(config.SamPort),
outproxy.SetHttpSigType(config.SigType),
outproxy.SetHttpName(config.TunName),
outproxy.SetHttpInLength(config.InLength),
outproxy.SetHttpOutLength(config.OutLength),
outproxy.SetHttpInVariance(config.InVariance),
outproxy.SetHttpOutVariance(config.OutVariance),
outproxy.SetHttpInQuantity(config.InQuantity),
outproxy.SetHttpOutQuantity(config.OutQuantity),
outproxy.SetHttpInBackups(config.InBackupQuantity),
outproxy.SetHttpOutBackups(config.OutBackupQuantity),
outproxy.SetHttpEncrypt(config.EncryptLeaseSet),
outproxy.SetHttpLeaseSetKey(config.LeaseSetKey),
outproxy.SetHttpLeaseSetPrivateKey(config.LeaseSetPrivateKey),
outproxy.SetHttpLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
outproxy.SetHttpAllowZeroIn(config.InAllowZeroHop),
outproxy.SetHttpAllowZeroOut(config.OutAllowZeroHop),
outproxy.SetHttpFastRecieve(config.FastRecieve),
outproxy.SetHttpCompress(config.UseCompression),
outproxy.SetHttpReduceIdle(config.ReduceIdle),
outproxy.SetHttpReduceIdleTimeMs(config.ReduceIdleTime),
outproxy.SetHttpReduceIdleQuantity(config.ReduceIdleQuantity),
outproxy.SetHttpCloseIdle(config.CloseIdle),
outproxy.SetHttpCloseIdleTimeMs(config.CloseIdleTime),
outproxy.SetHttpAccessListType(config.AccessListType),
outproxy.SetHttpAccessList(config.AccessList),
outproxy.SetHttpMessageReliability(config.MessageReliability),
outproxy.SetHttpKeyFile(config.KeyFilePath),
//outproxy.SetHttpTargetForPort443(config.TargetForPort443),
)
}
return nil, nil
}
// NewOutProxyFromConfig generates a new OutProxy from a config file
func NewHttpOutProxyFromConfig(iniFile, SamHost, SamPort string, label ...string) (*outproxy.OutProxy, error) {
if iniFile != "none" {
config, err := i2ptunconf.NewI2PTunConf(iniFile, label...)
if err != nil {
return nil, err
}
if SamHost != "" && SamHost != "127.0.0.1" && SamHost != "localhost" {
config.SamHost = config.GetSAMHost(SamHost, config.SamHost)
}
if SamPort != "" && SamPort != "7656" {
config.SamPort = config.GetSAMPort(SamPort, config.SamPort)
}
return NewOutProxyFromConf(config)
}
return nil, nil
}

View File

@@ -44,6 +44,12 @@ func (c *Conf) GetTypes(argc, argu, argh bool, def string, label ...string) stri
if def == "vpnserver" {
return def
}
if def == "outproxy" {
return def
}
if def == "outproxyhttp" {
return def
}
if def == "browserclient" {
return def
}
@@ -92,6 +98,10 @@ func (c *Conf) SetType(label ...string) {
c.Type = v
case "eephttpd":
c.Type = v
case "outproxy":
c.Type = v
case "outproxyhttp":
c.Type = v
case "vpnserver":
c.Type = v
case "vpnclient":

View File

@@ -40,13 +40,13 @@ outbound.length = 3
destination = i2p-projekt.i2p
keys = tcpclient
[sam-forwarder-udp-server]
type = udpserver
host = 127.0.0.1
port = 8084
#[sam-forwarder-udp-server]
#type = udpserver
#host = 127.0.0.1
#port = 8084
#inbound.length = 6
outbound.length = 3
keys = udpserver
#outbound.length = 3
#keys = udpserver
#[sam-forwarder-udp-client]
#type = udpclient
@@ -72,3 +72,12 @@ keys = httpserver
#inbound.length = 3
#outbound.length = 3
#keys = proxy
[sam-forwarder-tcp-socks-outproxy]
type = client
host = 127.0.0.1
port = 8087
inbound.length = 2
outbound.length = 3
destination = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq.b32.i2p
keys = tcpclient

View File

@@ -1,5 +0,0 @@
eepHttpd, a standalone static web server for i2p
================================================
* [Official version:](https://github.com/eyedeekay/eephttpd)
* [See also:](https://eyedeekay.github.io/eephttpd/docs/EMBEDDING.md)

View File

@@ -1,126 +0,0 @@
package main
/*
WARNING: This is not the official version of eephttpd. It is an older
verion I use to test new sam-forwarder features. It is not intended for
use.
*/
import (
"crypto/tls"
"flag"
"log"
"net/http"
"path/filepath"
)
import (
"github.com/eyedeekay/sam-forwarder/config"
"github.com/eyedeekay/sam-forwarder/tcp"
)
var cfg = &tls.Config{
MinVersion: tls.VersionTLS12,
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
PreferServerCipherSuites: true,
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
},
}
var (
host = flag.String("a", "127.0.0.1", "hostname to serve on")
port = flag.String("p", "7880", "port to serve locally on")
samhost = flag.String("sh", "127.0.0.1", "sam host to connect to")
samport = flag.String("sp", "7656", "sam port to connect to")
directory = flag.String("d", "./www", "the directory of static files to host(default ./www)")
sdirectory = flag.String("s", ".", "the directory to save the keys in(default ./)")
usei2p = flag.Bool("i", true, "save i2p keys(and thus destinations) across reboots")
servicename = flag.String("n", "static-eepSite", "name to give the tunnel(default static-eepSite)")
useCompression = flag.Bool("g", true, "Uze gzip(true or false)")
injectHeaders = flag.Bool("x", true, "Inject X-I2P-DEST headers")
accessListType = flag.String("l", "none", "Type of access list to use, can be \"whitelist\" \"blacklist\" or \"none\".")
encryptLeaseSet = flag.Bool("c", false, "Use an encrypted leaseset(true or false)")
allowZeroHop = flag.Bool("z", false, "Allow zero-hop, non-anonymous tunnels(true or false)")
reduceIdle = flag.Bool("r", false, "Reduce tunnel quantity when idle(true or false)")
reduceIdleTime = flag.Int("rt", 600000, "Reduce tunnel quantity after X (milliseconds)")
reduceIdleQuantity = flag.Int("rc", 3, "Reduce idle tunnel quantity to X (0 to 5)")
inLength = flag.Int("il", 3, "Set inbound tunnel length(0 to 7)")
outLength = flag.Int("ol", 3, "Set outbound tunnel length(0 to 7)")
inQuantity = flag.Int("iq", 8, "Set inbound tunnel quantity(0 to 15)")
outQuantity = flag.Int("oq", 8, "Set outbound tunnel quantity(0 to 15)")
inVariance = flag.Int("iv", 0, "Set inbound tunnel length variance(-7 to 7)")
outVariance = flag.Int("ov", 0, "Set outbound tunnel length variance(-7 to 7)")
inBackupQuantity = flag.Int("ib", 4, "Set inbound tunnel backup quantity(0 to 5)")
outBackupQuantity = flag.Int("ob", 4, "Set outbound tunnel backup quantity(0 to 5)")
iniFile = flag.String("f", "none", "Use an ini file for configuration")
useTLS = flag.Bool("t", false, "Generate or use an existing TLS certificate")
certFile = flag.String("m", "cert", "Certificate name to use")
)
func main() {
flag.Parse()
var forwarder *samforwarder.SAMForwarder
var err error
config := i2ptunconf.NewI2PBlankTunConf()
if *iniFile != "none" {
config, err = i2ptunconf.NewI2PTunConf(*iniFile)
}
config.TargetHost = config.GetHost(*host, "127.0.0.1")
config.TargetPort = config.GetPort(*port, "7880")
config.SaveFile = config.GetSaveFile(*usei2p, true)
config.SaveDirectory = config.GetDir(*sdirectory, "../")
config.SamHost = config.GetSAMHost(*samhost, "127.0.0.1")
config.SamPort = config.GetSAMPort(*samport, "7656")
config.TunName = config.GetKeys(*servicename, "static-eepSite")
config.InLength = config.GetInLength(*inLength, 3)
config.OutLength = config.GetOutLength(*outLength, 3)
config.InVariance = config.GetInVariance(*inVariance, 0)
config.OutVariance = config.GetOutVariance(*outVariance, 0)
config.InQuantity = config.GetInQuantity(*inQuantity, 6)
config.OutQuantity = config.GetOutQuantity(*outQuantity, 6)
config.InBackupQuantity = config.GetInBackups(*inBackupQuantity, 5)
config.OutBackupQuantity = config.GetOutBackups(*outBackupQuantity, 5)
config.EncryptLeaseSet = config.GetEncryptLeaseset(*encryptLeaseSet, false)
config.InAllowZeroHop = config.GetInAllowZeroHop(*allowZeroHop, false)
config.OutAllowZeroHop = config.GetOutAllowZeroHop(*allowZeroHop, false)
config.UseCompression = config.GetUseCompression(*useCompression, true)
config.ReduceIdle = config.GetReduceOnIdle(*reduceIdle, true)
config.ReduceIdleTime = config.GetReduceIdleTime(*reduceIdleTime, 600000)
config.ReduceIdleQuantity = config.GetReduceIdleQuantity(*reduceIdleQuantity, 2)
config.CloseIdleTime = config.GetCloseIdleTime(*reduceIdleTime, 600000)
config.AccessListType = config.GetAccessListType(*accessListType, "none")
config.Type = config.GetType(false, false, *injectHeaders, "server")
if forwarder, err = i2ptunconf.NewSAMForwarderFromConf(config); err != nil {
log.Fatal(err.Error())
}
go forwarder.Serve()
if *useTLS {
srv := &http.Server{
Addr: *host + ":" + *port,
Handler: http.FileServer(http.Dir(*directory)),
TLSConfig: cfg,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
}
log.Printf("Serving %s on HTTPS port: %s\n\t and on \n%s", *directory, *port, forwarder.Base32())
log.Fatal(
srv.ListenAndServeTLS(
filepath.Join(*sdirectory+"/", *certFile+".crt"),
filepath.Join(*sdirectory+"/", *certFile+".key"),
),
)
} else {
log.Printf("Serving %s on HTTP port: %s\n\t and on \n%s", *directory, *port, forwarder.Base32())
log.Fatal(
http.ListenAndServe(
*host+":"+*port,
http.FileServer(http.Dir(*directory)),
),
)
}
}

View File

@@ -1,33 +0,0 @@
package main package main
import ( import (
"flag" "flag"
"log" "log"
"net/http" "net/http"
) )
> import "github.com/eyedeekay/sam-forwarder"
>
func main() { func main() {
port := flag.String("p", "8101", "port to serve on") | port := flag.String("p", "8100", "port to serve on")
directory := flag.String("d", ".", "the directory of static file to host") directory := flag.String("d", ".", "the directory of static file to host")
flag.Parse() flag.Parse()
> forwarder, err := samforwarder.NewSAMForwarderFromOptions(
> samforwarder.SetHost("127.0.0.1"),
> samforwarder.SetPort(*port),
> samforwarder.SetSAMHost("127.0.0.1"),
> samforwarder.SetSAMPort("7656"),
> samforwarder.SetName("staticfiles"),
> )
> if err != nil {
> log.Fatal(err.Error())
> }
> go forwarder.Serve()
>
http.Handle("/", http.FileServer(http.Dir(*directory))) http.Handle("/", http.FileServer(http.Dir(*directory)))
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port) | log.Printf("Serving %s on HTTP port: %s\n", *directory, *port, "and on",
log.Fatal(http.ListenAndServe(":"+*port, nil)) | forwarder.Base32()+".b32.i2p")
> log.Fatal(http.ListenAndServe("127.0.0.1:"+*port, nil))
} }

View File

@@ -1,33 +0,0 @@
package main
import (
"flag"
"log"
"net/http"
)
import "github.com/eyedeekay/sam-forwarder"
func main() {
port := flag.String("p", "8100", "port to serve on")
directory := flag.String("d", ".", "the directory of static file to host")
flag.Parse()
forwarder, err := samforwarder.NewSAMForwarderFromOptions(
samforwarder.SetHost("127.0.0.1"),
samforwarder.SetPort(*port),
samforwarder.SetSAMHost("127.0.0.1"),
samforwarder.SetSAMPort("7656"),
samforwarder.SetName("staticfiles"),
)
if err != nil {
log.Fatal(err.Error())
}
go forwarder.Serve()
http.Handle("/", http.FileServer(http.Dir(*directory)))
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port, "and on",
forwarder.Base32()+".b32.i2p")
log.Fatal(http.ListenAndServe("127.0.0.1:"+*port, nil))
}

View File

@@ -1,194 +0,0 @@
<h1 id="samcatd---router-independent-tunnel-management-for-i2p">samcatd - Router-independent tunnel management for i2p</h1>
<p>samcatd is a daemon which runs a group of forwarding proxies to provide services over i2p independent of the router. It also serves as a generalized i2p networking utility for power-users. Its intended to be a Swiss-army knife for the SAM API.</p>
<h2 id="usage">usage:</h2>
<pre><code>flag needs an argument: -h
Usage of ./bin/samcatd:
-a string
Type of access list to use, can be &quot;whitelist&quot; &quot;blacklist&quot; or &quot;none&quot;. (default &quot;none&quot;)
-c Client proxy mode(true or false)
-conv string
Display the base32 and base64 values of a specified .i2pkeys file
-cr string
Encrypt/decrypt the key files with a passfile
-css string
custom CSS for web interface (default &quot;css/styles.css&quot;)
-ct int
Reduce tunnel quantity after X (milliseconds) (default 600000)
-d string
Directory to save tunnel configuration file in.
-de string
Destination to connect client&#39;s to by default.
-f string
Use an ini file for configuration(config file options override passed arguments for now.) (default &quot;none&quot;)
-h string
Target host(Host of service to forward to i2p) (default &quot;127.0.0.1&quot;)
-i string
Destination for client tunnels. Ignored for service tunnels. (default &quot;none&quot;)
-ib int
Set inbound tunnel backup quantity(0 to 5) (default 2)
-ih
Inject X-I2P-DEST headers
-il int
Set inbound tunnel length(0 to 7) (default 3)
-iq int
Set inbound tunnel quantity(0 to 15) (default 6)
-iv int
Set inbound tunnel length variance(-7 to 7)
-js string
custom JS for web interface (default &quot;js/scripts.js&quot;)
-k string
key for encrypted leaseset (default &quot;none&quot;)
-l Use an encrypted leaseset(true or false) (default true)
-littleboss string
instruct the littleboss:
start: start and manage this process using service name &quot;service-name&quot;
stop: signal the littleboss to shutdown the process
status: print statistics about the running littleboss
reload: restart the managed process using the executed binary
bypass: disable littleboss, run the program directly (default &quot;bypass&quot;)
-n string
Tunnel name, this must be unique but can be anything. (default &quot;forwarder&quot;)
-ob int
Set outbound tunnel backup quantity(0 to 5) (default 2)
-ol int
Set outbound tunnel length(0 to 7) (default 3)
-oq int
Set outbound tunnel quantity(0 to 15) (default 6)
-ov int
Set outbound tunnel length variance(-7 to 7)
-p string
Target port(Port of service to forward to i2p) (default &quot;8081&quot;)
-pk string
private key for encrypted leaseset (default &quot;none&quot;)
-psk string
private signing key for encrypted leaseset (default &quot;none&quot;)
-r Reduce tunnel quantity when idle(true or false)
-rq int
Reduce idle tunnel quantity to X (0 to 5) (default 3)
-rt int
Reduce tunnel quantity after X (milliseconds) (default 600000)
-s Start a tunnel with the passed parameters(Otherwise, they will be treated as default values.)
-sh string
SAM host (default &quot;127.0.0.1&quot;)
-sp string
SAM port (default &quot;7656&quot;)
-st string
Signature type
-t Use saved file and persist tunnel(If false, tunnel will not persist after program is stopped.
-tls string
(Currently inoperative. Target TLS port(HTTPS Port of service to forward to i2p)
-u UDP mode(true or false)
-w Start web administration interface
-wp string
Web port (default &quot;7957&quot;)
-x Close tunnel idle(true or false)
-z Uze gzip(true or false)
-zi
Allow zero-hop, non-anonymous tunnels in(true or false)
-zo
Allow zero-hop, non-anonymous tunnels out(true or false)</code></pre>
<h1 id="managing-samcatd-save-encryption-keys">managing samcatd save-encryption keys</h1>
<p>In order to keep from saving the .i2pkeys files in plaintext format, samcatd can optionally generate a key and encrypt the .i2pkeys files securely. Of course, to fully benefit from this arrangement, you need to move those keys away from the machine where the tunnel keys(the .i2pkeys file) are located, or protect them in some other way(sandboxing, etc). If you want to use encrypted .i2pkeys files, you can specify a key file to use with the -cr option on the terminal or with keyfile option in the .ini file.</p>
<h1 id="example-config---valid-for-both-ephsite-and-samcat">example config - valid for both ephsite and samcat</h1>
<p>Options are still being added, pretty much as fast as I can put them in. For up-to-the-minute options, see <a href="config/CHECKLIST.md">the checklist</a></p>
<p>(<strong>ephsite</strong> will only use top-level options, but they can be labeled or unlabeled)</p>
<p>(<strong>samcatd</strong> treats the first set of options it sees as the default, and does not start tunnels based on unlabeled options unless passed the -s flag.)</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode ini"><code class="sourceCode ini"><a class="sourceLine" id="cb2-1" title="1"></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="co">## Defaults, these are only invoked with the -start option or if labeled tunnels</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="co">## are not present(samcatd instructions). **THESE** are the correct config files</span></a>
<a class="sourceLine" id="cb2-4" title="4"><span class="co">## to use as defaults, and not the ones in ../sam-forwarder/tunnels.ini, which</span></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="co">## are used for testing settings availability only.</span></a>
<a class="sourceLine" id="cb2-6" title="6"></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="dt">inbound.length </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-8" title="8"><span class="dt">outbound.length </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-9" title="9"><span class="dt">inbound.lengthVariance </span><span class="ot">=</span><span class="st"> </span><span class="dv">0</span></a>
<a class="sourceLine" id="cb2-10" title="10"><span class="dt">outbound.lengthVariance </span><span class="ot">=</span><span class="st"> </span><span class="dv">0</span></a>
<a class="sourceLine" id="cb2-11" title="11"><span class="dt">inbound.backupQuantity </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-12" title="12"><span class="dt">outbound.backupQuantity </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="dt">inbound.quantity </span><span class="ot">=</span><span class="st"> </span><span class="dv">5</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="dt">outbound.quantity </span><span class="ot">=</span><span class="st"> </span><span class="dv">5</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="dt">inbound.allowZeroHop </span><span class="ot">=</span><span class="st"> </span><span class="kw">false</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="dt">outbound.allowZeroHop </span><span class="ot">=</span><span class="st"> </span><span class="kw">false</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="dt">i2cp.encryptLeaseSet </span><span class="ot">=</span><span class="st"> </span><span class="kw">false</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="dt">gzip </span><span class="ot">=</span><span class="st"> </span><span class="kw">true</span></a>
<a class="sourceLine" id="cb2-19" title="19"><span class="dt">i2cp.reduceOnIdle </span><span class="ot">=</span><span class="st"> </span><span class="kw">true</span></a>
<a class="sourceLine" id="cb2-20" title="20"><span class="dt">i2cp.reduceIdleTime </span><span class="ot">=</span><span class="st"> </span><span class="dv">3000000</span></a>
<a class="sourceLine" id="cb2-21" title="21"><span class="dt">i2cp.reduceQuantity </span><span class="ot">=</span><span class="st"> </span><span class="dv">2</span></a>
<a class="sourceLine" id="cb2-22" title="22"><span class="dt">i2cp.enableWhiteList </span><span class="ot">=</span><span class="st"> </span><span class="kw">false</span></a>
<a class="sourceLine" id="cb2-23" title="23"><span class="dt">i2cp.enableBlackList </span><span class="ot">=</span><span class="st"> </span><span class="kw">false</span></a>
<a class="sourceLine" id="cb2-24" title="24"><span class="dt">keyfile </span><span class="ot">=</span><span class="st"> &quot;/usr/share/samcatd/samcatd&quot;</span></a>
<a class="sourceLine" id="cb2-25" title="25"></a>
<a class="sourceLine" id="cb2-26" title="26"><span class="co">#[sam-forwarder-tcp-server]</span></a>
<a class="sourceLine" id="cb2-27" title="27"><span class="co">#type = server</span></a>
<a class="sourceLine" id="cb2-28" title="28"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-29" title="29"><span class="co">#port = 8081</span></a>
<a class="sourceLine" id="cb2-30" title="30"><span class="co">#inbound.length = 3</span></a>
<a class="sourceLine" id="cb2-31" title="31"><span class="co">#outbound.length = 3</span></a>
<a class="sourceLine" id="cb2-32" title="32"><span class="co">#keys = forwarder</span></a>
<a class="sourceLine" id="cb2-33" title="33"></a>
<a class="sourceLine" id="cb2-34" title="34"><span class="kw">[sam-forwarder-tcp-client]</span></a>
<a class="sourceLine" id="cb2-35" title="35"><span class="dt">type </span><span class="ot">=</span><span class="st"> client</span></a>
<a class="sourceLine" id="cb2-36" title="36"><span class="dt">host </span><span class="ot">=</span><span class="st"> </span><span class="dv">127</span><span class="st">.</span><span class="dv">0</span><span class="st">.</span><span class="fl">0.1</span></a>
<a class="sourceLine" id="cb2-37" title="37"><span class="dt">port </span><span class="ot">=</span><span class="st"> </span><span class="dv">8082</span></a>
<a class="sourceLine" id="cb2-38" title="38"><span class="dt">inbound.length </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-39" title="39"><span class="dt">outbound.length </span><span class="ot">=</span><span class="st"> </span><span class="dv">3</span></a>
<a class="sourceLine" id="cb2-40" title="40"><span class="dt">destination </span><span class="ot">=</span><span class="st"> i2p-projekt.i2p</span></a>
<a class="sourceLine" id="cb2-41" title="41"><span class="dt">keys </span><span class="ot">=</span><span class="st"> forwarder-two</span></a>
<a class="sourceLine" id="cb2-42" title="42"></a>
<a class="sourceLine" id="cb2-43" title="43"><span class="co">#[sam-forwarder-udp-server]</span></a>
<a class="sourceLine" id="cb2-44" title="44"><span class="co">#type = udpserver</span></a>
<a class="sourceLine" id="cb2-45" title="45"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-46" title="46"><span class="co">#port = 8084</span></a>
<a class="sourceLine" id="cb2-47" title="47"><span class="co">#inbound.length = 6</span></a>
<a class="sourceLine" id="cb2-48" title="48"><span class="co">#outbound.length = 3</span></a>
<a class="sourceLine" id="cb2-49" title="49"><span class="co">#keys = forwarder-four</span></a>
<a class="sourceLine" id="cb2-50" title="50"></a>
<a class="sourceLine" id="cb2-51" title="51"><span class="co">#[sam-forwarder-udp-client]</span></a>
<a class="sourceLine" id="cb2-52" title="52"><span class="co">#type = udpclient</span></a>
<a class="sourceLine" id="cb2-53" title="53"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-54" title="54"><span class="co">#port = 8083</span></a>
<a class="sourceLine" id="cb2-55" title="55"><span class="co">#inbound.length = 3</span></a>
<a class="sourceLine" id="cb2-56" title="56"><span class="co">#outbound.length = 3</span></a>
<a class="sourceLine" id="cb2-57" title="57"><span class="co">#destination = i2p-projekt.i2p</span></a>
<a class="sourceLine" id="cb2-58" title="58"><span class="co">#keys = forwarder-three</span></a>
<a class="sourceLine" id="cb2-59" title="59"></a>
<a class="sourceLine" id="cb2-60" title="60"><span class="co">#[sam-forwarder-tcp-http-server]</span></a>
<a class="sourceLine" id="cb2-61" title="61"><span class="co">#type = http</span></a>
<a class="sourceLine" id="cb2-62" title="62"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-63" title="63"><span class="co">#port = 8085</span></a>
<a class="sourceLine" id="cb2-64" title="64"><span class="co">#inbound.length = 3</span></a>
<a class="sourceLine" id="cb2-65" title="65"><span class="co">#outbound.length = 3</span></a>
<a class="sourceLine" id="cb2-66" title="66"><span class="co">#keys = forwarder-five</span></a>
<a class="sourceLine" id="cb2-67" title="67"></a>
<a class="sourceLine" id="cb2-68" title="68"><span class="co">#[sam-forwarder-vpn-server]</span></a>
<a class="sourceLine" id="cb2-69" title="69"><span class="co">#type = udpserver</span></a>
<a class="sourceLine" id="cb2-70" title="70"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-71" title="71"><span class="co">#port = 8084</span></a>
<a class="sourceLine" id="cb2-72" title="72"><span class="co">#inbound.length = 2</span></a>
<a class="sourceLine" id="cb2-73" title="73"><span class="co">#outbound.length = 2</span></a>
<a class="sourceLine" id="cb2-74" title="74"><span class="co">#inbound.backupQuantity = 3</span></a>
<a class="sourceLine" id="cb2-75" title="75"><span class="co">#outbound.backupQuantity = 3</span></a>
<a class="sourceLine" id="cb2-76" title="76"><span class="co">#inbound.quantity = 5</span></a>
<a class="sourceLine" id="cb2-77" title="77"><span class="co">#outbound.quantity = 5</span></a>
<a class="sourceLine" id="cb2-78" title="78"><span class="co">#i2cp.reduceOnIdle = true</span></a>
<a class="sourceLine" id="cb2-79" title="79"><span class="co">#i2cp.reduceIdleTime = 3000000</span></a>
<a class="sourceLine" id="cb2-80" title="80"><span class="co">#i2cp.reduceQuantity = 2</span></a>
<a class="sourceLine" id="cb2-81" title="81"><span class="co">#i2cp.closeOnIdle = false</span></a>
<a class="sourceLine" id="cb2-82" title="82"><span class="co">#keys = i2pvpnserver</span></a>
<a class="sourceLine" id="cb2-83" title="83"></a>
<a class="sourceLine" id="cb2-84" title="84"><span class="co">#[sam-forwarder-vpn-client]</span></a>
<a class="sourceLine" id="cb2-85" title="85"><span class="co">#type = udpclient</span></a>
<a class="sourceLine" id="cb2-86" title="86"><span class="co">#host = 127.0.0.1</span></a>
<a class="sourceLine" id="cb2-87" title="87"><span class="co">#port = 8085</span></a>
<a class="sourceLine" id="cb2-88" title="88"><span class="co">#inbound.length = 2</span></a>
<a class="sourceLine" id="cb2-89" title="89"><span class="co">#outbound.length = 2</span></a>
<a class="sourceLine" id="cb2-90" title="90"><span class="co">#inbound.backupQuantity = 3</span></a>
<a class="sourceLine" id="cb2-91" title="91"><span class="co">#outbound.backupQuantity = 3</span></a>
<a class="sourceLine" id="cb2-92" title="92"><span class="co">#inbound.quantity = 5</span></a>
<a class="sourceLine" id="cb2-93" title="93"><span class="co">#outbound.quantity = 5</span></a>
<a class="sourceLine" id="cb2-94" title="94"><span class="co">#i2cp.reduceOnIdle = true</span></a>
<a class="sourceLine" id="cb2-95" title="95"><span class="co">#i2cp.reduceIdleTime = 3000000</span></a>
<a class="sourceLine" id="cb2-96" title="96"><span class="co">#i2cp.reduceQuantity = 2</span></a>
<a class="sourceLine" id="cb2-97" title="97"><span class="co">#destination = adestinationisrequiredorbespecifiedatruntime.i2p</span></a>
<a class="sourceLine" id="cb2-98" title="98"><span class="co">#keys = i2pvpnclient</span></a></code></pre></div>

19
go.mod
View File

@@ -3,21 +3,24 @@ module github.com/eyedeekay/sam-forwarder
go 1.12
require (
crawshaw.io/littleboss v0.0.0-20190317185602-8957d0aedcce // indirect
crawshaw.io/littleboss v0.0.0-20190317185602-8957d0aedcce
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/boreq/friendlyhash v0.0.0-20190522010448-1ca64b3ca69e
github.com/d5/tengo v1.24.3 // indirect
github.com/cryptix/goSam v0.1.0 // indirect
github.com/eyedeekay/eephttpd v0.0.0-20190903000420-52f5a8485a4e
github.com/eyedeekay/httptunnel v0.0.0-20190831071439-0ff3d5f798fb
github.com/eyedeekay/i2pdig v0.0.0-20180718204453-a67cb46e2e5f // indirect
github.com/eyedeekay/outproxy v0.0.0-20190908174238-22bd71d43733
github.com/eyedeekay/portcheck v0.0.0-20190218044454-bb8718669680
github.com/eyedeekay/sam3 v0.0.0-20190730185140-f8d54526ea25
github.com/eyedeekay/sam3 v0.32.1
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/justinas/nosurf v0.0.0-20190416172904-05988550ea18
github.com/kr/pretty v0.2.0 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/zieckey/goini v0.0.0-20180118150432-0da17d361d26
github.com/zserge/lorca v0.1.8
github.com/zserge/webview v0.0.0-20190123072648-16c93bcaeaeb
gitlab.com/golang-commonmark/html v0.0.0-20180917080848-cfaf75183c4a // indirect
gitlab.com/golang-commonmark/linkify v0.0.0-20180917065525-c22b7bdb1179 // indirect
gitlab.com/golang-commonmark/markdown v0.0.0-20181102083822-772775880e1f // indirect
gitlab.com/golang-commonmark/mdurl v0.0.0-20180912090424-e5bce34c34f2 // indirect
gitlab.com/golang-commonmark/puny v0.0.0-20180912090636-2cd490539afe // indirect
gitlab.com/opennota/wd v0.0.0-20191124020556-236695b0ea63 // indirect
)

View File

@@ -43,6 +43,20 @@ func DefaultCSS() string {
float: left;
overflow-wrap: break-word;
}
.outproxy {
width: 63%;
min-height: 15%;
background-color: #265ea7;
float: left;
overflow-wrap: break-word;
}
.outproxyhttp {
width: 63%;
min-height: 15%;
background-color: #265ea7;
float: left;
overflow-wrap: break-word;
}
.udpclient {
width: 63%;
min-height: 15%;

View File

@@ -41,10 +41,6 @@ func SetAccessList(s []string) func(SAMTunnel) error {
//SetCompress tells clients to use compression
func SetCompress(b bool) func(SAMTunnel) error {
return func(c SAMTunnel) error {
if b {
c.Config().UseCompression = b // "true"
return nil
}
c.Config().UseCompression = b // "false"
return nil
}
@@ -58,7 +54,7 @@ func SetFilePath(s string) func(SAMTunnel) error {
}
}
//SetControlHost sets the host of the service to forward
//SetControlHost sets the host of the service to present an API on
func SetControlHost(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().ControlHost = s
@@ -66,7 +62,7 @@ func SetControlHost(s string) func(SAMTunnel) error {
}
}
//SetControlPort sets the port of the service to forward
//SetControlPort sets the port of the service to present an API on
func SetControlPort(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
port, err := strconv.Atoi(s)
@@ -81,7 +77,8 @@ func SetControlPort(s string) func(SAMTunnel) error {
}
}
//SetKeyFile sets
//SetKeyFile sets the path to a file containing a private key for decrypting
//locally-encrypted i2p keys.
func SetKeyFile(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().KeyFilePath = s
@@ -89,7 +86,7 @@ func SetKeyFile(s string) func(SAMTunnel) error {
}
}
//SetSaveFile tells the router to save the tunnel's keys long-term
//SetDestination tells the
func SetDestination(b string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().ClientDest = b
@@ -97,7 +94,7 @@ func SetDestination(b string) func(SAMTunnel) error {
}
}
//SetTunnelHost is used for VPN endpoints
//SetTunnelHost is used for VPN endpoints only.
func SetTunnelHost(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().TunnelHost = s
@@ -136,19 +133,15 @@ func SetPort(s string) func(SAMTunnel) error {
}
}
//SetEncrypt tells the router to use an encrypted leaseset
//SetEncrypt tells the outproxy.SetHttp to use an encrypted leaseset
func SetEncrypt(b bool) func(SAMTunnel) error {
return func(c SAMTunnel) error {
if b {
c.Config().EncryptLeaseSet = b //"true"
return nil
}
c.Config().EncryptLeaseSet = b //"false"
return nil
}
}
//SetLeaseSetKey sets the host of the Conf's SAM bridge
//SetLeaseSetKey sets key to use with the encrypted leaseset
func SetLeaseSetKey(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().LeaseSetKey = s
@@ -156,7 +149,7 @@ func SetLeaseSetKey(s string) func(SAMTunnel) error {
}
}
//SetLeaseSetPrivateKey sets the host of the Conf's SAM bridge
//SetLeaseSetPrivateKey sets the private key to use with the encrypted leaseset
func SetLeaseSetPrivateKey(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().LeaseSetPrivateKey = s
@@ -164,7 +157,7 @@ func SetLeaseSetPrivateKey(s string) func(SAMTunnel) error {
}
}
//SetLeaseSetPrivateSigningKey sets the host of the Conf's SAM bridge
//SetLeaseSetPrivateSigningKey sets the private signing key to use with the encrypted leaseset
func SetLeaseSetPrivateSigningKey(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().LeaseSetPrivateSigningKey = s
@@ -202,7 +195,7 @@ func SetName(s string) func(SAMTunnel) error {
}
}
//SetSaveFile tells the router to save the tunnel's keys long-term
//SetSaveFile tells the application to save the tunnel's keys long-term
func SetSaveFile(b bool) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().SaveFile = b
@@ -400,7 +393,7 @@ func SetType(s string) func(SAMTunnel) error {
}
}
//SetUserName sets the host of the Conf's SAM bridge
//SetUserName sets username for authentication purposes
func SetUserName(s string) func(SAMTunnel) error {
return func(c SAMTunnel) error {
c.Config().UserName = s

View File

@@ -5,31 +5,51 @@ import (
"github.com/eyedeekay/sam3/i2pkeys"
)
// SAMTunnel is an interface comprehensively representing an I2P tunnel over SAM
// in Go
type SAMTunnel interface {
// Config returns the appropriate underlying config object all options, or
// the common options passed into a compound tunnel.
Config() *i2ptunconf.Conf
// Tunnel Options
GetType() string // Get the type of the tunnel in use(server, client, http, udp, etc)
Print() string // Print all the tunnel options as a string
Props() map[string]string //Get a full list of tunnel properties as a map for user display/analysis
Search(search string) string //Search the Props for a common term
Target() string //The address of the local client or service to forward with a SAM tunnel
ID() string //The user-chosen tunnel ID
// GetType Get the type of the tunnel in use(server, client, http, udp, etc)
GetType() string
// Print all the tunnel options as a string
Print() string
// Props Get a full list of tunnel properties as a map for user display/analysis
Props() map[string]string
//Search the Props for a common term
Search(search string) string
//Target The address of the local client or service to forward with a SAM tunnel
Target() string
//ID The user-chosen tunnel name
ID() string
//Destination() string
// Key handling
Base32() string // Get the .b32.i2p address of your service
Base32Readable() string // Create a more-readable representation of the .b32.i2p address using English words
Base64() string // Get the public base64 address of your I2P service
Keys() i2pkeys.I2PKeys // Get all the parts of the keys to your I2P service
// Get the .b32.i2p address of your service
Base32() string
// Create a more-readable representation of the .b32.i2p address using English words
Base32Readable() string
// Get the public base64 address of your I2P service
Base64() string
// Get all the parts of the keys to your I2P service
Keys() i2pkeys.I2PKeys
// Service Management
Load() (SAMTunnel, error) // Prepare tunnel keys and tunnel options
Serve() error // Start the tunnel
Close() error // Stop the tunnel and close all connections
Cleanup() // Stop the tunnel but leave the sockets alone for now
Up() bool // Return "true" if the tunnel is ready to go up.
// Prepare tunnel keys and tunnel options
Load() (SAMTunnel, error)
// Start the tunnel
Serve() error
// Stop the tunnel and close all connections
Close() error
// Stop the tunnel but leave the sockets alone for now
Cleanup()
// Return "true" if the tunnel is ready to go up.
Up() bool
}
// WebUI is an interface which is used to generate a minimal UI. Open to suggestions.
type WebUI interface {
Title() string
URL() string

View File

@@ -184,6 +184,20 @@ func NewSAMManagerFromOptions(opts ...func(*SAMManager) error) (*SAMManager, err
} else {
return nil, e
}
case "outproxy":
if f, e := samtunnelhandler.NewTunnelHandler(i2ptunhelper.NewOutProxyFromConfig(s.config.FilePath, s.SamHost, s.SamPort, label)); e == nil {
log.Println("found outproxy under", label)
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}
case "outproxyhttp":
if f, e := samtunnelhandler.NewTunnelHandler(i2ptunhelper.NewHttpOutProxyFromConfig(s.config.FilePath, s.SamHost, s.SamPort, label)); e == nil {
log.Println("found outproxy under", label)
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}
/*case "vpnserver":
if f, e := samtunnelhandler.NewTunnelHandler(samforwardervpnserver.NewSAMVPNForwarderFromConfig(s.config.FilePath, s.SamHost, s.SamPort, label)); e == nil {
log.Println("found vpnserver under", label)
@@ -271,20 +285,34 @@ func NewSAMManagerFromOptions(opts ...func(*SAMManager) error) (*SAMManager, err
} else {
return nil, e
}
/*case "vpnserver":
if f, e := samtunnelhandler.NewTunnelHandler(samforwardervpnserver.NewSAMVPNForwarderFromConf(s.config)); e == nil {
log.Println("found default vpnserver")
case "outproxy":
if f, e := samtunnelhandler.NewTunnelHandler(i2ptunhelper.NewOutProxyFromConf(s.config)); e == nil {
log.Println("found default udpclient")
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}
case "vpnclient":
if f, e := samtunnelhandler.NewTunnelHandler(samforwardervpn.NewSAMVPNClientForwarderFromConf(s.config)); e == nil {
log.Println("found default vpnclient")
case "outproxyhttp":
if f, e := samtunnelhandler.NewTunnelHandler(i2ptunhelper.NewHttpOutProxyFromConf(s.config)); e == nil {
log.Println("found default udpclient")
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}*/
}
/*case "vpnserver":
if f, e := samtunnelhandler.NewTunnelHandler(samforwardervpnserver.NewSAMVPNForwarderFromConf(s.config)); e == nil {
log.Println("found default vpnserver")
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}
case "vpnclient":
if f, e := samtunnelhandler.NewTunnelHandler(samforwardervpn.NewSAMVPNClientForwarderFromConf(s.config)); e == nil {
log.Println("found default vpnclient")
s.handlerMux = s.handlerMux.Append(f)
} else {
return nil, e
}*/
default:
if f, e := samtunnelhandler.NewTunnelHandler(i2ptunhelper.NewSAMClientForwarderFromConf(s.config)); e == nil {
log.Println("found default client")

View File

@@ -1,4 +1,5 @@
// +build nostatic
// +build !static !cli
package sammanager

View File

@@ -1,4 +1,5 @@
// +build !static,!nostatic
// +build cli
// +build !nostatic !static
package sammanager
@@ -9,12 +10,12 @@ import (
"time"
)
func RunUI() {
func (s *SAMManager) RunUI() {
}
func (s *app) Serve() bool {
func (s *SAMManager) Serve() bool {
log.Println("Starting Tunnels()")
for _, element := range s.clientMux.Tunnels() {
for _, element := range s.handlerMux.Tunnels() {
log.Println("Starting service tunnel", element.ID())
go element.Serve()
}

View File

@@ -1,4 +1,5 @@
// +build !nostatic
// +build static
// +build !nostatic !cli
package sammanager

View File

@@ -19,7 +19,7 @@ import (
"github.com/eyedeekay/sam-forwarder/i2pkeys"
"github.com/eyedeekay/sam-forwarder/interface"
"github.com/eyedeekay/sam3"
"github.com/eyedeekay/sam3/i2pkeys"
i2pkeys "github.com/eyedeekay/sam3/i2pkeys"
)
//SAMForwarder is a structure which automatically configured the forwarding of
@@ -214,7 +214,7 @@ func (f *SAMForwarder) HTTPRequestBytes(conn *sam3.SAMConn) ([]byte, *http.Reque
dest := conn.RemoteAddr().(i2pkeys.I2PAddr)
request.Header.Add("X-I2p-Dest-Base64", dest.Base64())
request.Header.Add("X-I2p-Dest-Base32", dest.Base32())
request.Header.Add("X-I2p-Dest-Hash", dest.DestHash().String())
request.Header.Add("X-I2p-Dest-Hash", dest.DestHash().Hash())
if retrequest, err = httputil.DumpRequest(request, true); err != nil {
return nil, nil, err
}
@@ -229,8 +229,6 @@ func (f *SAMForwarder) HTTPResponseBytes(conn net.Conn, req *http.Request) ([]by
if err != nil {
return nil, err
}
response.Header.Add("X-I2p-Dest-Base64", f.Base64())
response.Header.Add("X-I2p-Dest-Base32", f.Base32())
if retresponse, err = httputil.DumpResponse(response, true); err != nil {
return nil, err
}

View File

@@ -15,7 +15,7 @@ import (
"github.com/eyedeekay/sam-forwarder/i2pkeys"
"github.com/eyedeekay/sam-forwarder/interface"
"github.com/eyedeekay/sam3"
"github.com/eyedeekay/sam3/i2pkeys"
i2pkeys "github.com/eyedeekay/sam3/i2pkeys"
)
//SAMSSUClientForwarder is a structure which automatically configured the forwarding of