This commit is contained in:
Vladislav Yarmak
2021-03-27 00:43:33 +02:00
parent e6b0ede774
commit 9cd2684ac0
5 changed files with 154 additions and 103 deletions
+10
View File
@@ -2,6 +2,8 @@ package seclient
import (
"encoding/json"
"net"
"fmt"
"errors"
"strconv"
)
@@ -78,6 +80,14 @@ type SEIPEntry struct {
Ports []uint16 `json:"ports"`
}
func (e *SEIPEntry) NetAddr() string {
if len(e.Ports) == 0 {
return net.JoinHostPort(e.IP, "443")
} else {
return net.JoinHostPort(e.IP, fmt.Sprintf("%d", e.Ports[0]))
}
}
type SEDiscoverResponse struct {
Data struct {
IPs []SEIPEntry `json:"ips"`