04 2021 档案

摘要:broker是用于消息的订阅和发布,即异步处理,不过通常会使用队列方式替代,很少使用go-micro的broker 默认是http方式 // Broker is an interface used for asynchronous messaging. type Broker interface { 阅读全文
posted @ 2021-04-20 17:28 林锅 阅读(411) 评论(0) 推荐(0) 编辑
摘要:transport 用于服务之间的通信,自定义了socket接口,封装了Send、Recv、Close接口,可以有HTTP、NATS、RPC等实现,默认使用http type Message struct { Header map[string]string Body []byte } type S 阅读全文
posted @ 2021-04-20 15:37 林锅 阅读(304) 评论(0) 推荐(0) 编辑
摘要:codec 用于各种信息的加解密,具体接口如下: // Codec encodes/decodes various types of messages used within go-micro. // ReadHeader and ReadBody are called in pairs to re 阅读全文
posted @ 2021-04-19 17:34 林锅 阅读(129) 评论(0) 推荐(0) 编辑
摘要:selecor是一种基于registry的选择服务节点和标记它们状态的的机制,有Random、RoundRobin两种策略,代码如下: // Selector builds on the registry as a mechanism to pick nodes // and mark their 阅读全文
posted @ 2021-04-19 16:22 林锅 阅读(377) 评论(0) 推荐(0) 编辑
摘要:go-micro的服务发现插件有mdns、consul、etcd等,默认使用mdns server、client的服务注册和发现的逻辑如下图: go-micro在客户端做的负载,典型的Balancing-aware Client模式。 服务端把服务的地址信息保存到Registry, 然后定时的心跳检 阅读全文
posted @ 2021-04-18 16:16 林锅 阅读(1690) 评论(0) 推荐(0) 编辑
摘要:gRPC 是一个高性能、开源和通用的 RPC 框架,面向服务端和移动端,基于 HTTP/2 设计。 gRPC 特点 语言中立,支持多种语言; 基于 IDL 文件定义服务,通过 proto3 工具生成指定语言的数据结构、服务端接口以及客户端 Stub; 通信协议基于标准的 HTTP/2 设计,支持双向 阅读全文
posted @ 2021-04-15 18:29 林锅 阅读(3487) 评论(0) 推荐(0) 编辑
摘要:一、安装 Mac:brew install tcpdump 二、格式 tcpdump [ -DenNqvX ] [ -c count ] [ -F file ] [ -i interface ] [ -r file ] [ -s snaplen ] [ -w file ] [ expression 阅读全文
posted @ 2021-04-15 15:02 林锅 阅读(156) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示