1
1
## learning_tools [ 源码地址] ( https://github.com/hwholiday/learning_tools )
2
2
3
- # go-kit 微服务实践,从入门到精通系列
3
+ # go-kit 微服务实践,从入门到精通系列
4
+
4
5
### [ go-kit] ( https://github.com/hwholiday/learning_tools/tree/master/go-kit ) (go-kit微服务)
6
+
5
7
1: v1 go-kit 微服务 基础使用 (HTTP)
6
8
2: v2 go-kit 微服务 添加日志(user/zap ,并为每个请求添加UUID)
7
9
3: v3 go-kit 微服务 身份认证 (JWT)
14
16
10: v9 go-kit 微服务 服务链路追踪(jaeger 实现)(2)
15
17
11: v11 go-kit 微服务 添加一个简单网关
16
18
17
-
18
19
# gRPC负载均衡(自定义负载均衡策略--etcd 实现)
20
+
19
21
### [ hlb-grpc] ( https://github.com/hwholiday/learning_tools/tree/master/hlb-grpc ) (gRPC负载均衡(自定义负载均衡策略--etcd 实现)
22
+
20
23
##### 实现基于版本(version)的grpc负载均衡器,了解过程后可自己实现更多的负载均衡功能
24
+
21
25
### [ 详细介绍] ( https://www.hwholiday.com/2021/etcd_grpc/ )
26
+
22
27
+ 注册中心
23
28
- Etcd Lease 是一种检测客户端存活状况的机制。 群集授予具有生存时间的租约。 如果etcd 群集在给定的TTL 时间内未收到keepAlive,则租约到期。 为了将租约绑定到键值存储中,每个key 最多可以附加一个租约
24
29
+ 服务注册 (注册服务)
48
53
└── register_test.go
49
54
50
55
```
56
+
51
57
# 仿微信 auth2 授权登陆
58
+
52
59
##### DDD(领域设计驱动)+六边形架构
53
- ### [ auth2] ( https://github.com/hwholiday/learning_tools/tree/master/ddd-auth2-example )
60
+
61
+ ### [ AUTH2] ( https://github.com/hwholiday/learning_tools/tree/master/ddd-auth2-example ) (auth2 授权码模式)
62
+
63
+ # Golang DDD 的项目分层结构(六边形架构)
64
+
65
+ ### [ AUTH2] ( https://github.com/hwholiday/learning_tools/tree/master/ddd-project-example ) (DDD 项目分层结构)
66
+
54
67
``` base
55
- .
56
- ├── adpter
57
- │ ├── adpter.go
68
+ ├── cmd 存放 main.go 等
69
+ ├── adapter
70
+ │ ├── grpc
58
71
│ └── http
59
- │ ├── auth_handles
60
- │ │ ├── auth_code_handles.go
61
- │ │ ├── auth_token_handles.go
62
- │ │ └── handers.go
63
- │ ├── http.go
64
- │ └── routers
65
- │ ├── middleware.go
66
- │ └── routers.go
67
- ├── cmd
68
- │ ├── app.yaml
69
- │ ├── cmd
70
- │ ├── main.go
71
- │ ├── wire_gen.go
72
- │ └── wire.go
72
+ │ └── facade 引用其他微服务(接口防腐层)
73
+ ├── application
74
+ │ ├── assembler 负责将内部领域模型转化为可对外的DTO
75
+ │ └── cqe Command、Query和Event -- 入参
76
+ │ └── dto Application层的所有接口返回值为DTO -- 出参
77
+ │ └── service 负责业务流程的编排,但本身不负责任何业务逻辑
73
78
├── domain
74
- │ ├── aggregate
75
- │ │ ├── auth_code.go
76
- │ │ ├── auth_factory.go
77
- │ │ ├── auth_token.go
78
- │ │ ├── auth_token_produce.go
79
- │ │ └── factory.go
80
- │ ├── dto
81
- │ │ ├── auth_code.go
82
- │ │ ├── auth_token.go
83
- │ │ └── user.go
84
- │ ├── entity
85
- │ │ └── merchant.go
86
- │ ├── obj
87
- │ │ ├── auth_code.go
88
- │ │ └── auth_token.go
89
- │ ├── repo
90
- │ │ ├── auth_code.go
91
- │ │ ├── auth_token.go
92
- │ │ ├── merchant.go
93
- │ │ └── specification
94
- │ │ ├── auth_code_by_code.go
95
- │ │ ├── auth_token_by_code.go
96
- │ │ └── merchant_by_appid.go
97
- │ └── service
98
- │ ├── auth_code.go
99
- │ ├── auth_token.go
100
- │ ├── merchant.go
101
- │ └── service.go
102
- ├── infrastructure
103
- │ ├── conf
104
- │ │ ├── auth_consts.go
105
- │ │ └── conf.go
106
- │ ├── pkg
107
- │ │ ├── database
108
- │ │ │ ├── mongo
109
- │ │ │ │ └── mgo.go
110
- │ │ │ └── redis
111
- │ │ │ ├── lock.go
112
- │ │ │ ├── redis.go
113
- │ │ ├── hcode
114
- │ │ │ ├── base.go
115
- │ │ │ └── code.go
116
- │ │ ├── log
117
- │ │ │ └── zap.go
118
- │ │ └── tool
119
- │ │ ├── aes.go
120
- │ │ ├── aes_test.go
121
- │ │ ├── jwt.go
122
- │ │ └── jwt_test.go
123
- │ └── repository
124
- │ ├── atuh_code.go
125
- │ ├── atuh_token.go
126
- │ ├── merchant.go
127
- │ └── repository.go
128
- └── README.md
129
-
79
+ │ ├── aggregate 聚合
80
+ │ ├── entity 实体
81
+ │ ├── event 事件
82
+ │ │ ├── publish
83
+ │ │ └── subsctibe
84
+ │ ├── repo 接口
85
+ │ │ └── specification 统一封装查询
86
+ │ ├── service 领域服务
87
+ │ └── vo 值对象
88
+ └── infrastructure
89
+ ├── config 配置文件
90
+ ├── pkg 常用工具类封装(DB,log,tool等)
91
+ └── repository
92
+ ├── converter domain内对象转化 do {互转}
93
+ └── do 数据库映射对象
130
94
```
131
- # go_push 一个实用的消息推送服务
95
+
96
+ # go_push 一个实用的消息推送服务
97
+
132
98
### [ go_push] ( https://github.com/hwholiday/learning_tools/tree/master/go_push ) (推送服务)
133
-
99
+
134
100
```base
135
101
├── gateway // 长连接网关服务器
136
102
│ ├── push_job.go // 分发任务
@@ -173,15 +139,16 @@ t.Log(conf)
173
139
t.Log(r.Close())
174
140
```
175
141
176
-
177
142
### [ micro_agent] ( https://github.com/hwholiday/learning_tools/tree/master/micro_agent ) (micro微服务)
143
+
178
144
1: base 基础方法
179
145
2: conf 配置文件
180
146
3:handler 对外处理方法
181
147
4:model 数据格式
182
148
5:proto protobuf 文件
183
-
149
+
184
150
### [ project_layout] ( https://github.com/hwholiday/learning_tools/tree/master/project_layout ) (项目结构)
151
+
185
152
```base
186
153
详细介绍查看文件夹内README.me内容
187
154
@@ -202,137 +169,172 @@ t.Log(r.Close())
202
169
└─tool
203
170
```
204
171
205
- ### [ all_packaged_library] ( https://github.com/hwholiday/learning_tools/tree/master/all_packaged_library ) 里面封装了一些常用的库,有详细的介绍,持续更新
172
+ ### [ all_packaged_library] ( https://github.com/hwholiday/learning_tools/tree/master/all_packaged_library ) 里面封装了一些常用的库,有详细的介绍,持续更新
173
+
206
174
1: base 里面封装mysql,redis,mgo,minio文件储存库S3协议,雪花算法,退出程序方法,redis全局锁,日志库等(插件形式可单独引用)
207
175
2: logtool uber_zap日志库封装,可自动切分日志文件,压缩文件
208
176
3: perf ppoof小插件
209
177
4: push 集成苹果推送,google推送,华为推送
210
178
5: quit 优雅的退出程序
211
179
6: registrySelector 基于etcd实现的服务注册,发现,负载均衡
212
180
213
-
214
-
215
-
216
181
### [ nsq] ( https://github.com/hwholiday/learning_tools/tree/master/docker ) (为你的服务插上docker_compose翅膀)
182
+
217
183
1: docker 为你的服务插上docker_compose翅膀
218
-
184
+
219
185
### [ kafka] ( https://github.com/hwholiday/learning_tools/tree/master/kafka ) (分布式消息发布订阅系统)
186
+
220
187
1: main 消息队列
221
-
188
+
222
189
### [ NATS_streaming] ( https://github.com/hwholiday/learning_tools/tree/master/NATS_streaming ) (分布式消息发布订阅系统--是由NATS驱动的数据流系统)
190
+
223
191
1: main 消息队列
224
-
192
+
225
193
### [ nsq] ( https://github.com/hwholiday/learning_tools/tree/master/kafka ) (分布式实时消息平台)
194
+
226
195
1: main 消息队列
227
-
196
+
228
197
### [ grpc] ( https://github.com/hwholiday/learning_tools/tree/master/grpc ) (grpc学习)
198
+
229
199
1: bidirectional_streaming_rpc 双向流grpc
230
200
2: server_side_streaming_rpc 服务端流grpc,也可以写成客户端流grpc
231
201
3: simple_rpc 简单grpc
232
202
233
203
### [ rpc] ( https://github.com/hwholiday/learning_tools/tree/master/rpc ) (rpc学习)
204
+
234
205
1: main rpc学习
235
-
206
+
236
207
### [ prometheus] ( https://github.com/hwholiday/learning_tools/tree/master/prometheus ) (监控报警系统)
208
+
237
209
1: server Prometheus监控报警系统
238
210
239
211
### [ jaeger] ( https://github.com/hwholiday/learning_tools/tree/master/jaeger ) (jaeger分布式链路追踪)
212
+
240
213
1: main jaeger分布式链路追踪
241
-
214
+
242
215
### [ service_load_balancing] ( https://github.com/hwholiday/learning_tools/tree/master/service_load_balancing ) (负载均衡)
216
+
243
217
1: fisher_yates_test 添加fisher-yates算法 负载均衡节点
244
218
245
219
### [ hystrix] ( https://github.com/hwholiday/learning_tools/tree/master/hystrix ) (熔断)
220
+
246
221
1: hystrix 学习并使用熔断(Hystrix)
247
222
248
223
### [ req_limit] ( https://github.com/hwholiday/learning_tools/tree/master/req_limit ) (限流)
224
+
249
225
1: main 使用带缓存的channel实现限流
250
226
2: uber_ratelimit 使用uber_ratelimit实现限流
251
-
227
+
252
228
### [ ini] ( https://github.com/hwholiday/learning_tools/tree/master/ini ) (配置文件库)
229
+
253
230
1: main 配置文件ini的读取,以及自动匹配到结构体里面
254
-
231
+
255
232
### [ minio] ( https://github.com/hwholiday/learning_tools/tree/master/minio ) (对象存储服务)
233
+
256
234
1: minio 对象存储服务使用
257
-
235
+
258
236
### [ mysql] ( https://github.com/hwholiday/learning_tools/tree/master/mysql ) (mysql服务器)
237
+
259
238
1: main 简单的mysql使用
260
-
239
+
261
240
### [ redis] ( https://github.com/hwholiday/learning_tools/tree/master/redis ) (redis相关)
241
+
262
242
1: bloom_filter redis 实现BloomFilter过滤器
263
243
2: lock redis实现全局锁
264
244
3: pipeline redis事务
265
245
4: subscription redis发布订阅
266
246
267
247
### [ mongodb] ( https://github.com/hwholiday/learning_tools/tree/master/mongodb ) (mongodb服务器)
248
+
268
249
1: mgo.v2 mgo.v2库的基础使用学习
269
250
2: mongo-go-driver 官方库的demo,以及事务提交(不能是单节点)
270
251
271
252
### [ gin] ( https://github.com/hwholiday/learning_tools/tree/master/gin ) (web框架gin学习)
253
+
272
254
1: mvc 模式,swagger文档 可作为基础学习gin
273
-
255
+
274
256
### [ jwt] ( https://github.com/hwholiday/learning_tools/tree/master/jwt ) (JSON WEB TOKEN)
257
+
275
258
1: jwt 学习使用
276
-
259
+
277
260
### [ zaplog] ( https://github.com/hwholiday/learning_tools/tree/master/kafka ) (uber zap日志封装)
261
+
278
262
1: zap 日志封装
279
263
280
264
### [ snow_flake] ( https://github.com/hwholiday/learning_tools/tree/master/snow_flake ) (雪花算法)
265
+
281
266
1: main 雪花算法
282
267
283
268
### [ encryption_algorithm] ( https://github.com/hwholiday/learning_tools/tree/master/encryption_algorithm ) (双棘轮算法, KDF链,迪菲-赫尔曼棘轮,x3dh)
269
+
284
270
1: aes ase-(cfb,cbc,ecb)-(128,192,256)加解密方法
285
271
2: curve25519 椭圆曲线算法
286
272
3: 3curve25519 双棘轮算法,KDF链
287
273
288
274
### [ LRU] ( https://github.com/hwholiday/learning_tools/tree/master/LRU ) (缓存淘汰算法)
275
+
289
276
1: list lru 缓存淘汰算法
290
-
277
+
291
278
### [ tcp] ( https://github.com/hwholiday/learning_tools/tree/master/tcp ) (tcp协议实现)
279
+
292
280
1: 实现网络库,封包,解包 len+tag+data 模式
293
-
281
+
294
282
### [ websocket] ( https://github.com/hwholiday/learning_tools/tree/master/websocket ) (websocket协议实现)
283
+
295
284
1: 实现网络库
296
-
285
+
297
286
### [ binary_conversion] ( https://github.com/hwholiday/learning_tools/tree/master/tool/binary_conversion ) (进制转换)
287
+
298
288
1: 10to36 10进制转36进制
299
289
2: 10to62 10进制转62进制
300
290
3: 10to76 10进制转76进制
301
291
4: binary 用一个int64来描述开关(用户设置很多建议使用)
302
292
303
293
### [ job_worker_mode] ( https://github.com/hwholiday/learning_tools/tree/master/job_worker_mode ) (job_worker模式)
294
+
304
295
1: worker job_worker模式,可提高系统吞吐量
305
296
306
297
### [ filewatch] ( https://github.com/hwholiday/learning_tools/tree/master/filewatch ) (监控文件变化)
298
+
307
299
1: main 监控文件变化 可实现自动构建
308
300
309
301
### [ push] ( https://github.com/hwholiday/learning_tools/tree/master/prometheus ) (一个简单的推送服务)
302
+
310
303
1: main 推送服务
311
-
304
+
312
305
### [ goquery] ( https://github.com/hwholiday/learning_tools/tree/master/goquery ) (网页解析工具)
306
+
313
307
1: main 可以作为爬虫解析网页使用
314
-
308
+
315
309
### [ active_object] ( https://github.com/hwholiday/learning_tools/tree/master/active_object ) (并发设计模式)
310
+
316
311
1: active_object Go并发设计模式之Active Object
317
-
312
+
318
313
### [ heap] ( https://github.com/hwholiday/learning_tools/tree/master/container/heap ) (优先级队列)
314
+
319
315
1: heap 利用heap创建一个优先级队列
320
-
316
+
321
317
### [ cli] ( https://github.com/hwholiday/learning_tools/tree/master/cli ) (go命令行交互)
318
+
322
319
1: main go命令行交互
323
-
320
+
324
321
### [ context] ( https://github.com/hwholiday/learning_tools/tree/master/context ) (context包学习)
322
+
325
323
1: main context包学习
326
-
324
+
327
325
### [ err] ( https://github.com/hwholiday/learning_tools/tree/master/err ) (error 相关)
326
+
328
327
1: main golang 1.13 error 相关
329
-
328
+
330
329
### [ interface] ( https://github.com/hwholiday/learning_tools/tree/master/interface ) (interface包学习)
330
+
331
331
1: main interface包学习
332
332
2: middleware Golang 基于interface 实现中间件
333
-
333
+
334
334
### [ syncPool] ( https://github.com/hwholiday/learning_tools/tree/master/syncPool ) (syncPool包学习)
335
+
335
336
1: main syncPool包学习
336
337
337
338
### [ reflect] ( https://github.com/hwholiday/learning_tools/tree/master/reflect ) (reflect包学习)
339
+
338
340
1: main reflect包学习
0 commit comments