Skip to content

Commit

Permalink
use https if connect to remote host
Browse files Browse the repository at this point in the history
  • Loading branch information
win-t committed Dec 20, 2022
1 parent e6c3463 commit a1dabec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nodecontrol/algodControl.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/algorand/go-algorand/config"
Expand Down Expand Up @@ -85,6 +86,13 @@ func (nc NodeController) ServerURL() (url.URL, error) {
if err != nil {
return url.URL{}, err
}
if strings.HasPrefix(addr, "http:") || strings.HasPrefix(addr, "https:") {
u, err := url.Parse(addr)
if err != nil {
return url.URL{}, err
}
return *u, nil
}
return url.URL{Scheme: "http", Host: addr}, nil
}

Expand Down

0 comments on commit a1dabec

Please sign in to comment.