6 Commits

Author SHA1 Message Date
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
8 changed files with 73 additions and 44 deletions

View File

@ -19,7 +19,7 @@ USR := usr/
LOCAL := local/
VERSION := 0.32.081
GO111MODULE=on
GO111MODULE=off
echo:
@echo "$(GOPATH)"
@ -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

@ -74,9 +74,10 @@ keys = httpserver
#keys = proxy
[sam-forwarder-tcp-socks-outproxy]
type = outproxy
type = client
host = 127.0.0.1
port = 8087
inbound.length = 3
inbound.length = 2
outbound.length = 3
keys = outproxy
destination = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq.b32.i2p
keys = tcpclient

4
go.mod
View File

@ -3,14 +3,18 @@ module github.com/eyedeekay/sam-forwarder
go 1.12
require (
crawshaw.io/littleboss v0.0.0-20190317185602-8957d0aedcce
github.com/boreq/friendlyhash v0.0.0-20190522010448-1ca64b3ca69e
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/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/justinas/nosurf v0.0.0-20190416172904-05988550ea18
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

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

@ -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