代码拉取完成,页面将自动刷新
package config
import (
"gitee.com/h79/goutils/common/server"
"gitee.com/h79/goutils/discovery/resolver/builder"
"net"
)
type Service struct {
// The node name that the endpoint belongs to.
Node Node `json:"node"`
// The network address at which the service can be reached.
Server server.Address `json:"server"`
// The list of tags associated with the service.
Tags []string `json:"tags"`
// The set of metadata associated with the node on which the service is
// running.
Meta map[string]string `json:"meta"`
}
func (s *Service) Adjust(addr net.Addr, pubIp string) {
host := addr.(*net.TCPAddr).IP.String()
port := addr.(*net.TCPAddr).Port
if host == "" || host == "::" || host == ":::" {
host = pubIp
}
s.Server.Host = host
s.Server.Port = port
}
type Config struct {
Service
Check server.Health
}
func WithTarget(target builder.Target, health server.Health) Config {
return Config{
Service: Service{
Node: Node{
Target: target,
},
},
Check: health,
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。