Преглед изворни кода

Don't require remote server list fields in config

* Previously, client would exit with an error when
  remote server list config fields were blank.
* Helps automated testing cases to allow blank fields
* Check for blank fields still happens, but only
  when remote server list fetch runs, and result
  is an error message but not client exit
Rod Hynes пре 11 година
родитељ
комит
7a10bb34cd
2 измењених фајлова са 8 додато и 8 уклоњено
  1. 0 8
      psiphon/config.go
  2. 8 0
      psiphon/remoteServerList.go

+ 0 - 8
psiphon/config.go

@@ -111,14 +111,6 @@ func LoadConfig(configJson []byte) (*Config, error) {
 		return nil, ContextError(
 		return nil, ContextError(
 			errors.New("sponsor ID is missing from the configuration file"))
 			errors.New("sponsor ID is missing from the configuration file"))
 	}
 	}
-	if config.RemoteServerListUrl == "" {
-		return nil, ContextError(
-			errors.New("remote server list URL is missing from the configuration file"))
-	}
-	if config.RemoteServerListSignaturePublicKey == "" {
-		return nil, ContextError(
-			errors.New("remote server list signature public key is missing from the configuration file"))
-	}
 
 
 	if config.DataStoreDirectory == "" {
 	if config.DataStoreDirectory == "" {
 		config.DataStoreDirectory, err = os.Getwd()
 		config.DataStoreDirectory, err = os.Getwd()

+ 8 - 0
psiphon/remoteServerList.go

@@ -20,6 +20,7 @@
 package psiphon
 package psiphon
 
 
 import (
 import (
+	"errors"
 	"io/ioutil"
 	"io/ioutil"
 	"net/http"
 	"net/http"
 )
 )
@@ -31,6 +32,13 @@ import (
 func FetchRemoteServerList(config *Config, dialConfig *DialConfig) (err error) {
 func FetchRemoteServerList(config *Config, dialConfig *DialConfig) (err error) {
 	NoticeInfo("fetching remote server list")
 	NoticeInfo("fetching remote server list")
 
 
+	if config.RemoteServerListUrl == "" {
+		return ContextError(errors.New("remote server list URL is blank"))
+	}
+	if config.RemoteServerListSignaturePublicKey == "" {
+		return ContextError(errors.New("remote server list signature public key blank"))
+	}
+
 	transport := &http.Transport{
 	transport := &http.Transport{
 		Dial: NewTCPDialer(dialConfig),
 		Dial: NewTCPDialer(dialConfig),
 	}
 	}