Skip to content

Commit 9b0310d

Browse files
committed
add iptables_mock_disconnect
1 parent 0a82955 commit 9b0310d

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

2023/12/iptables_mock_disconnect.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# [iptables模拟服务端停机](/2023/12/iptables_mock_disconnect.md)
2+
3+
一天遇到coinex交易所停机维护两次,早上看到k线停了几个小时的柱子结果下午又停机,真的需要测试下策略机器人对交易所停机维护的鲁棒性,正好可用iptables去模拟网络阻断
4+
5+
列出和编辑iptables规则:
6+
7+
```
8+
iptables -L
9+
iptables-save > iptables_rules.txt
10+
vim iptables_rules.txt
11+
iptables-restore < iptables_rules.txt
12+
```
13+
14+
```
15+
dig api.gateio.ws
16+
iptables -A OUTPUT -p tcp -d 18.182.179.133 -j DROP
17+
# 然后 curl 就卡住了
18+
w@DESKTOP-SV7LDNF:~$ curl -v https://api.gateio.ws/api/v4/spot/time
19+
* Trying 18.182.179.133:443...
20+
* TCP_NODELAY set
21+
```

2023/12/ws_tool_deflate_bug.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ Rust生态知名的active-web,tokio-tungstenite,websocket-rs这几个没一个
9393

9494
> [2023-12-19T14:31:39Z ERROR ws::handler] WS Error <Io(Custom { kind: BrokenPipe, error: "None" })>
9595
96+
[ws-tool随后的修复patch](https://github.com/PrivateRookie/ws-tool/commit/73c6906bb87cef8f46fa98b7042fe7a9b3fe7d15)
97+
98+
顺便也把我之前反馈的币安windowsSize设置15会报错但14不会也解决了
99+
100+
<https://dev.binance.vision/t/receive-invalid-json-error-with-permessage-deflate-window-bits-set-to-15-but-when-it-set-to-9-14-get-no-error/17759>
101+
102+
不过okx的api有点奇怪 明明启用了deflate, 但传过来的确实rsv1==false的帧, 也就是没压缩的 (我猜测是网关转发消息中间件问题)
103+
104+
[ws-tool 针对 okx 的修复 patch](https://github.com/PrivateRookie/ws-tool/commit/f036f0521b63265b476549bb604c258387869f62)
105+
96106
## lz4
97107

98108
浏览器实现 deflate 和 zlib 的 deflate 实现都有些小差异... 没几个能参考的...

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- [文章列表 - 吴翱翔的博客](/)
22
- [正在读的书](/books.md)
33
- **2023-12**
4+
- [iptables模拟服务端停机](/2023/12/iptables_mock_disconnect.md)
45
- [ws-tool压缩bug](/2023/12/ws_tool_deflate_bug.md)
56
- [双峰分布biomodal](/2023/12/bimodal_distribution.md)
67
- [Criterion bench](/2023/12/criterion_benchmark.md)

0 commit comments

Comments
 (0)