espat: refactor net and tls interface compatible code into separate sub-packages

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2019-07-03 13:27:19 +02:00
parent 7e78e2c998
commit 50633f3e86
8 changed files with 135 additions and 115 deletions
+3 -3
View File
@@ -15,14 +15,14 @@ const (
)
// GetDNS returns the IP address for a domain name.
func (d *Device) GetDNS(domain string) (IP, error) {
func (d *Device) GetDNS(domain string) (string, error) {
d.Set(TCPDNSLookup, "\""+domain+"\"")
r := strings.Split(string(d.Response(1000)), ":")
if len(r) != 2 {
return nil, errors.New("Invalid domain lookup result")
return "", errors.New("Invalid domain lookup result")
}
res := strings.Split(r[1], "\r\n")
return IP(res[0]), nil
return res[0], nil
}
// ConnectTCPSocket creates a new TCP socket connection for the ESP8266/ESP32.