Skip to content

Commit fce5cf4

Browse files
authored
Merge pull request #67 from hookszhang/dev
Add property instanceId and optimize
2 parents d214741 + 37138cc commit fce5cf4

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.test
22
eureka
33
.vagrant/
4+
.idea/

net.go

+3
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,9 @@ func (e *EurekaConnection) HeartBeatInstance(ins *Instance) error {
803803
}
804804

805805
func (i *Instance) Id() string {
806+
if i.InstanceId != "" {
807+
return i.InstanceId
808+
}
806809
if i.UniqueID != nil {
807810
return i.UniqueID(*i)
808811
}

struct.go

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type RegisterInstanceJson struct {
7777

7878
// Instance [de]serializeable [to|from] Eureka [XML|JSON].
7979
type Instance struct {
80+
InstanceId string `xml:"instanceId" json:"instanceId"`
8081
HostName string `xml:"hostName" json:"hostName"`
8182
App string `xml:"app" json:"app"`
8283
IPAddr string `xml:"ipAddr" json:"ipAddr"`

0 commit comments

Comments
 (0)