update the interface
This commit is contained in:
@ -1,11 +1,5 @@
|
||||
package i2ptunconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
import "github.com/eyedeekay/sam-forwarder/interface"
|
||||
|
||||
// GetHost takes an argument and a default. If the argument differs from the
|
||||
// default, the argument is always returned. If the argument and default are
|
||||
@ -58,26 +52,3 @@ func (c *Conf) SetControlPort(label ...string) {
|
||||
c.ControlPort = ""
|
||||
}
|
||||
}
|
||||
|
||||
//SetControlHost sets the host of the service to forward
|
||||
func SetControlHost(s string) func(samtunnel.SAMTunnel) error {
|
||||
return func(c samtunnel.SAMTunnel) error {
|
||||
c.(*Conf).ControlHost = s
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//SetControlPort sets the port of the service to forward
|
||||
func SetControlPort(s string) func(samtunnel.SAMTunnel) error {
|
||||
return func(c samtunnel.SAMTunnel) error {
|
||||
port, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Invalid TCP Server Target Port %s; non-number ", s)
|
||||
}
|
||||
if port < 65536 && port > -1 {
|
||||
c.(*Conf).ControlPort = s
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("Invalid port")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user