fix: 全隧道模式跳过无意义的CIDR URL下载
全隧道模式下before-proxy、after-proxy和手动刷新三处仍会从URL 下载CIDR表,但下载结果永远不会被使用。添加ModeFull短路返回, 消除无意义的网络请求和连接延迟。 bump version to 0.6.9
This commit is contained in:
@@ -11,7 +11,7 @@ GO = go
|
|||||||
CGO_ENABLED = 1
|
CGO_ENABLED = 1
|
||||||
WINDRES ?= x86_64-w64-mingw32-windres
|
WINDRES ?= x86_64-w64-mingw32-windres
|
||||||
MINGW_CC ?= x86_64-w64-mingw32-gcc
|
MINGW_CC ?= x86_64-w64-mingw32-gcc
|
||||||
SEMVER ?= 0.6.8
|
SEMVER ?= 0.6.9
|
||||||
GIT_HASH = $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
GIT_HASH = $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||||
VERSION = $(SEMVER)-$(GIT_HASH)
|
VERSION = $(SEMVER)-$(GIT_HASH)
|
||||||
LDFLAGS = -s -w -X lmvpn/internal/version.Version=$(VERSION)
|
LDFLAGS = -s -w -X lmvpn/internal/version.Version=$(VERSION)
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ func (sm *SessionManager) run(ctx context.Context, cfg SessionConfig) {
|
|||||||
// to avoid consuming the server's 30s ReadyTimeout budget.
|
// to avoid consuming the server's 30s ReadyTimeout budget.
|
||||||
var beforeCIDRs []string
|
var beforeCIDRs []string
|
||||||
allURLSources := append(append([]model.CIDRURLSource{}, cfg.CIDRV4URLs...), cfg.CIDRV6URLs...)
|
allURLSources := append(append([]model.CIDRURLSource{}, cfg.CIDRV4URLs...), cfg.CIDRV6URLs...)
|
||||||
if len(allURLSources) > 0 {
|
if len(allURLSources) > 0 && cfg.RoutingMode != route.ModeFull {
|
||||||
sm.stats.SetConnectStep("fetch_cidrs")
|
sm.stats.SetConnectStep("fetch_cidrs")
|
||||||
sm.setState(stats.StateConnecting)
|
sm.setState(stats.StateConnecting)
|
||||||
log.L().Info("fetching before-proxy CIDR lists", "url_count", len(allURLSources))
|
log.L().Info("fetching before-proxy CIDR lists", "url_count", len(allURLSources))
|
||||||
@@ -588,6 +588,9 @@ func (sm *SessionManager) setupTUN(init protocol.InitMessage, cfg SessionConfig,
|
|||||||
// (via the tunnel) and dynamically adds their routes to the route
|
// (via the tunnel) and dynamically adds their routes to the route
|
||||||
// manager. This is called in a goroutine after the data plane is up.
|
// manager. This is called in a goroutine after the data plane is up.
|
||||||
func (sm *SessionManager) fetchAfterProxyCIDRs(ctx context.Context, cfg SessionConfig) {
|
func (sm *SessionManager) fetchAfterProxyCIDRs(ctx context.Context, cfg SessionConfig) {
|
||||||
|
if cfg.RoutingMode == route.ModeFull {
|
||||||
|
return
|
||||||
|
}
|
||||||
allURLSources := append(append([]model.CIDRURLSource{}, cfg.CIDRV4URLs...), cfg.CIDRV6URLs...)
|
allURLSources := append(append([]model.CIDRURLSource{}, cfg.CIDRV4URLs...), cfg.CIDRV6URLs...)
|
||||||
// Count only "after" sources for logging.
|
// Count only "after" sources for logging.
|
||||||
afterCount := 0
|
afterCount := 0
|
||||||
@@ -659,6 +662,10 @@ func (sm *SessionManager) RefreshCIDRs() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.RoutingMode == route.ModeFull {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Use a background context with 30s timeout so the refresh works
|
// Use a background context with 30s timeout so the refresh works
|
||||||
// even if the session context is in a weird state.
|
// even if the session context is in a weird state.
|
||||||
refreshCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
refreshCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
|||||||
Reference in New Issue
Block a user