Compare commits

..
Author SHA1 Message Date
ginuerzh b86d7ee06d add log rotation 2022-10-20 21:10:25 +08:00
soffchen 8274b62672 add support for linux/amd64v3, windows/amd64v3 2022-10-07 09:27:22 +08:00
ginuerzh 7f924fdeb6 fix proxy protocol 2022-09-28 11:53:25 +08:00
ginuerzh 5d797eac43 add hop 2022-09-22 18:59:56 +08:00
ginuerzh 2c29028a3b update README 2022-09-14 21:13:11 +08:00
10 changed files with 109 additions and 39 deletions
+8
View File
@@ -9,6 +9,7 @@ PLATFORM_LIST = \
darwin-arm64 \
linux-386 \
linux-amd64 \
linux-amd64v3 \
linux-armv5 \
linux-armv6 \
linux-armv7 \
@@ -27,6 +28,7 @@ PLATFORM_LIST = \
WINDOWS_ARCH_LIST = \
windows-386 \
windows-amd64 \
windows-amd64v3 \
windows-arm64
all: linux-amd64 darwin-amd64 darwin-arm64 windows-amd64 # Most used
@@ -43,6 +45,9 @@ linux-386:
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
linux-amd64v3:
GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
linux-armv5:
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ $(GOFILES)
@@ -91,6 +96,9 @@ windows-386:
windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
windows-amd64v3:
GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
windows-arm64:
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe $(GOFILES)
+13 -12
View File
@@ -6,19 +6,20 @@
## 功能特性
- [x] 多端口监听
- [x] 多级转发链
- [x] [多端口监听](https://gost.run/getting-started/quick-start/)
- [x] [多级转发链](https://gost.run/concepts/chain/)
- [x] 多协议支持
- [x] TCP/UDP端口转发
- [x] TCP/UDP透明代理
- [x] DNS解析和代理
- [x] TUN/TAP设备
- [x] 负载均衡
- [x] 路由控制
- [x] 准入控制
- [x] 动态配置
- [x] Prometheus监控指标
- [x] Web API
- [x] [TCP/UDP端口转发](https://gost.run/tutorials/port-forwarding/)
- [x] [TCP/UDP透明代理](https://gost.run/tutorials/redirect/)
- [x] DNS[解析](https://gost.run/concepts/resolver/)和[代理](https://gost.run/tutorials/dns/)
- [x] [TUN/TAP设备](https://gost.run/tutorials/tuntap/)
- [x] [负载均衡](https://gost.run/concepts/selector/)
- [x] [路由控制](https://gost.run/concepts/bypass/)
- [x] [限速限流](https://gost.run/concepts/limiter/)
- [x] [准入控制](https://gost.run/concepts/admission/)
- [x] [动态配置](https://gost.run/tutorials/api/config/)
- [x] [Prometheus监控指标](https://gost.run/tutorials/metrics/)
- [x] [Web API](https://gost.run/tutorials/api/overview/)
- [ ] Web UI
Wiki站点:[https://gost.run](https://gost.run)
+13 -12
View File
@@ -4,19 +4,20 @@
## Features
- [x] Listening on multiple ports
- [x] Multi-level forwarding chain.
- [x] [Listening on multiple ports](https://gost.run/en/getting-started/quick-start/)
- [x] [Multi-level forwarding chain](https://gost.run/en/concepts/chain/)
- [x] Rich protocol
- [x] TCP/UDP port forwarding
- [x] TCP/UDP transparent proxy
- [x] DNS resolver and proxy
- [x] TUN/TAP device
- [x] Load balancing
- [x] Routing control
- [x] Admission control
- [x] Dynamic configuration
- [x] Prometheus metrics
- [x] Web API
- [x] [TCP/UDP port forwarding](https://gost.run/en/tutorials/port-forwarding/)
- [x] [TCP/UDP transparent proxy](https://gost.run/en/tutorials/redirect/)
- [x] DNS [resolver](https://gost.run/en/concepts/resolver/) and [proxy](https://gost.run/en/tutorials/dns/)
- [x] [TUN/TAP device](https://gost.run/en/tutorials/tuntap/)
- [x] [Load balancing](https://gost.run/en/concepts/selector/)
- [x] [Routing control](https://gost.run/en/concepts/bypass/)
- [x] [Bandwidth/Rate Limiter](https://gost.run/en/concepts/limiter/)
- [x] [Admission control](https://gost.run/en/concepts/limiter/)
- [x] [Dynamic configuration](https://gost.run/en/tutorials/api/config/)
- [x] [Prometheus metrics](https://gost.run/en/tutorials/metrics/)
- [x] [Web API](https://gost.run/en/tutorials/api/overview/)
- [ ] Web UI
Wiki: [https://gost.run](https://gost.run/en/)
+1 -1
View File
@@ -358,7 +358,7 @@ func buildServiceConfig(url *url.URL) (*config.ServiceConfig, error) {
}
for i, addr := range strings.Split(remotes, ",") {
svc.Forwarder.Nodes = append(svc.Forwarder.Nodes,
&config.NodeConfig{
&config.ForwardNodeConfig{
Name: fmt.Sprintf("target-%d", i),
Addr: addr,
})
+29 -5
View File
@@ -3,6 +3,7 @@ package main
import (
"io"
"os"
"path/filepath"
"github.com/go-gost/core/logger"
"github.com/go-gost/core/service"
@@ -12,6 +13,7 @@ import (
xlogger "github.com/go-gost/x/logger"
metrics "github.com/go-gost/x/metrics/service"
"github.com/go-gost/x/registry"
"gopkg.in/natefinch/lumberjack.v2"
)
func buildService(cfg *config.Config) (services []service.Service) {
@@ -92,7 +94,17 @@ func buildService(cfg *config.Config) (services []service.Service) {
}
}
}
for _, hopCfg := range cfg.Hops {
hop, err := parsing.ParseHop(hopCfg)
if err != nil {
log.Fatal(err)
}
if hop != nil {
if err := registry.HopRegistry().Register(hopCfg.Name, hop); err != nil {
log.Fatal(err)
}
}
}
for _, chainCfg := range cfg.Chains {
c, err := parsing.ParseChain(chainCfg)
if err != nil {
@@ -139,11 +151,23 @@ func logFromConfig(cfg *config.LogConfig) logger.Logger {
case "stderr", "":
out = os.Stderr
default:
f, err := os.OpenFile(cfg.Output, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Warn(err)
if cfg.Rotation != nil {
out = &lumberjack.Logger{
Filename: cfg.Output,
MaxSize: cfg.Rotation.MaxSize,
MaxAge: cfg.Rotation.MaxAge,
MaxBackups: cfg.Rotation.MaxBackups,
LocalTime: cfg.Rotation.LocalTime,
Compress: cfg.Rotation.Compress,
}
} else {
out = f
os.MkdirAll(filepath.Dir(cfg.Output), 0755)
f, err := os.OpenFile(cfg.Output, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Warn(err)
} else {
out = f
}
}
}
opts = append(opts, xlogger.OutputLoggerOption(out))
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"runtime"
"github.com/go-gost/core/logger"
"github.com/go-gost/core/metrics"
"github.com/go-gost/x/config"
"github.com/go-gost/x/config/parsing"
xlogger "github.com/go-gost/x/logger"
@@ -122,7 +121,7 @@ func main() {
}
if cfg.Metrics != nil {
metrics.Init(xmetrics.NewMetrics())
xmetrics.Init(xmetrics.NewMetrics())
if cfg.Metrics.Addr != "" {
s, err := buildMetricsService(cfg.Metrics)
if err != nil {
+1 -1
View File
@@ -1,5 +1,5 @@
package main
const (
version = "3.0.0-beta.5"
version = "3.0.0-beta.6"
)
+3 -2
View File
@@ -5,8 +5,9 @@ go 1.18
replace github.com/templexxx/cpu v0.0.7 => github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a
require (
github.com/go-gost/core v0.0.0-20220914115321-50d443049f3b
github.com/go-gost/x v0.0.0-20220914120035-01d7dc77c67a
github.com/go-gost/core v0.0.0-20221020130224-eb9d483127cc
github.com/go-gost/x v0.0.0-20221020130826-669e80b78047
gopkg.in/natefinch/lumberjack.v2 v2.0.0
)
require (
+7 -4
View File
@@ -36,6 +36,7 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@@ -98,8 +99,8 @@ github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gost/core v0.0.0-20220914115321-50d443049f3b h1:fWUPYFp0W/6GEhL0wrURGPQN2AQHhf4IZKiALJJOJh8=
github.com/go-gost/core v0.0.0-20220914115321-50d443049f3b/go.mod h1:bHVbCS9da6XtKNYMkMUVcck5UqDDUkyC37erVfs4GXQ=
github.com/go-gost/core v0.0.0-20221020130224-eb9d483127cc h1:pS75VLwTkYLIC3n0QbfwE65N/1Zh8BnXfErNq9DGWd4=
github.com/go-gost/core v0.0.0-20221020130224-eb9d483127cc/go.mod h1:bHVbCS9da6XtKNYMkMUVcck5UqDDUkyC37erVfs4GXQ=
github.com/go-gost/gosocks4 v0.0.1 h1:+k1sec8HlELuQV7rWftIkmy8UijzUt2I6t+iMPlGB2s=
github.com/go-gost/gosocks4 v0.0.1/go.mod h1:3B6L47HbU/qugDg4JnoFPHgJXE43Inz8Bah1QaN9qCc=
github.com/go-gost/gosocks5 v0.3.1-0.20211109033403-d894d75b7f09 h1:A95M6UWcfZgOuJkQ7QLfG0Hs5peWIUSysCDNz4pfe04=
@@ -108,8 +109,8 @@ github.com/go-gost/relay v0.1.1-0.20211123134818-8ef7fd81ffd7 h1:itaaJhQJ19kUXEB
github.com/go-gost/relay v0.1.1-0.20211123134818-8ef7fd81ffd7/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8=
github.com/go-gost/tls-dissector v0.0.2-0.20220408131628-aac992c27451 h1:xj8gUZGYO3nb5+6Bjw9+tsFkA9sYynrOvDvvC4uDV2I=
github.com/go-gost/tls-dissector v0.0.2-0.20220408131628-aac992c27451/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
github.com/go-gost/x v0.0.0-20220914120035-01d7dc77c67a h1:eq3whATyaFYmwTb4LspCOlIvWT5PFZlzPm+ZMZxTBCU=
github.com/go-gost/x v0.0.0-20220914120035-01d7dc77c67a/go.mod h1:jILEGMQKVQDNGVbPqV985vv+/x9xYUbXSOkYP8ynjsU=
github.com/go-gost/x v0.0.0-20221020130826-669e80b78047 h1:0zyQyrp82I0XWxyfkjgopqw5Vocv7DhVaGH9QMcLqIY=
github.com/go-gost/x v0.0.0-20221020130826-669e80b78047/go.mod h1:4Yg00TGhqMkhXNaMH86/B/Nyx0oX+Qcr0cbuv3iwSpI=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
@@ -773,6 +774,8 @@ gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+33
View File
@@ -50,6 +50,7 @@ chains:
failTimeout: 30s
hops:
- name: hop-0
- name: hop-1
interface: 192.168.1.2
selector:
strategy: rand
@@ -80,6 +81,38 @@ chains:
metadata:
bar: baz
hops:
- name: hop-0
interface: 192.168.1.2
selector:
strategy: rand
maxFails: 3
failTimeout: 60s
bypass: bypass-0
nodes:
- name: node-0
addr: ":1080"
interface: eth1
bypass: bypass-0
connector:
type: socks5
auth:
username: user
password: pass
metadata:
foo: bar
dialer:
type: tcp
auth:
username: user
password: pass
tls:
caFile: "ca.pem"
secure: true
serverName: "example.com"
metadata:
bar: baz
tls:
certFile: "cert.pem"
keyFile: "key.pem"