Просмотр исходного кода

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 лет назад
Родитель
Сommit
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(
 			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 == "" {
 		config.DataStoreDirectory, err = os.Getwd()

+ 8 - 0
psiphon/remoteServerList.go

@@ -20,6 +20,7 @@
 package psiphon
 
 import (
+	"errors"
 	"io/ioutil"
 	"net/http"
 )
@@ -31,6 +32,13 @@ import (
 func FetchRemoteServerList(config *Config, dialConfig *DialConfig) (err error) {
 	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{
 		Dial: NewTCPDialer(dialConfig),
 	}