mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-12-01 13:36:50 +00:00
chore: rename listener config to tlsmirror-config
This commit is contained in:
1 parent
63e4d5a312
commit
d41d75795e
7 files changed
+36
-36
No files matched your search
+2
-2
@@ -1891,8 +1891,8 @@ listeners:
|
||||
# after-bytes: 0 # 传输指定字节后开始限速
|
||||
# bytes-per-sec: 0 # 基准速率(字节/秒)
|
||||
# burst-bytes-per-sec: 0 # 突发速率(字节/秒),大于 bytesPerSec 时生效
|
||||
# 如果填写tlsmirror则开启tlsmirror(注意不可与certificate和private-key同时填写)
|
||||
# tlsmirror:
|
||||
# 如果填写tlsmirror-config则开启tlsmirror(注意不可与certificate和private-key同时填写)
|
||||
# tlsmirror-config:
|
||||
# dest: test.com:443
|
||||
# primary-key: MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY= # 必填,32 字节主密钥的 base64 编码
|
||||
# proxy: ""
|
||||
|
||||
@@ -26,11 +26,11 @@ type VmessServer struct {
|
||||
ClientAuthCert string
|
||||
EchKey string
|
||||
RealityConfig reality.Config
|
||||
TLSMirror TLSMirror
|
||||
MuxOption sing.MuxOption `yaml:"mux-option" json:"mux-option,omitempty"`
|
||||
TLSMirrorConfig TLSMirrorConfig `yaml:"tlsmirror-config" json:"tlsmirror-config,omitempty"`
|
||||
MuxOption sing.MuxOption `yaml:"mux-option" json:"mux-option,omitempty"`
|
||||
}
|
||||
|
||||
type TLSMirror struct {
|
||||
type TLSMirrorConfig struct {
|
||||
PrimaryKey string `yaml:"primary-key" json:"primary-key,omitempty"`
|
||||
Dest string `yaml:"dest" json:"dest,omitempty"`
|
||||
Proxy string `yaml:"proxy" json:"proxy,omitempty"`
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
LC "github.com/metacubex/mihomo/listener/config"
|
||||
)
|
||||
|
||||
type TLSMirror struct {
|
||||
type TLSMirrorConfig struct {
|
||||
PrimaryKey string `inbound:"primary-key,omitempty"`
|
||||
Dest string `inbound:"dest,omitempty"`
|
||||
Proxy string `inbound:"proxy,omitempty"`
|
||||
@@ -52,8 +52,8 @@ func (p TLSMirrorTransportLayerPadding) Build() LC.TLSMirrorTransportLayerPaddin
|
||||
}
|
||||
}
|
||||
|
||||
func (c TLSMirror) Build() LC.TLSMirror {
|
||||
return LC.TLSMirror{
|
||||
func (c TLSMirrorConfig) Build() LC.TLSMirrorConfig {
|
||||
return LC.TLSMirrorConfig{
|
||||
PrimaryKey: c.PrimaryKey,
|
||||
Dest: c.Dest,
|
||||
Proxy: c.Proxy,
|
||||
|
||||
+12
-12
@@ -11,17 +11,17 @@ import (
|
||||
|
||||
type VmessOption struct {
|
||||
BaseOption
|
||||
Users []VmessUser `inbound:"users"`
|
||||
WsPath string `inbound:"ws-path,omitempty"`
|
||||
GrpcServiceName string `inbound:"grpc-service-name,omitempty"`
|
||||
Certificate string `inbound:"certificate,omitempty"`
|
||||
PrivateKey string `inbound:"private-key,omitempty"`
|
||||
ClientAuthType string `inbound:"client-auth-type,omitempty"`
|
||||
ClientAuthCert string `inbound:"client-auth-cert,omitempty"`
|
||||
EchKey string `inbound:"ech-key,omitempty"`
|
||||
RealityConfig RealityConfig `inbound:"reality-config,omitempty"`
|
||||
TLSMirror TLSMirror `inbound:"tlsmirror,omitempty"`
|
||||
MuxOption MuxOption `inbound:"mux-option,omitempty"`
|
||||
Users []VmessUser `inbound:"users"`
|
||||
WsPath string `inbound:"ws-path,omitempty"`
|
||||
GrpcServiceName string `inbound:"grpc-service-name,omitempty"`
|
||||
Certificate string `inbound:"certificate,omitempty"`
|
||||
PrivateKey string `inbound:"private-key,omitempty"`
|
||||
ClientAuthType string `inbound:"client-auth-type,omitempty"`
|
||||
ClientAuthCert string `inbound:"client-auth-cert,omitempty"`
|
||||
EchKey string `inbound:"ech-key,omitempty"`
|
||||
RealityConfig RealityConfig `inbound:"reality-config,omitempty"`
|
||||
TLSMirrorConfig TLSMirrorConfig `inbound:"tlsmirror-config,omitempty"`
|
||||
MuxOption MuxOption `inbound:"mux-option,omitempty"`
|
||||
}
|
||||
|
||||
type VmessUser struct {
|
||||
@@ -69,7 +69,7 @@ func NewVmess(options *VmessOption) (*Vmess, error) {
|
||||
ClientAuthCert: options.ClientAuthCert,
|
||||
EchKey: options.EchKey,
|
||||
RealityConfig: options.RealityConfig.Build(),
|
||||
TLSMirror: options.TLSMirror.Build(),
|
||||
TLSMirrorConfig: options.TLSMirrorConfig.Build(),
|
||||
MuxOption: options.MuxOption.Build(),
|
||||
},
|
||||
}, nil
|
||||
|
||||
@@ -143,7 +143,7 @@ func TestInboundVMess_Ws(t *testing.T) {
|
||||
|
||||
func TestInboundVMess_TLSMirror(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
},
|
||||
@@ -164,7 +164,7 @@ func TestInboundVMess_TLSMirror(t *testing.T) {
|
||||
func TestInboundVMess_TLSMirror_Ws(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
WsPath: "/ws",
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
},
|
||||
@@ -189,7 +189,7 @@ func TestInboundVMess_TLSMirror_Ws(t *testing.T) {
|
||||
func TestInboundVMess_TLSMirror_Grpc(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
GrpcServiceName: "GunService",
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
},
|
||||
@@ -211,7 +211,7 @@ func TestInboundVMess_TLSMirror_Grpc(t *testing.T) {
|
||||
|
||||
func TestInboundVMess_TLSMirror_AdvancedOptions(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
ExplicitNonceCipherSuites: tlsmirror.RecommendedExplicitNonceCipherSuites,
|
||||
@@ -243,7 +243,7 @@ func TestInboundVMess_TLSMirror_AdvancedOptions(t *testing.T) {
|
||||
|
||||
func TestInboundVMess_TLSMirror_ConnectionEnrolment(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
ConnectionEnrolment: &inbound.TLSMirrorConnectionEnrolment{
|
||||
@@ -269,7 +269,7 @@ func TestInboundVMess_TLSMirror_ConnectionEnrolment(t *testing.T) {
|
||||
|
||||
func TestInboundVMess_TLSMirror_EmbeddedTrafficGenerator(t *testing.T) {
|
||||
inboundOptions := inbound.VmessOption{
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorPrimaryKey,
|
||||
Dest: net.JoinHostPort(realityDest, "443"),
|
||||
},
|
||||
|
||||
@@ -205,7 +205,7 @@ func tlsMirrorInteropTestCase(t *testing.T, v2rayBin, name string, advanced tlsM
|
||||
Users: []inbound.VmessUser{
|
||||
{Username: "test", UUID: userUUID},
|
||||
},
|
||||
TLSMirror: inbound.TLSMirror{
|
||||
TLSMirrorConfig: inbound.TLSMirrorConfig{
|
||||
PrimaryKey: tlsMirrorInteropPrimaryKey,
|
||||
Dest: forward.addr,
|
||||
ExplicitNonceCipherSuites: advanced.config.ExplicitNonceCipherSuites,
|
||||
|
||||
@@ -127,16 +127,16 @@ func New(config LC.VmessServer, lc C.InboundListenConfig, tunnel C.Tunnel, addit
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if config.TLSMirror.PrimaryKey != "" {
|
||||
if config.TLSMirrorConfig.PrimaryKey != "" {
|
||||
tlsMirrorBuilder = tlsmirror.Config{
|
||||
PrimaryKey: config.TLSMirror.PrimaryKey,
|
||||
Dest: config.TLSMirror.Dest,
|
||||
Proxy: config.TLSMirror.Proxy,
|
||||
ExplicitNonceCipherSuites: config.TLSMirror.ExplicitNonceCipherSuites,
|
||||
DeferInstanceDerivedWriteTime: config.TLSMirror.DeferInstanceDerivedWriteTime.Build(),
|
||||
TransportLayerPadding: config.TLSMirror.TransportLayerPadding.Build(),
|
||||
ConnectionEnrolment: config.TLSMirror.ConnectionEnrolment.Build(),
|
||||
SequenceWatermarkingEnabled: config.TLSMirror.SequenceWatermarkingEnabled,
|
||||
PrimaryKey: config.TLSMirrorConfig.PrimaryKey,
|
||||
Dest: config.TLSMirrorConfig.Dest,
|
||||
Proxy: config.TLSMirrorConfig.Proxy,
|
||||
ExplicitNonceCipherSuites: config.TLSMirrorConfig.ExplicitNonceCipherSuites,
|
||||
DeferInstanceDerivedWriteTime: config.TLSMirrorConfig.DeferInstanceDerivedWriteTime.Build(),
|
||||
TransportLayerPadding: config.TLSMirrorConfig.TransportLayerPadding.Build(),
|
||||
ConnectionEnrolment: config.TLSMirrorConfig.ConnectionEnrolment.Build(),
|
||||
SequenceWatermarkingEnabled: config.TLSMirrorConfig.SequenceWatermarkingEnabled,
|
||||
}.Build(tunnel)
|
||||
h.Tunnel = tlsMirrorBuilder.WrapTunnel(tunnel)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user