implement match_only for resolve routing action

This commit is contained in:
n3t1zen
2026-05-05 13:13:11 +08:00
parent f7add73f04
commit 1cd46d17cf
4 changed files with 40 additions and 1 deletions
+2
View File
@@ -1 +1,3 @@
/.idea /.idea
works/core/test/go.mod
works/core/test/go.sum
+26
View File
@@ -0,0 +1,26 @@
--- a/adapter/inbound.go
+++ b/adapter/inbound.go
@@ -79,14 +79,15 @@
FallbackNetworkType []C.InterfaceType
FallbackDelay time.Duration
- DestinationAddresses []netip.Addr
- SourceGeoIPCode string
- GeoIPCode string
- ProcessInfo *ConnectionOwner
- SourceMACAddress net.HardwareAddr
- SourceHostname string
- QueryType uint16
- FakeIP bool
+ DestinationAddresses []netip.Addr
+ IgnoreDestinationAddresses bool
+ SourceGeoIPCode string
+ GeoIPCode string
+ ProcessInfo *ConnectionOwner
+ SourceMACAddress net.HardwareAddr
+ SourceHostname string
+ QueryType uint16
+ FakeIP bool
// rule cache
+1 -1
View File
@@ -75,7 +75,7 @@
+ +
+ // Create a go-mysql server with our TLS config + // Create a go-mysql server with our TLS config
+ inbound.mysqlServer = server.NewServer( + inbound.mysqlServer = server.NewServer(
+ "8.0.12", + "9.7.0",
+ gmysql.DEFAULT_COLLATION_ID, + gmysql.DEFAULT_COLLATION_ID,
+ gmysql.AUTH_NATIVE_PASSWORD, + gmysql.AUTH_NATIVE_PASSWORD,
+ nil, + nil,
+11
View File
@@ -0,0 +1,11 @@
--- a/route/conn.go
+++ b/route/conn.go
@@ -96,7 +96,7 @@
remoteConn net.Conn
err error
)
- if len(metadata.DestinationAddresses) > 0 || metadata.Destination.IsIP() {
+ if !metadata.IgnoreDestinationAddresses && (len(metadata.DestinationAddresses) > 0 || metadata.Destination.IsIP()) {
remoteConn, err = dialer.DialSerialNetwork(ctx, this, N.NetworkTCP, metadata.Destination, metadata.DestinationAddresses, metadata.NetworkStrategy, metadata.NetworkType, metadata.FallbackNetworkType, metadata.FallbackDelay)
} else {
remoteConn, err = this.DialContext(ctx, N.NetworkTCP, metadata.Destination)