mirror of
https://github.com/ICKelin/gtun.git
synced 2025-09-27 03:15:52 +08:00
fix config parse
This commit is contained in:
36
README.md
36
README.md
@@ -13,29 +13,11 @@
|
|||||||
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
|
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
gtun是一款开源的ip代理加速软件,通过`tproxy`技术实现流量劫持,`quic`和`kcp`等协议优化广域网传输,gtun提供一个基础通道,所有加入`ipset`的ip,出口,入口流量都会被gtun进行拦截并代理到指定出口。
|
gtun是一款开源的ip代理加速软件,目前只支持linux,通过`tproxy`技术实现流量劫持,`quic`和`kcp`等协议优化广域网传输,gtun提供一个基础通道,所有加入`ipset`的ip的流量都会被gtun进行拦截并代理到指定出口。
|
||||||
|
|
||||||
gtun支持多线路配置,可以同时对美国,日本,欧洲目的网络进行加速访问。您可以结合dnsmasq来使用,将需要配置加速的域名解析结果加入ipset,从而实现域名加速。
|
gtun支持多线路配置,可以同时对美国,日本,欧洲目的网络进行加速访问。您可以结合dnsmasq来使用,将需要配置加速的域名解析结果加入ipset,从而实现域名加速。
|
||||||
|
|
||||||
[](https://www.youtube.com/watch?v=pxv02e5EXPE "")
|
[](https://www.youtube.com/watch?v=pxv02e5EXPE "")
|
||||||
|
|
||||||
## 应用场景
|
|
||||||
|
|
||||||
- SaaS软件加速,加速访问Salesforce,offce365等产品
|
|
||||||
- 云服务器加速,加速访问海外服务器,跳板机,提升操作流畅度
|
|
||||||
- 直播加速,tiktok海外直播加速,抖音直播加速
|
|
||||||
- 游戏加速,结合专线网络和路由盒子实现游戏加速盒
|
|
||||||
- 云服务器出口加速网关,加速整个公有云内网访问外网的流量
|
|
||||||
|
|
||||||
**玩法分享**
|
|
||||||
|
|
||||||
- [基于gtun+n1盒子实现软路由加速]()
|
|
||||||
- [基于gtun实现的tiktok加速路由]()
|
|
||||||
- [基于gtun实现办公网访问公有云内网]()
|
|
||||||
- [基于gtun实现的游戏加速盒]()
|
|
||||||
|
|
||||||
gtun是一个完整的加速器,**目前只支持linux**
|
|
||||||
|
|
||||||
同时我们也基于gtun开发了收费版本,对标阿里云的全球应用加速,ucloud的pathX等产品的功能,只是会更加灵活,支持私有化部署,独立部署,可以部署到公有云,数据中心和软路由,如果您感兴趣,可以访问[我们的网站](https://www.beyondnetwork.net)进行免费免费体验。
|
同时我们也基于gtun开发了收费版本,对标阿里云的全球应用加速,ucloud的pathX等产品的功能,只是会更加灵活,支持私有化部署,独立部署,可以部署到公有云,数据中心和软路由,如果您感兴趣,可以访问[我们的网站](https://www.beyondnetwork.net)进行免费免费体验。
|
||||||
|
|
||||||
关于项目有任何问题需要咨询,可以[联系作者](#关于作者)进行交流
|
关于项目有任何问题需要咨询,可以[联系作者](#关于作者)进行交流
|
||||||
@@ -54,6 +36,21 @@ gtun是一个完整的加速器,**目前只支持linux**
|
|||||||
- [有问题怎么办](#有问题怎么办)
|
- [有问题怎么办](#有问题怎么办)
|
||||||
- [关于作者](#关于作者)
|
- [关于作者](#关于作者)
|
||||||
|
|
||||||
|
## 应用场景
|
||||||
|
|
||||||
|
- SaaS软件加速,加速访问Salesforce,offce365等产品
|
||||||
|
- 云服务器加速,加速访问海外服务器,跳板机,提升操作流畅度
|
||||||
|
- 直播加速,tiktok海外直播加速,抖音直播加速
|
||||||
|
- 游戏加速,结合专线网络和路由盒子实现游戏加速盒
|
||||||
|
- 云服务器出口加速网关,加速整个公有云内网访问外网的流量
|
||||||
|
|
||||||
|
**玩法分享**
|
||||||
|
|
||||||
|
- [基于gtun+n1盒子实现软路由加速]()
|
||||||
|
- [基于gtun实现的tiktok加速路由]()
|
||||||
|
- [基于gtun实现办公网访问公有云内网]()
|
||||||
|
- [基于gtun实现的游戏加速盒]()
|
||||||
|
|
||||||
## 功能特性
|
## 功能特性
|
||||||
|
|
||||||
- 纯应用层实现,不存在overlay网络,支持tcp和udp协议以及运行在其上的所有七层协议
|
- 纯应用层实现,不存在overlay网络,支持tcp和udp协议以及运行在其上的所有七层协议
|
||||||
@@ -142,6 +139,7 @@ log:
|
|||||||
path: gtun.log
|
path: gtun.log
|
||||||
|
|
||||||
```
|
```
|
||||||
|
通常只需要修改server和trace两个字段,value为gtund的的`公网IP:监听端口`即可。
|
||||||
|
|
||||||
配置完成之后可以启动gtun程序,运行`./gtun -c gtun.yaml`即可启动。
|
配置完成之后可以启动gtun程序,运行`./gtun -c gtun.yaml`即可启动。
|
||||||
|
|
||||||
|
@@ -2,11 +2,11 @@ accelerator:
|
|||||||
HK:
|
HK:
|
||||||
routes:
|
routes:
|
||||||
- scheme: "kcp"
|
- scheme: "kcp"
|
||||||
server: "gtun.alihk.byc.com:3002",
|
server: "gtun.alihk.byc.com:3002"
|
||||||
trace: "gtun.alihk.byc.com:3003",
|
trace: "gtun.alihk.byc.com:3003"
|
||||||
- scheme: "mux"
|
- scheme: "mux"
|
||||||
server: "gtun.alihk.byc.com:3002",
|
server: "gtun.alihk.byc.com:3002"
|
||||||
trace: "gtun.alihk.byc.com:3003",
|
trace: "gtun.alihk.byc.com:3003"
|
||||||
proxy:
|
proxy:
|
||||||
tproxy_tcp: |
|
tproxy_tcp: |
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"github.com/ICKelin/gtun/src/internal/signature"
|
"github.com/ICKelin/gtun/src/internal/signature"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"os"
|
"os"
|
||||||
@@ -23,11 +22,11 @@ type RouteConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Accelerator struct {
|
type Accelerator struct {
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
GeoSite []string `json:"geo_site"`
|
GeoSite []string `json:"geo_site"`
|
||||||
GeoIP []string `json:"geo_ip"`
|
GeoIP []string `json:"geo_ip"`
|
||||||
Routes []*RouteConfig `json:"routes"`
|
Routes []*RouteConfig `json:"routes"`
|
||||||
Proxy map[string]json.RawMessage `json:"proxy"`
|
Proxy map[string]string `json:"proxy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Log struct {
|
type Log struct {
|
||||||
|
@@ -26,7 +26,7 @@ func Register(name string, constructor func() Proxy) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Serve(region string, proxyConfig map[string]json.RawMessage) error {
|
func Serve(region string, proxyConfig map[string]string) error {
|
||||||
logs.Debug("region %s proxy config %s", region, proxyConfig)
|
logs.Debug("region %s proxy config %s", region, proxyConfig)
|
||||||
err := setup(region, proxyConfig)
|
err := setup(region, proxyConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -36,14 +36,14 @@ func Serve(region string, proxyConfig map[string]json.RawMessage) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup(region string, proxyConfigs map[string]json.RawMessage) error {
|
func setup(region string, proxyConfigs map[string]string) error {
|
||||||
for name, config := range proxyConfigs {
|
for name, config := range proxyConfigs {
|
||||||
constructor := registerProxy[name]
|
constructor := registerProxy[name]
|
||||||
if constructor == nil {
|
if constructor == nil {
|
||||||
return errNotRegister
|
return errNotRegister
|
||||||
}
|
}
|
||||||
p := constructor()
|
p := constructor()
|
||||||
err := p.Setup(region, config)
|
err := p.Setup(region, json.RawMessage(config))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user