diff --git a/FastGithub.Core/DomainConfig.cs b/FastGithub.Core/DomainConfig.cs
index 5c6ab09..7127059 100644
--- a/FastGithub.Core/DomainConfig.cs
+++ b/FastGithub.Core/DomainConfig.cs
@@ -12,6 +12,11 @@ namespace FastGithub
///
public bool TlsSni { get; set; }
+ ///
+ /// 请求超时时长
+ ///
+ public TimeSpan? Timeout { get; set; }
+
///
/// 目的地
/// 格式为相对或绝对uri
diff --git a/FastGithub.ReverseProxy/ReverseProxyMiddleware.cs b/FastGithub.ReverseProxy/ReverseProxyMiddleware.cs
index fd974b4..6e52e51 100644
--- a/FastGithub.ReverseProxy/ReverseProxyMiddleware.cs
+++ b/FastGithub.ReverseProxy/ReverseProxyMiddleware.cs
@@ -47,11 +47,13 @@ namespace FastGithub.ReverseProxy
}
var destinationPrefix = GetDestinationPrefix(host, domainConfig.Destination);
+ var requestConfig = new ForwarderRequestConfig { Timeout = domainConfig.Timeout };
+
var httpClient = domainConfig.TlsSni
? new HttpMessageInvoker(this.sniHttpClientHanlder, disposeHandler: false)
: new HttpMessageInvoker(this.noSniHttpClientHanlder, disposeHandler: false);
- var error = await httpForwarder.SendAsync(context, destinationPrefix, httpClient);
+ var error = await httpForwarder.SendAsync(context, destinationPrefix, httpClient, requestConfig);
await ResponseErrorAsync(context, error);
}
diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json
index c13e35a..0020d7f 100644
--- a/FastGithub/appsettings.json
+++ b/FastGithub/appsettings.json
@@ -8,38 +8,32 @@
"IPAddress": "114.114.114.114",
"Port": 53
},
- "DomainConfigs": { // *ʾ0ַ
+ "DomainConfigs": { // *ʾ0ַ
"github.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false, // ָʾtlsʱǷSNIĬΪfalse,
+ "Timeout": null, // ʱʱʽΪ"00:02:00"ĬΪnull
+ "Destination": null // ĿĵأʽΪԻUriĬnull
},
"githubstatus.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*.github.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*.github.io": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*.githubapp.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*.githubassets.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*.githubusercontent.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"*github*.s3.amazonaws.com": {
- "TlsSni": false,
- "Destination": null
+ "TlsSni": false
},
"ajax.googleapis.com": {
"TlsSni": true,
diff --git a/README.md b/README.md
index 8d97cfa..e214a1a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,8 @@ github加速神器
### 加速原理
* 修改本机的dns服务指向FastGithub自身
* 解析匹配的域名为FastGithub自身的ip
-* 请求信任的dns服务(dnscrypt-proxy)获取域名的ip并进行无SNI的https反向代理
+* 请求不受污染的dns服务(dnscrypt-proxy)获取域名的ip
+* 使用得到的ip进行无或有SNI的https反向代理
### 程序下载
[下载最新发布版本](https://gitee.com/jiulang/fast-github)