trpc.group/trpc-go/trpc-go@v1.0.2/naming/registry/node.go (about) 1 // 2 // 3 // Tencent is pleased to support the open source community by making tRPC available. 4 // 5 // Copyright (C) 2023 THL A29 Limited, a Tencent company. 6 // All rights reserved. 7 // 8 // If you have downloaded a copy of the tRPC source code from Tencent, 9 // please note that tRPC source code is licensed under the Apache 2.0 License, 10 // A copy of the Apache 2.0 License is included in this file. 11 // 12 // 13 14 package registry 15 16 import ( 17 "fmt" 18 "time" 19 ) 20 21 // Node is the information of a node. 22 type Node struct { 23 ServiceName string // 服务名 24 ContainerName string // 容器名 25 Address string // 目标地址 ip:port 26 Network string // 网络层协议 tcp/udp 27 Protocol string // 业务协议 trpc/http 28 SetName string // 节点 Set 名 29 Weight int // 权重 30 CostTime time.Duration // 当次请求耗时 31 EnvKey string // 透传的环境信息 32 Metadata map[string]interface{} 33 } 34 35 // String returns an abbreviation information of node. 36 func (n *Node) String() string { 37 return fmt.Sprintf("service:%s, addr:%s, cost:%s", n.ServiceName, n.Address, n.CostTime) 38 }