generate from Conf objects too.
This commit is contained in:
@ -134,12 +134,12 @@ use of INI-like labels. For now, my workaround is to comment out the labels
|
||||
until I deal with this.
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAltibCsACgkQ11wDs5te
|
||||
FOGKNwgAhGBpv+hX+RNBzUcfBQywETaSYIPKgtYootkRWuuof5TbbKrJZUUCwIBo
|
||||
T7QPMoh4H98k05gSQwQ9KMmq+jBv+2dIjy9j8URFe7dLWTq2DL4/o4+Ev/FNteZl
|
||||
TFlgxqj33/v8RYDU4+IoibJ5N7actyFXteyVP6PeDu921AKfD0Stoyjx7bIrHgRA
|
||||
cQziV9eLdhVWHFOjndv49Y4Si72plOeHE/CwpJEJaAvGBPdqGS/pPt6Knu6ZtcAH
|
||||
UyompehdtenT+JLENQ9TR40toB/iCCnBrxRXrqZusedB6NZY/NfvUXZnqmCn7KZh
|
||||
3VHXv5mz7QLmnj0we7HC9hmeJoegyA==
|
||||
=AZpB
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAltjv3wACgkQ11wDs5te
|
||||
FOHUSQgAmo0fQV+lEcyQuj3mdXP8ANwc4t3iJBKU92pOGM9LuWi26Lo3u4gBPGlh
|
||||
3NWJfIJ0wYn5sFDgUJlqGpsPl718jBOwEVOezzCjpcrwZvueJZRuKj28y69ysxoE
|
||||
rKhW07jOD4mAOTz8VylydEzo9oo+LNFWxs6u3IqxYkQuDLp4F9YpG08n50cskaEi
|
||||
93tCvV36/KkfpdNiWj9O3N963GAn5NB9higdK4aXdVjGrgjSytJVPrqm9ujvdWrD
|
||||
9jq4qE7iL7CCs9dvMQTnf3yMbMDx0dkyTdPgwOg8T3swwsY4XlokFCyHp5c+NMnT
|
||||
cWuneCtrt6oZ+6b6uJdnzIy8v7jbOw==
|
||||
=iPIn
|
||||
-----END PGP SIGNATURE-----
|
||||
|
@ -228,6 +228,37 @@ func NewI2PTunConf(iniFile string) (*Conf, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func NewSAMForwarderFromConf(config *Conf) (*samforwarder.SAMForwarder, error) {
|
||||
if config != nil {
|
||||
return samforwarder.NewSAMForwarderFromOptions(
|
||||
samforwarder.SetSaveFile(config.saveFile),
|
||||
samforwarder.SetHost(config.TargetHost),
|
||||
samforwarder.SetPort(config.TargetPort),
|
||||
samforwarder.SetSAMHost(config.SamHost),
|
||||
samforwarder.SetSAMPort(config.SamPort),
|
||||
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.SetAllowZeroIn(config.inAllowZeroHop),
|
||||
samforwarder.SetAllowZeroOut(config.outAllowZeroHop),
|
||||
samforwarder.SetCompress(config.useCompression),
|
||||
samforwarder.SetReduceIdle(config.reduceIdle),
|
||||
samforwarder.SetReduceIdleTime(config.reduceIdleTime),
|
||||
samforwarder.SetReduceIdleQuantity(config.reduceIdleQuantity),
|
||||
samforwarder.SetAccessListType(config.accessListType),
|
||||
samforwarder.SetAccessList(config.accessList),
|
||||
)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func NewSAMForwarderFromConfig(iniFile, SamHost, SamPort string) (*samforwarder.SAMForwarder, error) {
|
||||
if iniFile != "none" {
|
||||
config, err := NewI2PTunConf(iniFile)
|
||||
@ -297,3 +328,34 @@ func NewSAMSSUForwarderFromConfig(iniFile, SamHost, SamPort string) (*samforward
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func NewSAMSSUForwarderFromConf(config *Conf) (*samforwarderudp.SAMSSUForwarder, error) {
|
||||
if config != nil {
|
||||
return samforwarderudp.NewSAMSSUForwarderFromOptions(
|
||||
samforwarderudp.SetSaveFile(config.saveFile),
|
||||
samforwarderudp.SetHost(config.TargetHost),
|
||||
samforwarderudp.SetPort(config.TargetPort),
|
||||
samforwarderudp.SetSAMHost(config.SamHost),
|
||||
samforwarderudp.SetSAMPort(config.SamPort),
|
||||
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.SetAllowZeroIn(config.inAllowZeroHop),
|
||||
samforwarderudp.SetAllowZeroOut(config.outAllowZeroHop),
|
||||
samforwarderudp.SetCompress(config.useCompression),
|
||||
samforwarderudp.SetReduceIdle(config.reduceIdle),
|
||||
samforwarderudp.SetReduceIdleTime(config.reduceIdleTime),
|
||||
samforwarderudp.SetReduceIdleQuantity(config.reduceIdleQuantity),
|
||||
samforwarderudp.SetAccessListType(config.accessListType),
|
||||
samforwarderudp.SetAccessList(config.accessList),
|
||||
)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ func (f *SAMForwarder) Serve() error {
|
||||
}
|
||||
log.Println("Starting Listener.")
|
||||
b := string(f.SamKeys.Addr().Base32())
|
||||
log.Println("SAM Listener created,", b+".b32.i2p")
|
||||
log.Println("SAM Listener created,", b)
|
||||
|
||||
for {
|
||||
conn, err := f.publishListen.Accept()
|
||||
|
@ -157,7 +157,7 @@ func (f *SAMSSUForwarder) Serve() error {
|
||||
log.Println("SAM stream session established.")
|
||||
log.Println("Starting Listener.")
|
||||
b := string(f.SamKeys.Addr().Base32())
|
||||
log.Println("SAM Listener created,", b+".b32.i2p")
|
||||
log.Println("SAM Keys created,", b)
|
||||
for {
|
||||
log.Printf("Accepted connection %v\n", f.publishConnection)
|
||||
go f.forward()
|
||||
|
Reference in New Issue
Block a user