endpoint nat support

This commit is contained in:
kikimor
2021-03-06 23:56:46 +05:00
parent 51ae55e8a0
commit 2fb044d81c
+8
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strconv"
"strings"
@@ -195,6 +196,13 @@ func (dev *Device) addEndpoint(Key, Value string) {
//use lowCaseKey
//make key having ability to handle Mixed Case for Different vendor devcie (e.g. Events EVENTS, events)
lowCaseKey := strings.ToLower(Key)
// Replace host with host from device params.
if u, err := url.Parse(Value); err == nil {
u.Host = dev.params.Xaddr
Value = u.String()
}
dev.endpoints[lowCaseKey] = Value
}