Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
71ca8cd65f | ||
![]() |
60e9f15b18 | ||
![]() |
ee8617deb0 |
2
Makefile
2
Makefile
@@ -17,7 +17,7 @@ LOG := log/
|
||||
ETC := etc/
|
||||
USR := usr/
|
||||
LOCAL := local/
|
||||
VERSION := 0.32.07
|
||||
VERSION := 0.32.081
|
||||
|
||||
GO111MODULE=on
|
||||
|
||||
|
130
config/helpers/tunconf_outproxy.go
Normal file
130
config/helpers/tunconf_outproxy.go
Normal 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
|
||||
}
|
@@ -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":
|
||||
|
@@ -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,11 @@ keys = httpserver
|
||||
#inbound.length = 3
|
||||
#outbound.length = 3
|
||||
#keys = proxy
|
||||
|
||||
[sam-forwarder-tcp-socks-outproxy]
|
||||
type = outproxy
|
||||
host = 127.0.0.1
|
||||
port = 8087
|
||||
inbound.length = 3
|
||||
outbound.length = 3
|
||||
keys = outproxy
|
||||
|
8
go.mod
8
go.mod
@@ -3,11 +3,10 @@ module github.com/eyedeekay/sam-forwarder
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
crawshaw.io/littleboss v0.0.0-20190317185602-8957d0aedcce // indirect
|
||||
github.com/boreq/friendlyhash v0.0.0-20190522010448-1ca64b3ca69e
|
||||
github.com/d5/tengo v1.24.3 // indirect
|
||||
github.com/eyedeekay/eephttpd v0.0.0-20190903000420-52f5a8485a4e
|
||||
github.com/eyedeekay/httptunnel v0.0.0-20190831071439-0ff3d5f798fb
|
||||
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
|
||||
@@ -15,9 +14,4 @@ require (
|
||||
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
|
||||
)
|
||||
|
@@ -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%;
|
||||
|
@@ -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")
|
||||
|
Reference in New Issue
Block a user