10 Commits

Author SHA1 Message Date
idk
d67c0c0e31 move the helpers 2019-08-31 03:12:54 -04:00
idk
e88e3a0a6b move the helpers 2019-08-31 03:12:09 -04:00
idk
f530ccd37f Fix the helpers 2019-08-31 03:05:50 -04:00
idk
afdc44afc6 Fix the helpers 2019-08-31 03:02:13 -04:00
idk
6b873f4fc2 update the interface 2019-08-31 02:50:11 -04:00
idk
c427d576cb more prep to reduce the amount of repeated configuration code 2019-08-31 00:13:20 -04:00
idk
383fafea25 more prep to reduce the amount of repeated configuration code 2019-08-31 00:13:10 -04:00
idk
9254afc776 move config stuff around 2019-08-25 20:32:50 -04:00
idk
29c48f906c begin config cleanup 2019-08-25 19:21:11 -04:00
idk
38a4e1b3ad begin config cleanup 2019-08-25 19:20:54 -04:00
169 changed files with 38995 additions and 390 deletions

View File

@@ -7,6 +7,7 @@ network = host
samhost = sam-host
samport = 7656
args = -r
USER_GH=eyedeekay
PREFIX := /
VAR := var/
@@ -16,7 +17,7 @@ LOG := log/
ETC := etc/
USR := usr/
LOCAL := local/
VERSION := 0.1
VERSION := 0.32.03
GO111MODULE=on
@@ -222,3 +223,10 @@ tar:
--exclude .go \
--exclude bin \
-cJvf ../$(packagename)_$(VERSION).orig.tar.xz .
tag:
gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(packagename) -t v$(VERSION) -d "I2P Tunnel Management tool for Go applications"
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

View File

@@ -1,6 +1,8 @@
package i2ptunconf
import "strings"
import (
"strings"
)
// GetAccessListType takes an argument and a default. If the argument differs from the
// default, the argument is always returned. If the argument and default are

181
config/conf.go Normal file
View File

@@ -0,0 +1,181 @@
package i2ptunconf
import (
"fmt"
"strings"
)
import (
"github.com/eyedeekay/sam-forwarder/i2pkeys"
"github.com/eyedeekay/sam3/i2pkeys"
)
var err error
func (f *Conf) ID() string {
return f.TunName
}
func (f *Conf) Keys() i2pkeys.I2PKeys {
return f.LoadedKeys
}
func (f *Conf) Cleanup() {
}
func (f *Conf) GetType() string {
return f.Type
}
/*func (f *Conf) targetForPort443() string {
if f.TargetForPort443 != "" {
return "targetForPort.4443=" + f.TargetHost + ":" + f.TargetForPort443
}
return ""
}*/
func (f *Conf) print() []string {
lsk, lspk, lspsk := f.leasesetsettings()
return []string{
//f.targetForPort443(),
"inbound.length=" + fmt.Sprintf("%d", f.InLength),
"outbound.length=" + fmt.Sprintf("%d", f.OutLength),
"inbound.lengthVariance=" + fmt.Sprintf("%d", f.InVariance),
"outbound.lengthVariance=" + fmt.Sprintf("%d", f.OutVariance),
"inbound.backupQuantity=" + fmt.Sprintf("%d", f.InBackupQuantity),
"outbound.backupQuantity=" + fmt.Sprintf("%d", f.OutBackupQuantity),
"inbound.quantity=" + fmt.Sprintf("%d", f.InQuantity),
"outbound.quantity=" + fmt.Sprintf("%d", f.OutQuantity),
"inbound.allowZeroHop=" + fmt.Sprintf("%b", f.InAllowZeroHop),
"outbound.allowZeroHop=" + fmt.Sprintf("%b", f.OutAllowZeroHop),
"i2cp.fastRecieve=" + fmt.Sprintf("%b", f.FastRecieve),
"i2cp.gzip=" + fmt.Sprintf("%b", f.UseCompression),
"i2cp.reduceOnIdle=" + fmt.Sprintf("%b", f.ReduceIdle),
"i2cp.reduceIdleTime=" + fmt.Sprintf("%d", f.ReduceIdleTime),
"i2cp.reduceQuantity=" + fmt.Sprintf("%d", f.ReduceIdleQuantity),
"i2cp.closeOnIdle=" + fmt.Sprintf("%b", f.CloseIdle),
"i2cp.closeIdleTime=" + fmt.Sprintf("%d", f.CloseIdleTime),
"i2cp.messageReliability=" + f.MessageReliability,
"i2cp.encryptLeaseSet=" + fmt.Sprintf("%b", f.EncryptLeaseSet),
lsk, lspk, lspsk,
f.accesslisttype(),
f.accesslist(),
}
}
func (f *Conf) Props() map[string]string {
r := make(map[string]string)
print := f.print()
print = append(print, "base32="+f.Base32())
print = append(print, "base64="+f.Base64())
print = append(print, "base32words="+f.Base32Readable())
for _, prop := range print {
k, v := sfi2pkeys.Prop(prop)
r[k] = v
}
return r
}
func (f *Conf) Print() string {
var r string
r += "name=" + f.TunName + "\n"
r += "type=" + f.Type + "\n"
if f.Type == "http" {
r += "httpserver\n"
} else {
r += "ntcpserver\n"
}
for _, s := range f.print() {
r += s + "\n"
}
return strings.Replace(r, "\n\n", "\n", -1)
}
func (f *Conf) Search(search string) string {
terms := strings.Split(search, ",")
if search == "" {
return f.Print()
}
for _, value := range terms {
if !strings.Contains(f.Print(), value) {
return ""
}
}
return f.Print()
}
/*
func (f *Conf) accesslisttype() string {
if f.accessListType == "whitelist" {
return "i2cp.enableAccessList=true"
} else if f.accessListType == "blacklist" {
return "i2cp.enableBlackList=true"
} else if f.accessListType == "none" {
return ""
}
return ""
}
func (f *Conf) accesslist() string {
if f.accessListType != "" && len(f.accessList) > 0 {
r := ""
for _, s := range f.accessList {
r += s + ","
}
return "i2cp.accessList=" + strings.TrimSuffix(r, ",")
}
return ""
}
*/
func (f *Conf) leasesetsettings() (string, string, string) {
var r, s, t string
if f.LeaseSetKey != "" {
r = "i2cp.leaseSetKey=" + f.LeaseSetKey
}
if f.LeaseSetPrivateKey != "" {
s = "i2cp.leaseSetPrivateKey=" + f.LeaseSetPrivateKey
}
if f.LeaseSetPrivateSigningKey != "" {
t = "i2cp.leaseSetPrivateSigningKey=" + f.LeaseSetPrivateSigningKey
}
return r, s, t
}
// Target returns the host:port of the local service you want to forward to i2p
func (f *Conf) Target() string {
return f.TargetHost + ":" + f.TargetPort
}
func (f *Conf) sam() string {
return f.SamHost + ":" + f.SamPort
}
//Base32 returns the base32 address where the local service is being forwarded
func (f *Conf) Base32() string {
return f.LoadedKeys.Addr().Base32()
}
//Base32Readable will always be an empty string when used here.
func (f *Conf) Base32Readable() string {
return ""
}
//Base64 returns the base64 address where the local service is being forwarded
func (f *Conf) Base64() string {
return f.LoadedKeys.Addr().Base64()
}
//Serve starts the SAM connection and and forwards the local host:port to i2p
func (f *Conf) Serve() error {
return nil
}
func (f *Conf) Up() bool {
return false
}
//Close shuts the whole thing down.
func (f *Conf) Close() error {
return nil
}

20
config/config-options.go Normal file
View File

@@ -0,0 +1,20 @@
package i2ptunconf
//Option is a Conf Option
type Option func(*Conf) error
//SetTargetForPort sets the port of the Conf's SAM bridge using a string
/*func SetTargetForPort443(s string) func(samtunnel.SAMTunnel) error {
return func(c samtunnel.SAMTunnel) error {
port, err := strconv.Atoi(s)
if err != nil {
return fmt.Errorf("Invalid Target Port %s; non-number ", s)
}
if port < 65536 && port > -1 {
c.TargetForPort443 = s
return nil
}
return fmt.Errorf("Invalid port")
}
}
*/

View File

@@ -1,5 +1,7 @@
package i2ptunconf
//
// GetDir takes an argument and a default. If the argument differs from the
// default, the argument is always returned. If the argument and default are
// the same and the key exists, the key is returned. If the key is absent, the

View File

@@ -47,6 +47,6 @@ func (c *Conf) SetTunName(label ...string) {
if v, ok := c.Get("keys", label...); ok {
c.TunName = v
} else {
c.TunName = "fowarder"
c.TunName = "forwarder"
}
}

View File

@@ -10,6 +10,7 @@ import (
)
import (
"github.com/eyedeekay/sam3/i2pkeys"
"github.com/zieckey/goini"
)
@@ -62,10 +63,11 @@ type Conf struct {
exists bool
UserName string
Password string
LoadedKeys i2pkeys.I2PKeys
}
// Print returns and prints a formatted list of configured tunnel settings.
func (c *Conf) Print() []string {
// PrintSlice returns and prints a formatted list of configured tunnel settings.
func (c *Conf) PrintSlice() []string {
confstring := []string{
c.SignatureType(),
"inbound.length=" + strconv.Itoa(c.InLength),

View File

@@ -1,224 +0,0 @@
package i2ptunconf
import (
"github.com/eyedeekay/httptunnel"
"github.com/eyedeekay/httptunnel/multiproxy"
"github.com/eyedeekay/sam-forwarder/tcp"
"github.com/eyedeekay/sam-forwarder/udp"
)
func NewSAMHTTPClientFromConf(config *Conf) (*i2phttpproxy.SAMHTTPProxy, error) {
if config != nil {
return i2phttpproxy.NewHttpProxy(
i2phttpproxy.SetName(config.TunName),
i2phttpproxy.SetKeysPath(config.KeyFilePath),
i2phttpproxy.SetHost(config.SamHost),
i2phttpproxy.SetPort(config.SamPort),
i2phttpproxy.SetProxyAddr(config.TargetHost+":"+config.TargetPort),
i2phttpproxy.SetControlHost(config.ControlHost),
i2phttpproxy.SetControlPort(config.ControlPort),
i2phttpproxy.SetInLength(uint(config.InLength)),
i2phttpproxy.SetOutLength(uint(config.OutLength)),
i2phttpproxy.SetInQuantity(uint(config.InQuantity)),
i2phttpproxy.SetOutQuantity(uint(config.OutQuantity)),
i2phttpproxy.SetInBackups(uint(config.InBackupQuantity)),
i2phttpproxy.SetOutBackups(uint(config.OutBackupQuantity)),
i2phttpproxy.SetInVariance(config.InVariance),
i2phttpproxy.SetOutVariance(config.OutVariance),
i2phttpproxy.SetUnpublished(config.Client),
i2phttpproxy.SetReduceIdle(config.ReduceIdle),
i2phttpproxy.SetCompression(config.UseCompression),
i2phttpproxy.SetReduceIdleTime(uint(config.ReduceIdleTime)),
i2phttpproxy.SetReduceIdleQuantity(uint(config.ReduceIdleQuantity)),
i2phttpproxy.SetCloseIdle(config.CloseIdle),
i2phttpproxy.SetCloseIdleTime(uint(config.CloseIdleTime)),
)
}
return nil, nil
}
// NewSAMClientForwarderFromConfig generates a new SAMForwarder from a config file
func NewSAMHTTPClientFromConfig(iniFile, SamHost, SamPort string, label ...string) (*i2phttpproxy.SAMHTTPProxy, error) {
if iniFile != "none" {
config, err := 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 NewSAMHTTPClientFromConf(config)
}
return nil, nil
}
func NewSAMBrowserClientFromConf(config *Conf) (*i2pbrowserproxy.SAMMultiProxy, error) {
if config != nil {
return i2pbrowserproxy.NewHttpProxy(
i2pbrowserproxy.SetName(config.TunName),
i2pbrowserproxy.SetKeysPath(config.KeyFilePath),
i2pbrowserproxy.SetHost(config.SamHost),
i2pbrowserproxy.SetPort(config.SamPort),
i2pbrowserproxy.SetProxyAddr(config.TargetHost+":"+config.TargetPort),
i2pbrowserproxy.SetControlHost(config.ControlHost),
i2pbrowserproxy.SetControlPort(config.ControlPort),
i2pbrowserproxy.SetInLength(uint(config.InLength)),
i2pbrowserproxy.SetOutLength(uint(config.OutLength)),
i2pbrowserproxy.SetInQuantity(uint(config.InQuantity)),
i2pbrowserproxy.SetOutQuantity(uint(config.OutQuantity)),
i2pbrowserproxy.SetInBackups(uint(config.InBackupQuantity)),
i2pbrowserproxy.SetOutBackups(uint(config.OutBackupQuantity)),
i2pbrowserproxy.SetInVariance(config.InVariance),
i2pbrowserproxy.SetOutVariance(config.OutVariance),
i2pbrowserproxy.SetUnpublished(config.Client),
i2pbrowserproxy.SetReduceIdle(config.ReduceIdle),
i2pbrowserproxy.SetCompression(config.UseCompression),
i2pbrowserproxy.SetReduceIdleTime(uint(config.ReduceIdleTime)),
i2pbrowserproxy.SetReduceIdleQuantity(uint(config.ReduceIdleQuantity)),
//i2pbrowserproxy.SetCloseIdle(config.CloseIdle),
//i2pbrowserproxy.SetCloseIdleTime(uint(config.CloseIdleTime)),
)
}
return nil, nil
}
func NewSAMBrowserClientFromConfig(iniFile, SamHost, SamPort string, label ...string) (*i2pbrowserproxy.SAMMultiProxy, error) {
if iniFile != "none" {
config, err := 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 NewSAMBrowserClientFromConf(config)
}
return nil, nil
}
// NewSAMClientForwarderFromConf generates a SAMforwarder from *i2ptunconf.Conf
func NewSAMClientForwarderFromConf(config *Conf) (*samforwarder.SAMClientForwarder, error) {
if config != nil {
return samforwarder.NewSAMClientForwarderFromOptions(
samforwarder.SetClientSaveFile(config.SaveFile),
samforwarder.SetClientFilePath(config.SaveDirectory),
samforwarder.SetClientHost(config.TargetHost),
samforwarder.SetClientPort(config.TargetPort),
samforwarder.SetClientSAMHost(config.SamHost),
samforwarder.SetClientSAMPort(config.SamPort),
samforwarder.SetClientSigType(config.SigType),
samforwarder.SetClientName(config.TunName),
samforwarder.SetClientInLength(config.InLength),
samforwarder.SetClientOutLength(config.OutLength),
samforwarder.SetClientInVariance(config.InVariance),
samforwarder.SetClientOutVariance(config.OutVariance),
samforwarder.SetClientInQuantity(config.InQuantity),
samforwarder.SetClientOutQuantity(config.OutQuantity),
samforwarder.SetClientInBackups(config.InBackupQuantity),
samforwarder.SetClientOutBackups(config.OutBackupQuantity),
samforwarder.SetClientEncrypt(config.EncryptLeaseSet),
samforwarder.SetClientLeaseSetKey(config.LeaseSetKey),
samforwarder.SetClientLeaseSetPrivateKey(config.LeaseSetPrivateKey),
samforwarder.SetClientLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
samforwarder.SetClientAllowZeroIn(config.InAllowZeroHop),
samforwarder.SetClientAllowZeroOut(config.OutAllowZeroHop),
samforwarder.SetClientFastRecieve(config.FastRecieve),
samforwarder.SetClientCompress(config.UseCompression),
samforwarder.SetClientReduceIdle(config.ReduceIdle),
samforwarder.SetClientReduceIdleTimeMs(config.ReduceIdleTime),
samforwarder.SetClientReduceIdleQuantity(config.ReduceIdleQuantity),
samforwarder.SetClientCloseIdle(config.CloseIdle),
samforwarder.SetClientCloseIdleTimeMs(config.CloseIdleTime),
samforwarder.SetClientAccessListType(config.AccessListType),
samforwarder.SetClientAccessList(config.AccessList),
samforwarder.SetClientMessageReliability(config.MessageReliability),
samforwarder.SetClientPassword(config.KeyFilePath),
samforwarder.SetClientDestination(config.ClientDest),
)
}
return nil, nil
}
// NewSAMClientForwarderFromConfig generates a new SAMForwarder from a config file
func NewSAMClientForwarderFromConfig(iniFile, SamHost, SamPort string, label ...string) (*samforwarder.SAMClientForwarder, error) {
if iniFile != "none" {
config, err := 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 NewSAMClientForwarderFromConf(config)
}
return nil, nil
}
// NewSAMSSUClientForwarderFromConf generates a SAMSSUforwarder from *i2ptunconf.Conf
func NewSAMSSUClientForwarderFromConf(config *Conf) (*samforwarderudp.SAMSSUClientForwarder, error) {
if config != nil {
return samforwarderudp.NewSAMSSUClientForwarderFromOptions(
samforwarderudp.SetClientSaveFile(config.SaveFile),
samforwarderudp.SetClientFilePath(config.SaveDirectory),
samforwarderudp.SetClientHost(config.TargetHost),
samforwarderudp.SetClientPort(config.TargetPort),
samforwarderudp.SetClientSAMHost(config.SamHost),
samforwarderudp.SetClientSAMPort(config.SamPort),
samforwarderudp.SetClientSigType(config.SigType),
samforwarderudp.SetClientName(config.TunName),
samforwarderudp.SetClientInLength(config.InLength),
samforwarderudp.SetClientOutLength(config.OutLength),
samforwarderudp.SetClientInVariance(config.InVariance),
samforwarderudp.SetClientOutVariance(config.OutVariance),
samforwarderudp.SetClientInQuantity(config.InQuantity),
samforwarderudp.SetClientOutQuantity(config.OutQuantity),
samforwarderudp.SetClientInBackups(config.InBackupQuantity),
samforwarderudp.SetClientOutBackups(config.OutBackupQuantity),
samforwarderudp.SetClientEncrypt(config.EncryptLeaseSet),
samforwarderudp.SetClientLeaseSetKey(config.LeaseSetKey),
samforwarderudp.SetClientLeaseSetPrivateKey(config.LeaseSetPrivateKey),
samforwarderudp.SetClientLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
samforwarderudp.SetClientAllowZeroIn(config.InAllowZeroHop),
samforwarderudp.SetClientAllowZeroOut(config.OutAllowZeroHop),
samforwarderudp.SetClientFastRecieve(config.FastRecieve),
samforwarderudp.SetClientCompress(config.UseCompression),
samforwarderudp.SetClientReduceIdle(config.ReduceIdle),
samforwarderudp.SetClientReduceIdleTimeMs(config.ReduceIdleTime),
samforwarderudp.SetClientReduceIdleQuantity(config.ReduceIdleQuantity),
samforwarderudp.SetClientCloseIdle(config.CloseIdle),
samforwarderudp.SetClientCloseIdleTimeMs(config.CloseIdleTime),
samforwarderudp.SetClientAccessListType(config.AccessListType),
samforwarderudp.SetClientAccessList(config.AccessList),
samforwarderudp.SetClientMessageReliability(config.MessageReliability),
samforwarderudp.SetClientPassword(config.KeyFilePath),
samforwarderudp.SetClientDestination(config.ClientDest),
)
}
return nil, nil
}
func NewSAMSSUClientForwarderFromConfig(iniFile, SamHost, SamPort string, label ...string) (*samforwarderudp.SAMSSUClientForwarder, error) {
if iniFile != "none" {
config, err := 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 NewSAMSSUClientForwarderFromConf(config)
}
return nil, nil
}

View File

@@ -1,128 +0,0 @@
package i2ptunconf
import (
"github.com/eyedeekay/sam-forwarder/tcp"
"github.com/eyedeekay/sam-forwarder/udp"
)
// NewSAMForwarderFromConf generates a SAMforwarder from *i2ptunconf.Conf
func NewSAMForwarderFromConf(config *Conf) (*samforwarder.SAMForwarder, error) {
if config != nil {
return samforwarder.NewSAMForwarderFromOptions(
samforwarder.SetType(config.Type),
samforwarder.SetSaveFile(config.SaveFile),
samforwarder.SetFilePath(config.SaveDirectory),
samforwarder.SetHost(config.TargetHost),
samforwarder.SetPort(config.TargetPort),
samforwarder.SetSAMHost(config.SamHost),
samforwarder.SetSAMPort(config.SamPort),
samforwarder.SetSigType(config.SigType),
samforwarder.SetName(config.TunName),
samforwarder.SetInLength(config.InLength),
samforwarder.SetOutLength(config.OutLength),
samforwarder.SetInVariance(config.InVariance),
samforwarder.SetOutVariance(config.OutVariance),
samforwarder.SetInQuantity(config.InQuantity),
samforwarder.SetOutQuantity(config.OutQuantity),
samforwarder.SetInBackups(config.InBackupQuantity),
samforwarder.SetOutBackups(config.OutBackupQuantity),
samforwarder.SetEncrypt(config.EncryptLeaseSet),
samforwarder.SetLeaseSetKey(config.LeaseSetKey),
samforwarder.SetLeaseSetPrivateKey(config.LeaseSetPrivateKey),
samforwarder.SetLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
samforwarder.SetAllowZeroIn(config.InAllowZeroHop),
samforwarder.SetAllowZeroOut(config.OutAllowZeroHop),
samforwarder.SetFastRecieve(config.FastRecieve),
samforwarder.SetCompress(config.UseCompression),
samforwarder.SetReduceIdle(config.ReduceIdle),
samforwarder.SetReduceIdleTimeMs(config.ReduceIdleTime),
samforwarder.SetReduceIdleQuantity(config.ReduceIdleQuantity),
samforwarder.SetCloseIdle(config.CloseIdle),
samforwarder.SetCloseIdleTimeMs(config.CloseIdleTime),
samforwarder.SetAccessListType(config.AccessListType),
samforwarder.SetAccessList(config.AccessList),
samforwarder.SetMessageReliability(config.MessageReliability),
samforwarder.SetKeyFile(config.KeyFilePath),
//samforwarder.SetTargetForPort443(config.TargetForPort443),
)
}
return nil, nil
}
// NewSAMForwarderFromConfig generates a new SAMForwarder from a config file
func NewSAMForwarderFromConfig(iniFile, SamHost, SamPort string, label ...string) (*samforwarder.SAMForwarder, error) {
if iniFile != "none" {
config, err := 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 NewSAMForwarderFromConf(config)
}
return nil, nil
}
// NewSAMSSUForwarderFromConf generates a SAMSSUforwarder from *i2ptunconf.Conf
func NewSAMSSUForwarderFromConf(config *Conf) (*samforwarderudp.SAMSSUForwarder, error) {
if config != nil {
return samforwarderudp.NewSAMSSUForwarderFromOptions(
samforwarderudp.SetSaveFile(config.SaveFile),
samforwarderudp.SetFilePath(config.SaveDirectory),
samforwarderudp.SetHost(config.TargetHost),
samforwarderudp.SetPort(config.TargetPort),
samforwarderudp.SetSAMHost(config.SamHost),
samforwarderudp.SetSAMPort(config.SamPort),
samforwarderudp.SetSigType(config.SigType),
samforwarderudp.SetName(config.TunName),
samforwarderudp.SetInLength(config.InLength),
samforwarderudp.SetOutLength(config.OutLength),
samforwarderudp.SetInVariance(config.InVariance),
samforwarderudp.SetOutVariance(config.OutVariance),
samforwarderudp.SetInQuantity(config.InQuantity),
samforwarderudp.SetOutQuantity(config.OutQuantity),
samforwarderudp.SetInBackups(config.InBackupQuantity),
samforwarderudp.SetOutBackups(config.OutBackupQuantity),
samforwarderudp.SetEncrypt(config.EncryptLeaseSet),
samforwarderudp.SetLeaseSetKey(config.LeaseSetKey),
samforwarderudp.SetLeaseSetPrivateKey(config.LeaseSetPrivateKey),
samforwarderudp.SetLeaseSetPrivateSigningKey(config.LeaseSetPrivateSigningKey),
samforwarderudp.SetAllowZeroIn(config.InAllowZeroHop),
samforwarderudp.SetAllowZeroOut(config.OutAllowZeroHop),
samforwarderudp.SetFastRecieve(config.FastRecieve),
samforwarderudp.SetCompress(config.UseCompression),
samforwarderudp.SetReduceIdle(config.ReduceIdle),
samforwarderudp.SetReduceIdleTimeMs(config.ReduceIdleTime),
samforwarderudp.SetReduceIdleQuantity(config.ReduceIdleQuantity),
samforwarderudp.SetCloseIdle(config.CloseIdle),
samforwarderudp.SetCloseIdleTimeMs(config.CloseIdleTime),
samforwarderudp.SetAccessListType(config.AccessListType),
samforwarderudp.SetAccessList(config.AccessList),
samforwarderudp.SetMessageReliability(config.MessageReliability),
samforwarderudp.SetKeyFile(config.KeyFilePath),
)
}
return nil, nil
}
// NewSAMSSUForwarderFromConfig generates a new SAMSSUForwarder from a config file
func NewSAMSSUForwarderFromConfig(iniFile, SamHost, SamPort string, label ...string) (*samforwarderudp.SAMSSUForwarder, error) {
if iniFile != "none" {
config, err := 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 NewSAMSSUForwarderFromConf(config)
}
return nil, nil
}

View File

@@ -8,7 +8,7 @@ import (
// default, the argument is always returned. If the argument and default are
// the same and the key exists, the key is returned. If the key is absent, the
// default is returned.
func (c *Conf) GetType(argc, argu, argh bool, def string, label ...string) string {
func (c *Conf) GetTypes(argc, argu, argh bool, def string, label ...string) string {
var typ string
if argu {
typ += "udp"
@@ -63,10 +63,33 @@ func (c *Conf) SetType(label ...string) {
if strings.Contains(v, "client") {
c.Client = true
}
if c.Type == "server" || c.Type == "http" || c.Type == "client" || c.Type == "httpclient" || c.Type == "udpserver" || c.Type == "udpclient" || c.Type == "kcpclient" || c.Type == "kcpserver" {
switch c.Type {
case "server":
c.Type = v
case "http":
c.Type = v
case "client":
c.Type = v
case "httpclient":
c.Type = v
case "browserclient":
c.Type = v
case "udpserver":
c.Type = v
case "udpclient":
c.Type = v
case "vpnserver":
c.Type = v
case "vpnclient":
c.Type = v
case "kcpclient":
c.Type = v
case "kcpserver":
c.Type = v
default:
c.Type = "browserclient"
}
} else {
c.Type = "server"
c.Type = "browserclient"
}
}

View File

@@ -0,0 +1,27 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1 @@
[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hhc2hlcyI6W3siYmxvY2tfc2l6ZSI6NDA5NiwiZGlnZXN0Ijoic2hhMjU2IiwiZmlsZXMiOlt7InBhdGgiOiJMSUNFTlNFIiwicm9vdF9oYXNoIjoiUGIwc2tBVUxaUzFqWldTQnctV0hIRkltRlhVcExiZDlUcVkwR2ZHSHBWcyJ9LHsicGF0aCI6ImNybC1zZXQiLCJyb290X2hhc2giOiJxZVQyMjMyaGhpQmdVellVbDg5NV9zYkJXbnFVeGR1Y2prX3dvVzAtWHdnIn0seyJwYXRoIjoibWFuaWZlc3QuanNvbiIsInJvb3RfaGFzaCI6IjRmLUdfbmRDY3p3Y3pMVWo4Y1lNODVsTnpKZ0R4VzZnNk10TXdfU0Jvb0kifV0sImZvcm1hdCI6InRyZWVoYXNoIiwiaGFzaF9ibG9ja19zaXplIjo0MDk2fV0sIml0ZW1faWQiOiJoZm5rcGltbGhoZ2llYWRkZ2ZlbWpob2ZtZmJsbW5pYiIsIml0ZW1fdmVyc2lvbiI6IjUzNDUiLCJwcm90b2NvbF92ZXJzaW9uIjoxfQ","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"DkCqhqZtm5nn1tYnzpbcothSNvmVdpOJaZW4m3Dhe188iM1tD2OkNtGJrPa6kbAZ3csxiEnv6tyGmF9CUeFskfQunyRLxHhXw3yWXR1e89qcZJMNZisopmrGjlHwXwCmuM7RRo5Qcjb2yIuTnAPg3gWBAcuoUsMoFVkGFxF77FpBnexNkh74V6-mQ-PwmhF1snqCI_mUUXlt9CDgVtCpIeHYgfGyqYIXRS-joe6D8z9OiWa9UsD2gxZPtxPjP4-6Hqs6RR1rUD7JkHKUoqdPbCvKFTjwkso1N39lsD6Eg0tWnxRZseY178aDKc-D3uFnYQsKSA632gFYMHQ28eTrIA"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"LM43s6rOa8znJq_YQ4Gc_IM4gMNIB4lVHpcv5fCLJ8OPLLcLiAebdbaxqPlGMk8a98j5_1dpU3DzKaEudJaJZfrefS_lJXEX6N345OPJSCcGYxaKoePb3JAs6ck9pd__FhTDJ2RfwT4H2OBbbv6CwkQtRFmuFyRnGMMCIbUPPJd1Ip08odVqC14RqdefeNHGxVdx_zoeBKWFAgYFSoDsZn38PbHzUeVR3JIXHO49VhLfv-Tra7vJoHHiLSlAt2Tfffn2DwEm3ptmaCfbtgxIsOceb7Mos9jGPwbUJQ8XSGoeWXyVly3qCjaOd8BOU6mitSgntcX0ZN7_h3olw17QGw"}]}}]

Binary file not shown.

View File

@@ -0,0 +1 @@
1.1eee3e2bc90919b1b754fd95f8f6cb37c378f7227fb724b6ffb5233bcf5c3788

View File

@@ -0,0 +1,5 @@
{
"manifest_version": 2,
"name": "crl-set-9716886282698058642.data",
"version": "5345"
}

View File

@@ -0,0 +1,8 @@
{
"8/RrMmQlCD2Gsp14wUCE1P8r7B2C5+yE0+g79IPyRsc=": {
"expiry": 1597868021.744813,
"mode": "force-https",
"sts_include_subdomains": false,
"sts_observed": 1566332021.744818
}
}

View File

@@ -0,0 +1,8 @@
{
"8/RrMmQlCD2Gsp14wUCE1P8r7B2C5+yE0+g79IPyRsc=": {
"expiry": 1597866661.90759,
"mode": "force-https",
"sts_include_subdomains": false,
"sts_observed": 1566330661.907595
}
}

View File

@@ -0,0 +1,8 @@
{
"8/RrMmQlCD2Gsp14wUCE1P8r7B2C5+yE0+g79IPyRsc=": {
"expiry": 1597879473.799381,
"mode": "force-https",
"sts_include_subdomains": false,
"sts_observed": 1566343473.799385
}
}

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:50.028 7bf Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/AutofillStrikeDatabase/MANIFEST-000001
2019/08/23-20:02:50.028 7bf Recovering log #3
2019/08/23-20:02:50.028 7bf Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/AutofillStrikeDatabase/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:33.126 40bb Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/AutofillStrikeDatabase/MANIFEST-000001
2019/08/20-19:24:33.127 40bb Recovering log #3
2019/08/20-19:24:33.127 40bb Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/AutofillStrikeDatabase/000003.log

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:50.020 7bf Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/BudgetDatabase/MANIFEST-000001
2019/08/23-20:02:50.020 7bf Recovering log #3
2019/08/23-20:02:50.020 7bf Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/BudgetDatabase/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:33.112 40bb Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/BudgetDatabase/MANIFEST-000001
2019/08/20-19:24:33.112 40bb Recovering log #3
2019/08/20-19:24:33.112 40bb Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/BudgetDatabase/000003.log

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:51.766 7be Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Extension State/MANIFEST-000001
2019/08/23-20:02:51.766 7be Recovering log #3
2019/08/23-20:02:51.767 7be Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Extension State/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:35.492 40b9 Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Extension State/MANIFEST-000001
2019/08/20-19:24:35.492 40b9 Recovering log #3
2019/08/20-19:24:35.493 40b9 Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Extension State/000003.log

Binary file not shown.

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:49.913 7bf Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/AvailabilityDB/MANIFEST-000001
2019/08/23-20:02:49.914 7bf Recovering log #3
2019/08/23-20:02:49.918 7bf Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/AvailabilityDB/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:32.932 40bb Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/AvailabilityDB/MANIFEST-000001
2019/08/20-19:24:32.932 40bb Recovering log #3
2019/08/20-19:24:32.933 40bb Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/AvailabilityDB/000003.log

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:49.902 7bf Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/EventDB/MANIFEST-000001
2019/08/23-20:02:49.902 7bf Recovering log #3
2019/08/23-20:02:49.902 7bf Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/EventDB/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:32.928 40bb Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/EventDB/MANIFEST-000001
2019/08/20-19:24:32.928 40bb Recovering log #3
2019/08/20-19:24:32.929 40bb Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Feature Engagement Tracker/EventDB/000003.log

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
{"net":{"http_server_properties":{"servers":[{"https://accounts.google.com":{"supports_spdy":true}}],"version":5},"network_qualities":{"CAISE21lc2hhYmxlX21haW5fbm9tYXAYgICAgPj/////AQ==":"4G"}}}

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:50.356 701 Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Platform Notifications/MANIFEST-000001
2019/08/23-20:02:50.356 701 Recovering log #3
2019/08/23-20:02:50.356 701 Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Platform Notifications/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:33.517 40b9 Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Platform Notifications/MANIFEST-000001
2019/08/20-19:24:33.519 40b9 Recovering log #3
2019/08/20-19:24:33.519 40b9 Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Platform Notifications/000003.log

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
Chromium settings and storage represent user-selected preferences and information and MUST not be extracted, overwritten or modified except through Chromium defined APIs.

View File

@@ -0,0 +1 @@
{"protection":{"super_mac":"B613679A0814D9EC772F95D778C35FC5FF1697C493715653C6C712144292C5AD"}}

Binary file not shown.

View File

@@ -0,0 +1 @@
MANIFEST-000001

View File

@@ -0,0 +1,3 @@
2019/08/23-20:02:49.686 709 Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Site Characteristics Database/MANIFEST-000001
2019/08/23-20:02:49.686 709 Recovering log #3
2019/08/23-20:02:49.687 709 Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Site Characteristics Database/000003.log

View File

@@ -0,0 +1,3 @@
2019/08/20-19:24:32.667 4005 Reusing MANIFEST /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Site Characteristics Database/MANIFEST-000001
2019/08/20-19:24:32.673 4005 Recovering log #3
2019/08/20-19:24:32.677 4005 Reusing old log /media/longterm/go/src/github.com/eyedeekay/sam-forwarder/etc/samcatd/samcatd/Default/Site Characteristics Database/000003.log

View File

@@ -0,0 +1 @@
MANIFEST-000001

Some files were not shown because too many files have changed in this diff Show More