Actually load keys in loadkeys and find keys in findkeys
This commit is contained in:
parent
b40b2f03af
commit
574bb777d0
4 changed files with 66 additions and 7 deletions
|
@ -71,8 +71,10 @@ func (m Manager) Cleanup() error {
|
|||
return m.SAM.Close()
|
||||
}
|
||||
|
||||
func NewManager(samhost, samport, datadir string, samopts []string) (*Manager, error) {
|
||||
func NewManager(host, port, samhost, samport, datadir string, samopts []string) (*Manager, error) {
|
||||
return NewManagerFromOptions(
|
||||
SetSocksHost(host),
|
||||
SetSocksPort(port),
|
||||
SetHost(samhost),
|
||||
SetPort(samport),
|
||||
SetDataDir(datadir),
|
||||
|
|
|
@ -39,6 +39,29 @@ func SetPort(v string) func(*Manager) error {
|
|||
}
|
||||
}
|
||||
|
||||
//SetSocksHost sets the host of the client's SAM bridge
|
||||
func SetHost(s string) func(*Manager) error {
|
||||
return func(c *Manager) error {
|
||||
c.host = s
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
//SetSocksPort sets the port of the client's SAM bridge
|
||||
func SetPort(v string) func(*Manager) error {
|
||||
return func(c *Manager) error {
|
||||
port, err := strconv.Atoi(v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Invalid port; non-number.")
|
||||
}
|
||||
if port < 65536 && port > -1 {
|
||||
c.port = v
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("Invalid port.")
|
||||
}
|
||||
}
|
||||
|
||||
//SetSAMOpts sets the SAM options
|
||||
func SetSAMOpts(s []string) func(*Manager) error {
|
||||
return func(c *Manager) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue