gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/router/route.go (about) 1 package router 2 3 import ( 4 "hash/fnv" 5 ) 6 7 var ( 8 // DefaultLink is default network link 9 DefaultLink = "local" 10 // DefaultLocalMetric is default route cost for a local route 11 DefaultLocalMetric int64 = 1 12 ) 13 14 // Route is network route 15 type Route struct { 16 // Service is destination service name 17 Service string 18 // Address is service node address 19 Address string 20 // Gateway is route gateway 21 Gateway string 22 // Network is network address 23 Network string 24 // Router is router id 25 Router string 26 // Link is network link 27 Link string 28 // Metric is the route cost metric 29 Metric int64 30 } 31 32 // Hash returns route hash sum. 33 func (r *Route) Hash() uint64 { 34 h := fnv.New64() 35 h.Reset() 36 h.Write([]byte(r.Service + r.Address + r.Gateway + r.Network + r.Router + r.Link)) 37 return h.Sum64() 38 }