refactor to a more usable base for servers/serverConfig
This commit is contained in:
parent
ce0b05232c
commit
206b5782ae
|
@ -81,9 +81,9 @@ func main() {
|
||||||
|
|
||||||
server := cwtchserver.NewServer(serverConfig)
|
server := cwtchserver.NewServer(serverConfig)
|
||||||
log.Infoln("starting cwtch server...")
|
log.Infoln("starting cwtch server...")
|
||||||
log.Infof("Server 'hash name': %s\n", server.HashName())
|
log.Infof("Server %s\n", server.Onion())
|
||||||
|
|
||||||
log.Infof("Server bundle (import into client to use server): %s\n", log.Magenta(server.Server()))
|
log.Infof("Server bundle (import into client to use server): %s\n", log.Magenta(server.ServerBundle()))
|
||||||
|
|
||||||
if *flagExportTofu {
|
if *flagExportTofu {
|
||||||
// Todo: change all to server export
|
// Todo: change all to server export
|
||||||
|
|
6
go.mod
6
go.mod
|
@ -4,9 +4,9 @@ go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cwtch.im/cwtch v0.8.5
|
cwtch.im/cwtch v0.8.5
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.4
|
git.openprivacy.ca/cwtch.im/tapir v0.4.9
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.4.5
|
git.openprivacy.ca/openprivacy/connectivity v1.5.0
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.2
|
git.openprivacy.ca/openprivacy/log v1.0.3
|
||||||
github.com/gtank/ristretto255 v0.1.2
|
github.com/gtank/ristretto255 v0.1.2
|
||||||
github.com/mattn/go-sqlite3 v1.14.7
|
github.com/mattn/go-sqlite3 v1.14.7
|
||||||
github.com/struCoder/pidusage v0.2.1
|
github.com/struCoder/pidusage v0.2.1
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -4,6 +4,8 @@ cwtch.im/cwtch v0.8.0 h1:QDRaDBTXefFRPZPqUMtxoNhOcgXv0rl0bGjysSOmJX0=
|
||||||
cwtch.im/cwtch v0.8.0/go.mod h1:+SY/4ueF1U7mK+CX8hZFbtd+GC1lx/cReo110KgtQAw=
|
cwtch.im/cwtch v0.8.0/go.mod h1:+SY/4ueF1U7mK+CX8hZFbtd+GC1lx/cReo110KgtQAw=
|
||||||
cwtch.im/cwtch v0.8.5 h1:W67jAF2oRwqWytbZEv1UeCqW0cU2x69tgUw8iy27xFA=
|
cwtch.im/cwtch v0.8.5 h1:W67jAF2oRwqWytbZEv1UeCqW0cU2x69tgUw8iy27xFA=
|
||||||
cwtch.im/cwtch v0.8.5/go.mod h1:5GHxaaeVnKeXSU64IvtCKzkqhU8DRiLoVM+tiBT8kkc=
|
cwtch.im/cwtch v0.8.5/go.mod h1:5GHxaaeVnKeXSU64IvtCKzkqhU8DRiLoVM+tiBT8kkc=
|
||||||
|
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
|
||||||
|
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.0 h1:clG8uORt0NKEhT4P+Dpw1pzyUuYzYBMevGqn2pciKk8=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.0 h1:clG8uORt0NKEhT4P+Dpw1pzyUuYzYBMevGqn2pciKk8=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.0/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.0/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.1 h1:9LMpQX41IzecNNlRc1FZKXHg6wlFss679tFsa3vzb3Y=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.1 h1:9LMpQX41IzecNNlRc1FZKXHg6wlFss679tFsa3vzb3Y=
|
||||||
|
@ -12,15 +14,21 @@ git.openprivacy.ca/cwtch.im/tapir v0.4.2 h1:bxMWZnVJXX4dqqOFS7ELW4iFkVL4GS8wiRkj
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.2/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.2/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.4 h1:KyuTVmr9GYptTCeR7JDODjmhBBbnIBf9V3NSC4+6bHc=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.4 h1:KyuTVmr9GYptTCeR7JDODjmhBBbnIBf9V3NSC4+6bHc=
|
||||||
git.openprivacy.ca/cwtch.im/tapir v0.4.4/go.mod h1:qMFTdmDZITc1BLP1jSW0gVpLmvpg+Zjsh5ek8StwbFE=
|
git.openprivacy.ca/cwtch.im/tapir v0.4.4/go.mod h1:qMFTdmDZITc1BLP1jSW0gVpLmvpg+Zjsh5ek8StwbFE=
|
||||||
|
git.openprivacy.ca/cwtch.im/tapir v0.4.9 h1:LXonlztwvI1F1++0IyomIcDH1/Bxzo+oN8YjGonNvjM=
|
||||||
|
git.openprivacy.ca/cwtch.im/tapir v0.4.9/go.mod h1:p4bHo3DAO8wwimU6JAeZXbfPQ4jnoA2bV+4YvknWTNQ=
|
||||||
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=
|
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=
|
||||||
git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU=
|
git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU=
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.4.3 h1:i2Ad/U9FlL9dKr2bhRck7lJ8NoWyGtoEfUwoCyMT0fU=
|
git.openprivacy.ca/openprivacy/connectivity v1.4.3 h1:i2Ad/U9FlL9dKr2bhRck7lJ8NoWyGtoEfUwoCyMT0fU=
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.4.3/go.mod h1:bR0Myx9nm2YzWtsThRelkNMV4Pp7sPDa123O1qsAbVo=
|
git.openprivacy.ca/openprivacy/connectivity v1.4.3/go.mod h1:bR0Myx9nm2YzWtsThRelkNMV4Pp7sPDa123O1qsAbVo=
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.4.5 h1:UYMdCWPzEAP7LbqdMXGNXmfKjWlvfnKdmewBtnbgQRI=
|
git.openprivacy.ca/openprivacy/connectivity v1.4.5 h1:UYMdCWPzEAP7LbqdMXGNXmfKjWlvfnKdmewBtnbgQRI=
|
||||||
git.openprivacy.ca/openprivacy/connectivity v1.4.5/go.mod h1:JVRCIdL+lAG6ohBFWiKeC/MN42nnC0sfFszR9XG6vPQ=
|
git.openprivacy.ca/openprivacy/connectivity v1.4.5/go.mod h1:JVRCIdL+lAG6ohBFWiKeC/MN42nnC0sfFszR9XG6vPQ=
|
||||||
|
git.openprivacy.ca/openprivacy/connectivity v1.5.0 h1:ZxsR/ZaVKXIkD2x6FlajZn62ciNQjamrI4i/5xIpdoQ=
|
||||||
|
git.openprivacy.ca/openprivacy/connectivity v1.5.0/go.mod h1:UjQiGBnWbotmBzIw59B8H6efwDadjkKzm3RPT1UaIRw=
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.1/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
|
git.openprivacy.ca/openprivacy/log v1.0.1/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.2 h1:HLP4wsw4ljczFAelYnbObIs821z+jgMPCe8uODPnGQM=
|
git.openprivacy.ca/openprivacy/log v1.0.2 h1:HLP4wsw4ljczFAelYnbObIs821z+jgMPCe8uODPnGQM=
|
||||||
git.openprivacy.ca/openprivacy/log v1.0.2/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
|
git.openprivacy.ca/openprivacy/log v1.0.2/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
|
||||||
|
git.openprivacy.ca/openprivacy/log v1.0.3 h1:E/PMm4LY+Q9s3aDpfySfEDq/vYQontlvNj/scrPaga0=
|
||||||
|
git.openprivacy.ca/openprivacy/log v1.0.3/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|
|
@ -27,6 +27,20 @@ const (
|
||||||
|
|
||||||
// AttrEnabled is the attribute key for user toggle of server being enabled
|
// AttrEnabled is the attribute key for user toggle of server being enabled
|
||||||
AttrEnabled = "enabled"
|
AttrEnabled = "enabled"
|
||||||
|
|
||||||
|
// AttrStorageType is used by clients that may need info about stored server config types/styles
|
||||||
|
AttrStorageType = "storageType"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// StorageTypeDefaultPassword is a AttrStorageType that indicated a app default password was used
|
||||||
|
StorageTypeDefaultPassword = "storage-default-password"
|
||||||
|
|
||||||
|
// StorageTypePassword is a AttrStorageType that indicated a user password was used to protect the profile
|
||||||
|
StorageTypePassword = "storage-password"
|
||||||
|
|
||||||
|
// StoreageTypeNoPassword is a AttrStorageType that indicated a no password was used to protect the profile
|
||||||
|
StoreageTypeNoPassword = "storage-no-password"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Reporting is a struct for storing a the config a server needs to be a peer, and connect to a group to report
|
// Reporting is a struct for storing a the config a server needs to be a peer, and connect to a group to report
|
||||||
|
@ -54,8 +68,10 @@ type Config struct {
|
||||||
|
|
||||||
ServerReporting Reporting `json:"serverReporting"`
|
ServerReporting Reporting `json:"serverReporting"`
|
||||||
|
|
||||||
attributes map[string]string
|
Attributes map[string]string `json:"attributes"`
|
||||||
lock sync.Mutex
|
|
||||||
|
lock sync.Mutex
|
||||||
|
encFileStore v1.FileStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identity returns an encapsulation of the servers keys
|
// Identity returns an encapsulation of the servers keys
|
||||||
|
@ -69,7 +85,7 @@ func (config *Config) TokenServiceIdentity() primitives.Identity {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initDefaultConfig(configDir, filename string, encrypted bool) *Config {
|
func initDefaultConfig(configDir, filename string, encrypted bool) *Config {
|
||||||
config := &Config{Encrypted: encrypted, ConfigDir: configDir, FilePath: filename}
|
config := &Config{Encrypted: encrypted, ConfigDir: configDir, FilePath: filename, Attributes: make(map[string]string)}
|
||||||
|
|
||||||
id, pk := primitives.InitializeEphemeralIdentity()
|
id, pk := primitives.InitializeEphemeralIdentity()
|
||||||
tid, tpk := primitives.InitializeEphemeralIdentity()
|
tid, tpk := primitives.InitializeEphemeralIdentity()
|
||||||
|
@ -83,8 +99,8 @@ func initDefaultConfig(configDir, filename string, encrypted bool) *Config {
|
||||||
ReportingGroupID: "",
|
ReportingGroupID: "",
|
||||||
ReportingServerAddr: "",
|
ReportingServerAddr: "",
|
||||||
}
|
}
|
||||||
config.attributes[AttrAutostart] = "false"
|
config.Attributes[AttrAutostart] = "false"
|
||||||
config.attributes[AttrEnabled] = "true"
|
config.Attributes[AttrEnabled] = "true"
|
||||||
|
|
||||||
k := new(ristretto255.Scalar)
|
k := new(ristretto255.Scalar)
|
||||||
b := make([]byte, 64)
|
b := make([]byte, 64)
|
||||||
|
@ -110,6 +126,7 @@ func LoadCreateDefaultConfigFile(configDir, filename string, encrypted bool, pas
|
||||||
// CreateConfig creates a default config and saves it to a json file specified by filename
|
// CreateConfig creates a default config and saves it to a json file specified by filename
|
||||||
// if the encrypted flag is true the config is store encrypted by password
|
// if the encrypted flag is true the config is store encrypted by password
|
||||||
func CreateConfig(configDir, filename string, encrypted bool, password string) (*Config, error) {
|
func CreateConfig(configDir, filename string, encrypted bool, password string) (*Config, error) {
|
||||||
|
log.Debugf("CreateConfig for server with configDir: %s\n", configDir)
|
||||||
os.Mkdir(configDir, 0700)
|
os.Mkdir(configDir, 0700)
|
||||||
config := initDefaultConfig(configDir, filename, encrypted)
|
config := initDefaultConfig(configDir, filename, encrypted)
|
||||||
if encrypted {
|
if encrypted {
|
||||||
|
@ -119,6 +136,7 @@ func CreateConfig(configDir, filename string, encrypted bool, password string) (
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
config.key = key
|
config.key = key
|
||||||
|
config.encFileStore = v1.NewFileStore(configDir, ServerConfigFile, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Save()
|
config.Save()
|
||||||
|
@ -127,23 +145,23 @@ func CreateConfig(configDir, filename string, encrypted bool, password string) (
|
||||||
|
|
||||||
// LoadConfig loads a Config from a json file specified by filename
|
// LoadConfig loads a Config from a json file specified by filename
|
||||||
func LoadConfig(configDir, filename string, encrypted bool, password string) (*Config, error) {
|
func LoadConfig(configDir, filename string, encrypted bool, password string) (*Config, error) {
|
||||||
log.Infof("Loading config from %s\n", path.Join(configDir, filename))
|
|
||||||
|
|
||||||
config := initDefaultConfig(configDir, filename, encrypted)
|
config := initDefaultConfig(configDir, filename, encrypted)
|
||||||
|
var raw []byte
|
||||||
raw, err := ioutil.ReadFile(path.Join(configDir, filename))
|
var err error
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if encrypted {
|
if encrypted {
|
||||||
salt, err := ioutil.ReadFile(path.Join(configDir, SaltFile))
|
salt, err := ioutil.ReadFile(path.Join(configDir, SaltFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
key := v1.CreateKey(password, salt)
|
key := v1.CreateKey(password, salt)
|
||||||
settingsStore := v1.NewFileStore(configDir, ServerConfigFile, key)
|
config.encFileStore = v1.NewFileStore(configDir, ServerConfigFile, key)
|
||||||
raw, err = settingsStore.Read()
|
raw, err = config.encFileStore.Read()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("read enc bytes failed: %s\n", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
raw, err = ioutil.ReadFile(path.Join(configDir, filename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -161,17 +179,20 @@ func LoadConfig(configDir, filename string, encrypted bool, password string) (*C
|
||||||
|
|
||||||
// Save dumps the latest version of the config to a json file given by filename
|
// Save dumps the latest version of the config to a json file given by filename
|
||||||
func (config *Config) Save() error {
|
func (config *Config) Save() error {
|
||||||
log.Infof("Saving config to %s\n", path.Join(config.ConfigDir, config.FilePath))
|
config.lock.Lock()
|
||||||
|
defer config.lock.Unlock()
|
||||||
bytes, _ := json.MarshalIndent(config, "", "\t")
|
bytes, _ := json.MarshalIndent(config, "", "\t")
|
||||||
if config.Encrypted {
|
if config.Encrypted {
|
||||||
settingStore := v1.NewFileStore(config.ConfigDir, config.FilePath, config.key)
|
//settingStore := v1.NewFileStore(config.ConfigDir, config.FilePath, config.key)
|
||||||
return settingStore.Write(bytes)
|
return config.encFileStore.Write(bytes)
|
||||||
}
|
}
|
||||||
return ioutil.WriteFile(path.Join(config.ConfigDir, config.FilePath), bytes, 0600)
|
return ioutil.WriteFile(path.Join(config.ConfigDir, config.FilePath), bytes, 0600)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckPassword returns true if the given password produces the same key as the current stored key, otherwise false.
|
// CheckPassword returns true if the given password produces the same key as the current stored key, otherwise false.
|
||||||
func (config *Config) CheckPassword(checkpass string) bool {
|
func (config *Config) CheckPassword(checkpass string) bool {
|
||||||
|
config.lock.Lock()
|
||||||
|
defer config.lock.Unlock()
|
||||||
salt, err := ioutil.ReadFile(path.Join(config.ConfigDir, SaltFile))
|
salt, err := ioutil.ReadFile(path.Join(config.ConfigDir, SaltFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
@ -182,14 +203,16 @@ func (config *Config) CheckPassword(checkpass string) bool {
|
||||||
|
|
||||||
// Onion returns the .onion url for the server
|
// Onion returns the .onion url for the server
|
||||||
func (config *Config) Onion() string {
|
func (config *Config) Onion() string {
|
||||||
|
config.lock.Lock()
|
||||||
|
defer config.lock.Unlock()
|
||||||
return tor.GetTorV3Hostname(config.PublicKey) + ".onion"
|
return tor.GetTorV3Hostname(config.PublicKey) + ".onion"
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAttribute sets a server attribute
|
// SetAttribute sets a server attribute
|
||||||
func (config *Config) SetAttribute(key, val string) {
|
func (config *Config) SetAttribute(key, val string) {
|
||||||
config.lock.Lock()
|
config.lock.Lock()
|
||||||
defer config.lock.Unlock()
|
config.Attributes[key] = val
|
||||||
config.attributes[key] = val
|
config.lock.Unlock()
|
||||||
config.Save()
|
config.Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,5 +220,5 @@ func (config *Config) SetAttribute(key, val string) {
|
||||||
func (config *Config) GetAttribute(key string) string {
|
func (config *Config) GetAttribute(key string) string {
|
||||||
config.lock.Lock()
|
config.lock.Lock()
|
||||||
defer config.lock.Unlock()
|
defer config.lock.Unlock()
|
||||||
return config.attributes[key]
|
return config.Attributes[key]
|
||||||
}
|
}
|
||||||
|
|
16
servers.go
16
servers.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.openprivacy.ca/openprivacy/connectivity"
|
"git.openprivacy.ca/openprivacy/connectivity"
|
||||||
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -37,7 +38,7 @@ type servers struct {
|
||||||
// NewServers returns a Servers interface to manage a collection of servers
|
// NewServers returns a Servers interface to manage a collection of servers
|
||||||
// expecting directory: $CWTCH_HOME/servers
|
// expecting directory: $CWTCH_HOME/servers
|
||||||
func NewServers(acn connectivity.ACN, directory string) Servers {
|
func NewServers(acn connectivity.ACN, directory string) Servers {
|
||||||
return &servers{acn: acn, directory: directory}
|
return &servers{acn: acn, directory: directory, servers: make(map[string]Server)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadServers will attempt to load any servers in the servers directory that are encrypted with the supplied password
|
// LoadServers will attempt to load any servers in the servers directory that are encrypted with the supplied password
|
||||||
|
@ -50,16 +51,19 @@ func (s *servers) LoadServers(password string) ([]string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error: cannot read server directory: %v", err)
|
return nil, fmt.Errorf("error: cannot read server directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedServers := []string{}
|
loadedServers := []string{}
|
||||||
for _, dir := range dirs {
|
for _, dir := range dirs {
|
||||||
newConfig, err := LoadConfig(path.Join(s.directory, dir.Name()), ServerConfigFile, true, password)
|
newConfig, err := LoadConfig(path.Join(s.directory, dir.Name()), ServerConfigFile, true, password)
|
||||||
if _, exists := s.servers[newConfig.Onion()]; err == nil && !exists {
|
if err == nil {
|
||||||
server := NewServer(newConfig)
|
if _, exists := s.servers[newConfig.Onion()]; !exists {
|
||||||
s.servers[server.Onion()] = server
|
log.Debugf("Loaded config, building server for %s\n", newConfig.Onion())
|
||||||
loadedServers = append(loadedServers, server.Onion())
|
server := NewServer(newConfig)
|
||||||
|
s.servers[server.Onion()] = server
|
||||||
|
loadedServers = append(loadedServers, server.Onion())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Infof("LoadServers returning: %s\n", loadedServers)
|
||||||
return loadedServers, nil
|
return loadedServers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue