TCP_NODELAY 是什么

引言

最近在使用 curl 的时候经常注意到:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# strrl @ eiu in ~ [11:02:50]
$ curl -v google.com
* Rebuilt URL to: google.com/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 6152 (#0)
> GET http://google.com/ HTTP/1.1
> Host: google.com
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 02 Oct 2019 03:02:53 GMT
< Expires: Fri, 01 Nov 2019 03:02:53 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host 127.0.0.1 left intact

会有一个 TCP_NODELAY set 的日志打出来, 然鹅已经不是很记得大学计网里关于这个特性了, 所以自己又翻一番资料去了解这个.

Restful API Mock 工具: JSONPlaceholder

最近闲逛的时候发现了这个工具, JSONPlaceholder.
它自带了一些数据, 比如说 posts, users 啊.
而且正如它的名字 placeholder, 在开发时一些还没定下的 POST/PUT/DELETE 接口也可以直接发过去.

另外还有一个项目My JSON Server, 可以将你的 JSON 数据放到 Github 上的一个仓库里, 然后就可以使用这个功能, 无需自己搭服务器.

红黑树

红黑树是一种自平衡二叉查找树, 它的特点是拥有良好的最坏情况的时间复杂度: O(log n). 因此 Java 的 HashMap 使用红黑树可以一定程度上避免 hash 碰撞攻击.

二叉树

二叉树是每个节点最多只有两个分支的树, 二叉树的分支具有左右次序,不能随意颠倒。

Translate "man iptables" (updating)

[toc]

强迫自己看 iptables 的文档. 翻的很烂, 自己明白就行.

Netfilter-packet-flow

Name

iptables - administration tool for IPv4 packet filtering and NAT iptables - IPv4 包过滤和 NAT 的管理工具

Synopsis 简介

1
2
3
4
5
6
7
8
9
iptables [-t table] -[AD] chain rule-specification [options]
iptables [-t table] -I chain [rulenum] rule-specification [options]
iptables [-t table] -R chain rulenum rule-specification [options]
iptables [-t table] -D chain rulenum [options]
iptables [-t table] -[LFZ][chain] [options]
iptables [-t table] -N chain
iptables [-t table] -X [chain]
iptables [-t table] -P chain target [options]
iptables [-t table] -E old-chain-name new-chain-name

Description 描述

Iptables is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel.
在 linux 内核中 iptable 被用来配置, 维护和检查 IP 包过滤规则表.