Skip to content

Commit

Permalink
endpoint nat support
Browse files Browse the repository at this point in the history
  • Loading branch information
kikimor committed Mar 6, 2021
1 parent 51ae55e commit 2fb044d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Device.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 2fb044d

Please sign in to comment.