
Product
Introducing Data Exports
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.
trpc.group/trpc-go/trpc-naming-consul
Advanced tools
配置:
plugins:
naming:
consul:
address: dev.cloud.com:8500
services:
- trpc.test.helloworld.Greeter # 一定要与 trpc service 相同
register: # 默认注册配置,上面的 services 会使用
interval: 1s
timeout: 1s
tags:
- test
meta:
appid: 1
weight: 10
deregister_critical_service_after: 10m
services_register: # 独立注册配置,不同服务可以有不同配置
- service: trpc.test.helloworld.Greeter # 一定要与 trpc service 相同
register: # 默认注册配置,上面的 services 会使用
interval: 1s
timeout: 1s
tags:
- test
meta:
appid: 1
weight: 10
deregister_critical_service_after: 10m
selector:
loadBalancer: random
client: # 客户端调用的后端配置
service: # 针对单个后端的配置
- callee: trpc.test.helloworld.Greeter # 后端服务协议文件的 service name, 如何 callee 和下面的 name 一样,那只需要配置一个即可
target: consul://trpc.test.helloworld.Greeter # 后端服务地址 consul
network: tcp # 后端服务的网络类型 tcp udp
protocol: http # 应用层协议 trpc http
timeout: 10000 # 请求最长处理时间
serialization: 2 # 序列化方式 0-pb 2-json 3-flatbuffer,默认不要配置
main 入口:
package main
import (
trpc "trpc.group/trpc-go/trpc-go"
"trpc.group/trpc-go/trpc-go/server"
_ "trpc.group/trpc-go/trpc-naming-consul"
)
func main() {
s := trpc.NewServer()
// do sth ...
s.Serve()
}
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.