Import/Export backend prep

This commit is contained in:
Michal Horejsek
2020-05-14 15:22:29 +02:00
parent 9d65192ad7
commit b598779c0f
92 changed files with 6983 additions and 188 deletions

View File

@ -347,6 +347,14 @@ func (cm *ClientManager) CheckConnection() error {
return nil
}
// CheckConnection returns an error if there is no internet connection.
func CheckConnection() error {
client := &http.Client{Timeout: time.Second * 10}
retStatus := make(chan error)
checkConnection(client, "http://protonstatus.com/vpn_status", retStatus)
return <-retStatus
}
func checkConnection(client *http.Client, url string, errorChannel chan error) {
resp, err := client.Get(url)
if err != nil {

View File

@ -95,6 +95,11 @@ type ImportMsgReq struct {
LabelIDs []string
}
func (req ImportMsgReq) String() string {
data, _ := json.Marshal(req)
return string(data)
}
// ImportRes is a response to an import request.
type ImportRes struct {
Res