Skip to content

Commit

Permalink
vet: ipn proton.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Dec 14, 2024
1 parent fa0be64 commit d763d3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion intra/ipn/warp/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

var (
errNoApiResponse = errors.New("warp/agw: no api response")
errNoApiResponse = errors.New("ipn: no api response")
errNoApiData = errors.New("warp: no api data")
errZeroIdentity = errors.New("warp: identity content empty")
errZeroPeers = errors.New("warp: no peers")
Expand Down
21 changes: 11 additions & 10 deletions intra/ipn/warp/proton.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func (a *protongw) refreshConf() error {
// expect it to be the same when the key is the same
}
// wg info
for _, r := range a.config.RegionalWgConfs {
for _, r := range pc.RegionalWgConfs {
r.genWgConf()
}
return nil // ok
Expand Down Expand Up @@ -690,8 +690,8 @@ retryAfterRefresh:
a.addRegistrationHeaders(req)

res, err := a.http.Do(req)
if err != nil {
return err
if err != nil || res == nil {
return core.OneErr(err, errNoApiResponse)
}
defer res.Body.Close()

Expand Down Expand Up @@ -786,8 +786,8 @@ func (a *protongw) fetchCreds() error {
a.addSessionHeaders(req)

res, err := a.http.Do(req)
if err != nil {
return err
if err != nil || res == nil {
return core.OneErr(err, errNoApiResponse)
}
defer res.Body.Close()

Expand Down Expand Up @@ -864,8 +864,8 @@ func (a *protongw) beginSession() error {
protonHeaders(req)

res, err := a.http.Do(req)
if err != nil {
return err
if err != nil || res == nil {
return core.OneErr(err, errNoApiResponse)
}
defer res.Body.Close()

Expand Down Expand Up @@ -934,8 +934,8 @@ func (a *protongw) refreshCreds() error {
protonHeaders(req)

res, err := a.http.Do(req)
if err != nil {
return err
if err != nil || res == nil {
return core.OneErr(err, errNoApiResponse)
}
defer res.Body.Close()

Expand Down Expand Up @@ -1195,7 +1195,8 @@ func protonServersFrom(allServersFilePath string, c *http.Client) []ProtonLogica
protonHeaders(req)
protonNetZoneHeaders(req)
res, err := c.Do(req)
if err != nil {
if err != nil || res == nil {
err = core.OneErr(err, errNoApiResponse)
log.E("proton: servers: do: %v", err)
} else {
defer res.Body.Close()
Expand Down

0 comments on commit d763d3c

Please sign in to comment.