INNER CODE UNIT · Go
newNode
go-kratos/gateway · client/node.go:173
func newNode(ctx *BuildContext, addr string, protocol config.Protocol, weight *int64, md map[string]string, version string, name string, opts ...NewNodeOption) *node {
node := &node{
protocol: protocol,
address: addr,
weight: weight,
metadata: md,
version: version,
name: name,
}
node.client = _globalClient
if protocol == config.Protocol_GRPC {
node.client = _globalH2CClient
}
opt := &NodeOptions{}
for _, o := range opts {
o(opt)
}
if opt.TLS {