* control: /install/get_addresses: don't check if ports are available

* always use port 80
This commit is contained in:
Simon Zolin 2019-04-02 17:21:12 +03:00
parent e4b53db558
commit 00c128f0a4
1 changed files with 4 additions and 21 deletions

View File

@ -970,15 +970,9 @@ func handleSafeSearchStatus(w http.ResponseWriter, r *http.Request) {
} }
} }
type ipport struct {
IP string `json:"ip,omitempty"`
Port int `json:"port"`
Warning string `json:"warning"`
}
type firstRunData struct { type firstRunData struct {
Web ipport `json:"web"` WebPort int `json:"web_port"`
DNS ipport `json:"dns"` DNSPort int `json:"dns_port"`
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
Interfaces map[string]interface{} `json:"interfaces"` Interfaces map[string]interface{} `json:"interfaces"`
@ -987,19 +981,8 @@ type firstRunData struct {
func handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) { func handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) {
log.Tracef("%s %v", r.Method, r.URL) log.Tracef("%s %v", r.Method, r.URL)
data := firstRunData{} data := firstRunData{}
data.WebPort = 80
// find out if port 80 is available -- if not, fall back to 3000 data.DNSPort = 53
if checkPortAvailable("", 80) == nil {
data.Web.Port = 80
} else {
data.Web.Port = 3000
}
// find out if port 53 is available -- if not, show a big warning
data.DNS.Port = 53
if checkPacketPortAvailable("", 53) != nil {
data.DNS.Warning = "Port 53 is not available for binding -- this will make DNS clients unable to contact AdGuard Home."
}
ifaces, err := getValidNetInterfacesForWeb() ifaces, err := getValidNetInterfacesForWeb()
if err != nil { if err != nil {