1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

[docs feat]format specification

This commit is contained in:
Guide 2023-04-28 17:15:47 +08:00
parent 8f8d7c102a
commit a788fc300d
35 changed files with 17624 additions and 45 deletions

View File

@ -141,10 +141,10 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
**重要知识点详解**
- [OSI 和 TCP/IP 网络分层模型详解(基础)](./docs/cs-basics/network/osi&tcp-ip-model.md)
- [OSI 和 TCP/IP 网络分层模型详解(基础)](./docs/cs-basics/network/osi-and-tcp-ip-model.md)
- [应用层常见协议总结(应用层)](./docs/cs-basics/network/application-layer-protocol.md)
- [HTTP vs HTTPS应用层](./docs/cs-basics/network/http&https.md)
- [HTTP 1.0 vs HTTP 1.1(应用层)](./docs/cs-basics/network/http1.0&http1.1.md)
- [HTTP vs HTTPS应用层](./docs/cs-basics/network/http-vs-https.md)
- [HTTP 1.0 vs HTTP 1.1(应用层)](./docs/cs-basics/network/http1.0-vs-http1.1.md)
- [HTTP 常见状态码(应用层)](./docs/cs-basics/network/http-status-codes.md)
- [DNS 域名系统详解(应用层)](./docs/cs-basics/network/dns.md)
- [TCP 三次握手和四次挥手(传输层)](./docs/cs-basics/network/tcp-connection-and-disconnection.md)
@ -300,7 +300,7 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
- [认证授权基础概念详解](./docs/system-design/security/basis-of-authority-certification.md)
- [JWT 基础概念详解](./docs/system-design/security/jwt-intro.md)
- [JWT 优缺点分析以及常见问题解决方案](./docs/system-design/security/advantages&disadvantages-of-jwt.md)
- [JWT 优缺点分析以及常见问题解决方案](./docs/system-design/security/advantages-and-disadvantages-of-jwt.md)
- [SSO 单点登录详解](./docs/system-design/security/sso-intro.md)
- [权限系统设计详解](./docs/system-design/security/design-of-authority-system.md)
@ -324,10 +324,10 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
### 理论&算法&协议
- [CAP 理论和 BASE 理论详解](./docs/distributed-system/theorem&algorithm&protocol/cap&base-theorem.md)
- [Paxos 算法详解](./docs/distributed-system/theorem&algorithm&protocol/paxos-algorithm.md)
- [Raft 算法详解](./docs/distributed-system/theorem&algorithm&protocol/raft-algorithm.md)
- [Gossip 协议详解](./docs/distributed-system/theorem&algorithm&protocol/gossip-protocl.md)
- [CAP 理论和 BASE 理论详解](./docs/distributed-system/protocol/cap-and-base-theorem.md)
- [Paxos 算法详解](./docs/distributed-system/protocol/paxos-algorithm.md)
- [Raft 算法详解](./docs/distributed-system/protocol/raft-algorithm.md)
- [Gossip 协议详解](./docs/distributed-system/protocol/gossip-protocl.md)
### API 网关

View File

@ -19,7 +19,7 @@ export const highQualityTechnicalArticles = arraySidebar([
collapsible: false,
children: [
"four-year-work-in-tencent-summary",
"two-years-of-back-end-develop--experience-in-didi&toutiao",
"two-years-of-back-end-develop--experience-in-didi-and-toutiao",
"8-years-programmer-work-summary",
"huawei-od-275-days",
],

View File

@ -22,7 +22,6 @@ export default sidebar({
{
text: "面试准备",
icon: "interview",
collapsible: true,
prefix: "interview-preparation/",
children: [
"teach-you-how-to-prepare-for-the-interview-hand-in-hand",
@ -174,10 +173,10 @@ export default sidebar({
icon: "star",
collapsible: true,
children: [
"osi&tcp-ip-model",
"osi-and-tcp-ip-model",
"application-layer-protocol",
"http&https",
"http1.0&http1.1",
"http-vs-https",
"http1.0-vs-http1.1",
"http-status-codes",
"dns",
"tcp-connection-and-disconnection",
@ -418,7 +417,7 @@ export default sidebar({
children: [
"basis-of-authority-certification",
"jwt-intro",
"advantages&disadvantages-of-jwt",
"advantages-and-disadvantages-of-jwt",
"sso-intro",
"design-of-authority-system",
"sentive-words-filter",
@ -440,9 +439,9 @@ export default sidebar({
{
text: "理论&算法&协议",
icon: "suanfaku",
prefix: "theorem&algorithm&protocol/",
prefix: "protocol/",
children: [
"cap&base-theorem",
"cap-and-base-theorem",
"paxos-algorithm",
"raft-algorithm",
"gossip-protocl",

View File

@ -1,4 +1,3 @@
$theme-color: #2980b9;
$sidebar-width: 20rem;
$sidebar-mobile-width: 16rem;
$content-width: 60em;
// $sidebar-width: 20rem;
// $sidebar-mobile-width: 16rem;

View File

@ -61,7 +61,7 @@ SSL/TLS 的核心要素是**非对称加密**。非对称加密采用两个密
>
> 这样,通信信息就不会被其他人截获了,这依赖于私钥的保密性。
![](./images/http&https/public-key-cryptography.png)
![](./images/http-vs-https/public-key-cryptography.png)
非对称加密的公钥和私钥需要采用一种复杂的数学机制生成(密码学认为,为了较高的安全性,尽量不要自己创造加密方案)。公私钥对的生成算法依赖于单向陷门函数。
@ -69,7 +69,7 @@ SSL/TLS 的核心要素是**非对称加密**。非对称加密采用两个密
>
> 单向陷门函数:一个较弱的单向函数。已知单向陷门函数 f陷门 h给定任意一个输入 x易计算出输出 y=f(x;h);而给定一个输出 y假设存在 f(x;h)=y很难根据 f 来计算出 x但可以根据 f 和 h 来推导出 x。
![单向函数](./images/http&https/OWF.png)
![单向函数](./images/http-vs-https/OWF.png)
上图就是一个单向函数(不是单项陷门函数),假设有一个绝世秘籍,任何知道了这个秘籍的人都可以把苹果汁榨成苹果,那么这个秘籍就是“陷门”了吧。
@ -81,7 +81,7 @@ SSL/TLS 的核心要素是**非对称加密**。非对称加密采用两个密
> 对称加密:通信双方共享唯一密钥 k加解密算法已知加密方利用密钥 k 加密,解密方利用密钥 k 解密,保密性依赖于密钥 k 的保密性。
![](./images/http&https/symmetric-encryption.png)
![](./images/http-vs-https/symmetric-encryption.png)
对称加密的密钥生成代价比公私钥对的生成代价低得多,那么有的人会问了,为什么 SSL/TLS 还需要使用非对称加密呢?因为对称加密的保密性完全依赖于密钥的保密性。在双方通信之前,需要商量一个用于对称加密的密钥。我们知道网络通信的信道是不安全的,传输报文对任何人是可见的,密钥的交换肯定不能直接在网络信道中传输。因此,使用非对称加密,对对称加密的密钥进行加密,保护该密钥不在网络信道中被窃听。这样,通信双方只需要一次非对称加密,交换对称加密的密钥,在之后的信息通信中,使用绝对安全的密钥,对信息进行对称加密,即可保证传输消息的保密性。
@ -99,7 +99,7 @@ SSL/TLS 介绍到这里,了解信息安全的朋友又会想到一个安全隐
>
> 同样的S 公钥即使做加密也难以避免这种信任性问题C 被 AS 拐跑了!
![](./images/http&https/attack1.png)
![](./images/http-vs-https/attack1.png)
为了公钥传输的信赖性问题第三方机构应运而生——证书颁发机构CACertificate Authority。CA 默认是受信任的第三方。CA 会给各个服务器颁发证书,证书存储在服务器上,并附有 CA 的**电子签名**(见下节)。
@ -117,7 +117,7 @@ SSL/TLS 介绍到这里,了解信息安全的朋友又会想到一个安全隐
>
> 客户端对证书数据(包含服务器的公钥)做相同的散列处理,得到摘要,并将该摘要与之前从签名中解码出的摘要做对比,如果相同,则身份验证成功;否则验证失败。
![](./images/http&https/digital-signature.png)
![](./images/http-vs-https/digital-signature.png)
总结来说,带有证书的公钥传输机制如下:
@ -127,7 +127,7 @@ SSL/TLS 介绍到这里,了解信息安全的朋友又会想到一个安全隐
4. C 获得 S 的证书,信任 CA 并知晓 CA 公钥,使用 CA 公钥对 S 证书上的签名解密,同时对消息进行散列处理,得到摘要。比较摘要,验证 S 证书的真实性。
5. 如果 C 验证 S 证书是真实的,则信任 S 的公钥(在 S 证书中)。
![](./images/http&https/public-key-transmission.png)
![](./images/http-vs-https/public-key-transmission.png)
对于数字签名,我这里讲的比较简单,如果你没有搞清楚的话,强烈推荐你看看[数字签名及数字证书原理](https://www.bilibili.com/video/BV18N411X7ty/)这个视频,这是我看过最清晰的讲解。

View File

@ -29,9 +29,9 @@ HTTP/1.0提供的缓存机制非常简单。服务器端使用`Expires`标签来
如果服务器判断`If-Modified-Since`时间后,资源被修改过,则返回给客户端一个`200 OK`的响应体,并附带全新的资源内容,表示”你要的我已经改过的,给你一份新的”。
![HTTP1.0cache1](./images/http&https/HTTP1.0cache1.png)
![HTTP1.0cache1](./images/http-vs-https/HTTP1.0cache1.png)
![HTTP1.0cache2](./images/http&https/HTTP1.0cache2.png)
![HTTP1.0cache2](./images/http-vs-https/HTTP1.0cache2.png)
### HTTP/1.1
@ -78,9 +78,9 @@ HTTP/1.1引入了范围请求range request机制以避免带宽的浪
HTTP/1.1中新加入了状态码`100`。该状态码的使用场景为,存在某些较大的文件请求,服务器可能不愿意响应这种请求,此时状态码`100`可以作为指示请求是否会被正常响应,过程如下图:
![HTTP1.1continue1](./images/http&https/HTTP1.1continue1.png)
![HTTP1.1continue1](./images/http-vs-https/HTTP1.1continue1.png)
![HTTP1.1continue2](./images/http&https/HTTP1.1continue2.png)
![HTTP1.1continue2](./images/http-vs-https/HTTP1.1continue2.png)
然而在HTTP/1.0中,并没有`100 (Continue)`状态码,要想触发这一机制,可以发送一个`Expect`头部,其中包含一个`100-continue`的值。

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -38,7 +38,7 @@ tag:
![TCP/IP 四层模型](https://oss.javaguide.cn/github/javaguide/cs-basics/network/tcp-ip-4-model.png)
关于每一层作用的详细介绍,请看 [OSI 和 TCP/IP 网络分层模型详解(基础)](https://javaguide.cn/cs-basics/network/osi&tcp-ip-model.html) 这篇文章。
关于每一层作用的详细介绍,请看 [OSI 和 TCP/IP 网络分层模型详解(基础)](https://javaguide.cn/cs-basics/network/osi-and-tcp-ip-model.html) 这篇文章。
#### 为什么网络要分层?
@ -169,14 +169,14 @@ HTTP 状态码用于描述 HTTP 请求的结果,比如 2xx 就代表请求被
### HTTP 和 HTTPS 有什么区别?(重要)
![HTTP 和 HTTPS 对比](https://oss.javaguide.cn/github/javaguide/cs-basics/network/http-vs-https.png)
![HTTP 和 HTTPS 对比](https://oss.javaguide.cn/github/javaguide/cs-basics/network/http1.0-vs-http1.1.png)
- **端口号** HTTP 默认是 80HTTPS 默认是 443。
- **URL 前缀** HTTP 的 URL 前缀是 `http://`HTTPS 的 URL 前缀是 `https://`
- **安全性和资源消耗** HTTP 协议运行在 TCP 之上所有传输的内容都是明文客户端和服务器端都无法验证对方的身份。HTTPS 是运行在 SSL/TLS 之上的 HTTP 协议SSL/TLS 运行在 TCP 之上。所有传输的内容都经过加密加密采用对称加密但对称加密的密钥用服务器方的证书进行了非对称加密。所以说HTTP 安全性没有 HTTPS 高,但是 HTTPS 比 HTTP 耗费更多服务器资源。
- **SEO搜索引擎优化** :搜索引擎通常会更青睐使用 HTTPS 协议的网站,因为 HTTPS 能够提供更高的安全性和用户隐私保护。使用 HTTPS 协议的网站在搜索结果中可能会被优先显示,从而对 SEO 产生影响。
关于 HTTP 和 HTTPS 更详细的对比总结,可以看我写的这篇文章:[HTTP vs HTTPS应用层](./http&https.md) 。
关于 HTTP 和 HTTPS 更详细的对比总结,可以看我写的这篇文章:[HTTP vs HTTPS应用层](./http-vs-https.md) 。
### HTTP/1.0 和 HTTP/1.1 有什么区别?
@ -188,7 +188,7 @@ HTTP 状态码用于描述 HTTP 请求的结果,比如 2xx 就代表请求被
- **带宽** HTTP/1.0 中存在一些浪费带宽的现象例如客户端只是需要某个对象的一部分而服务器却将整个对象送过来了并且不支持断点续传功能HTTP/1.1 则在请求头引入了 range 头域,它允许只请求资源的某个部分,即返回码是 206Partial Content这样就方便了开发者自由的选择以便于充分利用带宽和连接。
- **Host 头Host Header处理** :HTTP/1.1 引入了 Host 头字段,允许在同一 IP 地址上托管多个域名,从而支持虚拟主机的功能。而 HTTP/1.0 没有 Host 头字段,无法实现虚拟主机。
关于 HTTP/1.0 和 HTTP/1.1 更详细的对比总结,可以看我写的这篇文章:[HTTP/1.0 vs HTTP/1.1(应用层)](./http1.0&http1.1.md) 。
关于 HTTP/1.0 和 HTTP/1.1 更详细的对比总结,可以看我写的这篇文章:[HTTP/1.0 vs HTTP/1.1(应用层)](./http1.0-vs-http1.1.md) 。
### HTTP/1.1 和 HTTP/2.0 有什么区别?

View File

@ -263,9 +263,9 @@ ZAB 协议包括两种基本的模式,分别是
关于 **ZAB 协议&Paxos 算法** 需要讲和理解的东西太多了,具体可以看下面这几篇文章:
- [Paxos 算法详解](https://javaguide.cn/distributed-system/theorem&algorithm&protocol/paxos-algorithm.html)
- [Paxos 算法详解](https://javaguide.cn/distributed-system/protocol/paxos-algorithm.html)
- [Zookeeper ZAB 协议分析](https://dbaplus.cn/news-141-1875-1.html)
- [Raft 算法详解](https://javaguide.cn/distributed-system/theorem&algorithm&protocol/raft-algorithm.html)
- [Raft 算法详解](https://javaguide.cn/distributed-system/protocol/raft-algorithm.html)
## 总结

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -18,7 +18,7 @@
## 个人经历
- [从校招入职腾讯的四年工作总结](./personal-experience/four-year-work-in-tencent-summary.md)
- [我在滴滴和头条的两年后端研发工作经验分享](./personal-experience/two-years-of-back-end-develop--experience-in-didi&toutiao.md)
- [我在滴滴和头条的两年后端研发工作经验分享](./personal-experience/two-years-of-back-end-develop--experience-in-didi-and-toutiao.md)
- [一个中科大差生的 8 年程序员工作总结](./personal-experience/8-years-programmer-work-summary.md)
- [华为 OD 275 天后,我进了腾讯!](./personal-experience/huawei-od-275-days.md)

View File

@ -134,10 +134,10 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
**重要知识点详解**
- [OSI 和 TCP/IP 网络分层模型详解(基础)](./cs-basics/network/osi&tcp-ip-model.md)
- [OSI 和 TCP/IP 网络分层模型详解(基础)](./cs-basics/network/osi-and-tcp-ip-model.md)
- [应用层常见协议总结(应用层)](./cs-basics/network/application-layer-protocol.md)
- [HTTP vs HTTPS应用层](./cs-basics/network/http&https.md)
- [HTTP 1.0 vs HTTP 1.1(应用层)](./cs-basics/network/http1.0&http1.1.md)
- [HTTP vs HTTPS应用层](./cs-basics/network/http-vs-https.md)
- [HTTP 1.0 vs HTTP 1.1(应用层)](./cs-basics/network/http1.0-vs-http1.1.md)
- [HTTP 常见状态码(应用层)](./cs-basics/network/http-status-codes.md)
- [DNS 域名系统详解(应用层)](./cs-basics/network/dns.md)
- [TCP 三次握手和四次挥手(传输层)](./cs-basics/network/tcp-connection-and-disconnection.md)
@ -293,7 +293,7 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
- [认证授权基础概念详解](./system-design/security/basis-of-authority-certification.md)
- [JWT 基础概念详解](./system-design/security/jwt-intro.md)
- [JWT 优缺点分析以及常见问题解决方案](./system-design/security/advantages&disadvantages-of-jwt.md)
- [JWT 优缺点分析以及常见问题解决方案](./system-design/security/advantages-and-disadvantages-of-jwt.md)
- [SSO 单点登录详解](./system-design/security/sso-intro.md)
- [权限系统设计详解](./system-design/security/design-of-authority-system.md)
@ -317,10 +317,10 @@ JVM 这部分内容主要参考 [JVM 虚拟机规范-Java8 ](https://docs.oracle
### 理论&算法&协议
- [CAP 理论和 BASE 理论解读](./distributed-system/theorem&algorithm&protocol/cap&base-theorem.md)
- [Paxos 算法解读](./distributed-system/theorem&algorithm&protocol/paxos-algorithm.md)
- [Raft 算法解读](./distributed-system/theorem&algorithm&protocol/raft-algorithm.md)
- [Gossip 协议详解](./distributed-system/theorem&algorithm&protocol/gossip-protocl.md)
- [CAP 理论和 BASE 理论解读](./distributed-system/protocol/cap-and-base-theorem.md)
- [Paxos 算法解读](./distributed-system/protocol/paxos-algorithm.md)
- [Raft 算法解读](./distributed-system/protocol/raft-algorithm.md)
- [Gossip 协议详解](./distributed-system/protocol/gossip-protocl.md)
### API 网关

View File

@ -15,7 +15,7 @@ JWT 自身包含了身份验证所需要的所有信息,因此,我们的服
并且, 使用 JWT 认证可以有效避免 CSRF 攻击,因为 JWT 一般是存在在 localStorage 中,使用 JWT 进行身份验证的过程中是不会涉及到 Cookie 的。
我在 [JWT 优缺点分析](./advantages&disadvantages-of-jwt.md)这篇文章中有详细介绍到使用 JWT 做身份认证的优势和劣势。
我在 [JWT 优缺点分析](./advantages-and-disadvantages-of-jwt.md)这篇文章中有详细介绍到使用 JWT 做身份认证的优势和劣势。
下面是 [RFC 7519](https://tools.ietf.org/html/rfc7519) 对 JWT 做的较为正式的定义。

17581
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff