diff --git a/.github/update.log b/.github/update.log index ba4b31bddc..27cc559eec 100644 --- a/.github/update.log +++ b/.github/update.log @@ -856,3 +856,4 @@ Update On Sun Dec 15 19:34:29 CET 2024 Update On Mon Dec 16 19:36:05 CET 2024 Update On Tue Dec 17 19:39:30 CET 2024 Update On Wed Dec 18 19:36:24 CET 2024 +Update On Thu Dec 19 19:34:25 CET 2024 diff --git a/clash-meta-android/build.gradle.kts b/clash-meta-android/build.gradle.kts index 7c4115e66a..f09e5efba4 100644 --- a/clash-meta-android/build.gradle.kts +++ b/clash-meta-android/build.gradle.kts @@ -40,8 +40,8 @@ subprojects { minSdk = 21 targetSdk = 31 - versionName = "2.11.2" - versionCode = 211002 + versionName = "2.11.3" + versionCode = 211003 resValue("string", "release_name", "v$versionName") resValue("integer", "release_code", "$versionCode") diff --git a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go index 0d32ca4126..7aab2f58d8 100644 --- a/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go +++ b/clash-meta-android/core/src/foss/golang/clash/adapter/outbound/mieru.go @@ -8,12 +8,13 @@ import ( "strconv" "sync" - mieruclient "github.com/enfein/mieru/v3/apis/client" - mierumodel "github.com/enfein/mieru/v3/apis/model" - mierupb "github.com/enfein/mieru/v3/pkg/appctl/appctlpb" "github.com/metacubex/mihomo/component/dialer" "github.com/metacubex/mihomo/component/proxydialer" C "github.com/metacubex/mihomo/constant" + + mieruclient "github.com/enfein/mieru/v3/apis/client" + mierumodel "github.com/enfein/mieru/v3/apis/model" + mierupb "github.com/enfein/mieru/v3/pkg/appctl/appctlpb" "google.golang.org/protobuf/proto" ) @@ -26,13 +27,14 @@ type Mieru struct { type MieruOption struct { BasicOption - Name string `proxy:"name"` - Server string `proxy:"server"` - Port int `proxy:"port,omitempty"` - PortRange string `proxy:"port-range,omitempty"` - Transport string `proxy:"transport"` - UserName string `proxy:"username"` - Password string `proxy:"password"` + Name string `proxy:"name"` + Server string `proxy:"server"` + Port int `proxy:"port,omitempty"` + PortRange string `proxy:"port-range,omitempty"` + Transport string `proxy:"transport"` + UserName string `proxy:"username"` + Password string `proxy:"password"` + Multiplexing string `proxy:"multiplexing,omitempty"` } // DialContext implements C.ProxyAdapter @@ -205,7 +207,7 @@ func buildMieruClientConfig(option MieruOption) (*mieruclient.ClientConfig, erro } } } - return &mieruclient.ClientConfig{ + config := &mieruclient.ClientConfig{ Profile: &mierupb.ClientProfile{ ProfileName: proto.String(option.Name), User: &mierupb.User{ @@ -214,7 +216,13 @@ func buildMieruClientConfig(option MieruOption) (*mieruclient.ClientConfig, erro }, Servers: []*mierupb.ServerEndpoint{server}, }, - }, nil + } + if multiplexing, ok := mierupb.MultiplexingLevel_value[option.Multiplexing]; ok { + config.Profile.Multiplexing = &mierupb.MultiplexingConfig{ + Level: mierupb.MultiplexingLevel(multiplexing).Enum(), + } + } + return config, nil } func validateMieruOption(option MieruOption) error { @@ -258,6 +266,11 @@ func validateMieruOption(option MieruOption) error { if option.Password == "" { return fmt.Errorf("password is empty") } + if option.Multiplexing != "" { + if _, ok := mierupb.MultiplexingLevel_value[option.Multiplexing]; !ok { + return fmt.Errorf("invalid multiplexing level: %s", option.Multiplexing) + } + } return nil } diff --git a/clash-meta-android/core/src/foss/golang/clash/common/structure/structure.go b/clash-meta-android/core/src/foss/golang/clash/common/structure/structure.go index 99c980bc4c..5bafc178e0 100644 --- a/clash-meta-android/core/src/foss/golang/clash/common/structure/structure.go +++ b/clash-meta-android/core/src/foss/golang/clash/common/structure/structure.go @@ -86,7 +86,27 @@ func (d *Decoder) Decode(src map[string]any, dst any) error { return nil } +// isNil returns true if the input is nil or a typed nil pointer. +func isNil(input any) bool { + if input == nil { + return true + } + val := reflect.ValueOf(input) + return val.Kind() == reflect.Pointer && val.IsNil() +} + func (d *Decoder) decode(name string, data any, val reflect.Value) error { + if isNil(data) { + // If the data is nil, then we don't set anything + // Maybe we should set to zero value? + return nil + } + if !reflect.ValueOf(data).IsValid() { + // If the input value is invalid, then we just set the value + // to be the zero value. + val.Set(reflect.Zero(val.Type())) + return nil + } for { kind := val.Kind() if kind == reflect.Pointer && val.IsNil() { diff --git a/clash-meta-android/core/src/foss/golang/clash/common/structure/structure_test.go b/clash-meta-android/core/src/foss/golang/clash/common/structure/structure_test.go index e5fe693d79..266b828fd4 100644 --- a/clash-meta-android/core/src/foss/golang/clash/common/structure/structure_test.go +++ b/clash-meta-android/core/src/foss/golang/clash/common/structure/structure_test.go @@ -267,3 +267,21 @@ func TestStructure_TextUnmarshaller(t *testing.T) { err = decoder.Decode(rawMap, s) assert.NotNilf(t, err, "should throw error: %#v", s) } + +func TestStructure_Null(t *testing.T) { + rawMap := map[string]any{ + "opt": map[string]any{ + "bar": nil, + }, + } + + s := struct { + Opt struct { + Bar string `test:"bar,optional"` + } `test:"opt,optional"` + }{} + + err := decoder.Decode(rawMap, &s) + assert.Nil(t, err) + assert.Equal(t, s.Opt.Bar, "") +} diff --git a/clash-meta-android/core/src/foss/golang/clash/component/sniffer/dispatcher.go b/clash-meta-android/core/src/foss/golang/clash/component/sniffer/dispatcher.go index 4d13ddd065..ada4317686 100644 --- a/clash-meta-android/core/src/foss/golang/clash/component/sniffer/dispatcher.go +++ b/clash-meta-android/core/src/foss/golang/clash/component/sniffer/dispatcher.go @@ -145,8 +145,12 @@ func (sd *Dispatcher) Enable() bool { } func (sd *Dispatcher) sniffDomain(conn *N.BufferedConn, metadata *C.Metadata) (string, error) { + //defer func(start time.Time) { + // log.Debugln("[Sniffer] [%s] Sniffing took %s", metadata.DstIP, time.Since(start)) + //}(time.Now()) + for s := range sd.sniffers { - if s.SupportNetwork() == C.TCP { + if s.SupportNetwork() == C.TCP && s.SupportPort(metadata.DstPort) { _ = conn.SetReadDeadline(time.Now().Add(1 * time.Second)) _, err := conn.Peek(1) _ = conn.SetReadDeadline(time.Time{}) @@ -154,7 +158,7 @@ func (sd *Dispatcher) sniffDomain(conn *N.BufferedConn, metadata *C.Metadata) (s _, ok := err.(*net.OpError) if ok { sd.cacheSniffFailed(metadata) - log.Errorln("[Sniffer] [%s] may not have any sent data, Consider adding skip", metadata.DstIP.String()) + log.Errorln("[Sniffer] [%s] [%s] may not have any sent data, Consider adding skip", metadata.DstIP, s.Protocol()) _ = conn.Close() } @@ -164,22 +168,36 @@ func (sd *Dispatcher) sniffDomain(conn *N.BufferedConn, metadata *C.Metadata) (s bufferedLen := conn.Buffered() bytes, err := conn.Peek(bufferedLen) if err != nil { - log.Debugln("[Sniffer] the data length not enough") + log.Debugln("[Sniffer] [%s] [%s] the data length not enough, error: %v", metadata.DstIP, s.Protocol(), err) continue } host, err := s.SniffData(bytes) + var e *errNeedAtLeastData + if errors.As(err, &e) { + //log.Debugln("[Sniffer] [%s] [%s] %v, got length: %d", metadata.DstIP, s.Protocol(), e, len(bytes)) + _ = conn.SetReadDeadline(time.Now().Add(1 * time.Second)) + bytes, err = conn.Peek(e.length) + _ = conn.SetReadDeadline(time.Time{}) + //log.Debugln("[Sniffer] [%s] [%s] try again, got length: %d", metadata.DstIP, s.Protocol(), len(bytes)) + if err != nil { + log.Debugln("[Sniffer] [%s] [%s] the data length not enough, error: %v", metadata.DstIP, s.Protocol(), err) + continue + } + host, err = s.SniffData(bytes) + } if err != nil { - //log.Debugln("[Sniffer] [%s] Sniff data failed %s", s.Protocol(), metadata.DstIP) + //log.Debugln("[Sniffer] [%s] [%s] Sniff data failed, error: %v", metadata.DstIP, s.Protocol(), err) continue } _, err = netip.ParseAddr(host) if err == nil { - //log.Debugln("[Sniffer] [%s] Sniff data failed %s", s.Protocol(), metadata.DstIP) + //log.Debugln("[Sniffer] [%s] [%s] Sniff data failed, got host [%s]", metadata.DstIP, s.Protocol(), host) continue } + //log.Debugln("[Sniffer] [%s] [%s] Sniffed [%s]", metadata.DstIP, s.Protocol(), host) return host, nil } } diff --git a/clash-meta-android/core/src/foss/golang/clash/component/sniffer/tls_sniffer.go b/clash-meta-android/core/src/foss/golang/clash/component/sniffer/tls_sniffer.go index 974df79a5b..b57f36ec88 100644 --- a/clash-meta-android/core/src/foss/golang/clash/component/sniffer/tls_sniffer.go +++ b/clash-meta-android/core/src/foss/golang/clash/component/sniffer/tls_sniffer.go @@ -3,6 +3,7 @@ package sniffer import ( "encoding/binary" "errors" + "fmt" "strings" "github.com/metacubex/mihomo/common/utils" @@ -15,6 +16,19 @@ var ( errNotClientHello = errors.New("not client hello") ) +type errNeedAtLeastData struct { + length int + err error +} + +func (e *errNeedAtLeastData) Error() string { + return fmt.Sprintf("%v, need at least length: %d", e.err, e.length) +} + +func (e *errNeedAtLeastData) Unwrap() error { + return e.err +} + var _ sniffer.Sniffer = (*TLSSniffer)(nil) type TLSSniffer struct { @@ -160,7 +174,10 @@ func SniffTLS(b []byte) (*string, error) { } headerLen := int(binary.BigEndian.Uint16(b[3:5])) if 5+headerLen > len(b) { - return nil, ErrNoClue + return nil, &errNeedAtLeastData{ + length: 5 + headerLen, + err: ErrNoClue, + } } domain, err := ReadClientHello(b[5 : 5+headerLen]) diff --git a/clash-meta-android/core/src/foss/golang/clash/constant/provider/interface.go b/clash-meta-android/core/src/foss/golang/clash/constant/provider/interface.go index 925c173469..4309adacbf 100644 --- a/clash-meta-android/core/src/foss/golang/clash/constant/provider/interface.go +++ b/clash-meta-android/core/src/foss/golang/clash/constant/provider/interface.go @@ -13,6 +13,7 @@ const ( File VehicleType = iota HTTP Compatible + Inline ) // VehicleType defined @@ -26,6 +27,8 @@ func (v VehicleType) String() string { return "HTTP" case Compatible: return "Compatible" + case Inline: + return "Inline" default: return "Unknown" } diff --git a/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml b/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml index 23acb78fd9..ca48f0e231 100644 --- a/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml +++ b/clash-meta-android/core/src/foss/golang/clash/docs/config.yaml @@ -855,6 +855,8 @@ proxies: # socks5 transport: TCP # 只支持 TCP username: user password: password + # 可以使用的值包括 MULTIPLEXING_OFF, MULTIPLEXING_LOW, MULTIPLEXING_MIDDLE, MULTIPLEXING_HIGH。其中 MULTIPLEXING_OFF 会关闭多路复用功能。默认值为 MULTIPLEXING_LOW。 + # multiplexing: MULTIPLEXING_LOW # dns 出站会将请求劫持到内部 dns 模块,所有请求均在内部处理 - name: "dns-out" @@ -1012,6 +1014,14 @@ rule-providers: format: mrs behavior: domain path: /path/to/save/file.mrs + rule4: + type: inline + behavior: domain # classical / ipcidr + payload: + - '.blogger.com' + - '*.*.microsoft.com' + - 'books.itunes.apple.com' + rules: - RULE-SET,rule1,REJECT - IP-ASN,1,PROXY diff --git a/clash-meta-android/core/src/foss/golang/clash/go.mod b/clash-meta-android/core/src/foss/golang/clash/go.mod index 1ae7c26da9..dbc8aceaf3 100644 --- a/clash-meta-android/core/src/foss/golang/clash/go.mod +++ b/clash-meta-android/core/src/foss/golang/clash/go.mod @@ -7,14 +7,14 @@ require ( github.com/bahlo/generic-list-go v0.2.0 github.com/coreos/go-iptables v0.8.0 github.com/dlclark/regexp2 v1.11.4 - github.com/enfein/mieru/v3 v3.8.3 + github.com/enfein/mieru/v3 v3.8.4 github.com/go-chi/chi/v5 v5.1.0 github.com/go-chi/render v1.0.3 github.com/gobwas/ws v1.4.0 github.com/gofrs/uuid/v5 v5.3.0 - github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 - github.com/klauspost/compress v1.17.9 - github.com/klauspost/cpuid/v2 v2.2.8 + github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef + github.com/klauspost/compress v1.17.9 // lastest version compatible with golang1.20 + github.com/klauspost/cpuid/v2 v2.2.9 github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 github.com/mdlayher/netlink v1.7.2 github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab @@ -35,28 +35,28 @@ require ( github.com/miekg/dns v1.1.62 github.com/mroth/weightedrand/v2 v2.1.0 github.com/openacid/low v0.1.21 - github.com/oschwald/maxminddb-golang v1.12.0 + github.com/oschwald/maxminddb-golang v1.12.0 // lastest version compatible with golang1.20 github.com/puzpuzpuz/xsync/v3 v3.4.0 github.com/sagernet/cors v1.2.1 github.com/sagernet/fswatch v0.1.1 github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a github.com/sagernet/sing v0.5.1 - github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 - github.com/sagernet/sing-shadowtls v0.1.4 + github.com/sagernet/sing-mux v0.2.1 + github.com/sagernet/sing-shadowtls v0.1.5 github.com/samber/lo v1.47.0 - github.com/shirou/gopsutil/v3 v3.24.5 + github.com/shirou/gopsutil/v4 v4.24.11 github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 github.com/vmihailenco/msgpack/v5 v5.4.1 github.com/wk8/go-ordered-map/v2 v2.1.8 gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 go.uber.org/automaxprocs v1.6.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/crypto v0.29.0 + golang.org/x/crypto v0.31.0 golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // lastest version compatible with golang1.20 - golang.org/x/net v0.31.0 - golang.org/x/sys v0.27.0 - google.golang.org/protobuf v1.34.2 + golang.org/x/net v0.32.0 + golang.org/x/sys v0.28.0 + google.golang.org/protobuf v1.34.2 // lastest version compatible with golang1.20 gopkg.in/yaml.v3 v3.0.1 lukechampine.com/blake3 v1.3.0 ) @@ -69,6 +69,7 @@ require ( github.com/buger/jsonparser v1.1.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/ebitengine/purego v0.8.1 // indirect github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 // indirect github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 // indirect github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1 // indirect @@ -82,7 +83,7 @@ require ( github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect github.com/josharian/native v1.1.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect @@ -98,7 +99,6 @@ require ( github.com/quic-go/qtls-go1-20 v0.4.1 // indirect github.com/sagernet/nftables v0.3.0-beta.4 // indirect github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect - github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b // indirect github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c // indirect github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e // indirect @@ -111,12 +111,10 @@ require ( gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect go.uber.org/mock v0.4.0 // indirect golang.org/x/mod v0.20.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.7.0 // indirect golang.org/x/tools v0.24.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect - google.golang.org/grpc v1.64.1 // indirect ) replace github.com/sagernet/sing => github.com/metacubex/sing v0.0.0-20241121030428-33b6ebc52000 diff --git a/clash-meta-android/core/src/foss/golang/clash/go.sum b/clash-meta-android/core/src/foss/golang/clash/go.sum index 7aac462805..63e7a6ad57 100644 --- a/clash-meta-android/core/src/foss/golang/clash/go.sum +++ b/clash-meta-android/core/src/foss/golang/clash/go.sum @@ -27,8 +27,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/enfein/mieru/v3 v3.8.3 h1:s4K0hMFDg6LHltokR8/nBTVCq15XnnxPsvc1LrHwpoo= -github.com/enfein/mieru/v3 v3.8.3/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/enfein/mieru/v3 v3.8.4 h1:PmBQykuEcl8yKcQ647pg8Qbjl433CRYgUbW6VLBgGn4= +github.com/enfein/mieru/v3 v3.8.4/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 h1:/5RkVc9Rc81XmMyVqawCiDyrBHZbLAZgTTCqou4mwj8= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9/go.mod h1:hkIFzoiIPZYxdFOOLyDho59b7SrDfo+w3h+yWdlg45I= github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 h1:8j2RH289RJplhA6WfdaPqzg1MjH2K8wX5e0uhAxrw2g= @@ -61,7 +63,7 @@ github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakr github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -70,19 +72,19 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/tink/go v1.6.1 h1:t7JHqO8Ath2w2ig5vjwQYJzhGEZymedQc90lQXUBa4I= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 h1:hxST5pwMBEOWmxpkX20w9oZG+hXdhKmAIPQ3NGGAxas= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef h1:NzQKDfd5ZOPnuZYf9MnRee8x2qecsVqzsnaLjEZiBko= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= -github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -168,19 +170,16 @@ github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZN github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I= github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 h1:5bCAkvDDzSMITiHFjolBwpdqYsvycdTu71FsMEFXQ14= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6/go.mod h1:khzr9AOPocLa+g53dBplwNDz4gdsyx/YM3swtAhlkHQ= -github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k= -github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4= +github.com/sagernet/sing-mux v0.2.1 h1:N/3MHymfnFZRd29tE3TaXwPUVVgKvxhtOkiCMLp9HVo= +github.com/sagernet/sing-mux v0.2.1/go.mod h1:dm3BWL6NvES9pbib7llpylrq7Gq+LjlzG+0RacdxcyE= +github.com/sagernet/sing-shadowtls v0.1.5 h1:uXxmq/HXh8DIiBGLzpMjCbWnzIAFs+lIxiTOjdgG5qo= +github.com/sagernet/sing-shadowtls v0.1.5/go.mod h1:tvrDPTGLrSM46Wnf7mSr+L8NHvgvF8M4YnJF790rZX4= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7/go.mod h1:FP9X2xjT/Az1EsG/orYYoC+5MojWnuI7hrffz8fGwwo= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= -github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= -github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= -github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= -github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8= +github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b h1:rXHg9GrUEtWZhEkrykicdND3VPjlVbYiLdX9J7gimS8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b/go.mod h1:X7qrxNQViEaAN9LNZOPl9PfvQtp3V3c7LTo0dvGi0fM= github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c h1:DjKMC30y6yjG3IxDaeAj3PCoRr+IsO+bzyT+Se2m2Hk= @@ -199,8 +198,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -232,8 +232,8 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -242,11 +242,11 @@ golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -258,17 +258,16 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -276,10 +275,6 @@ golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/clash-meta-android/core/src/foss/golang/clash/log/log.go b/clash-meta-android/core/src/foss/golang/clash/log/log.go index 6f565e7cbb..f1c68b4270 100644 --- a/clash-meta-android/core/src/foss/golang/clash/log/log.go +++ b/clash-meta-android/core/src/foss/golang/clash/log/log.go @@ -20,7 +20,7 @@ func init() { log.SetLevel(log.DebugLevel) log.SetFormatter(&log.TextFormatter{ FullTimestamp: true, - TimestampFormat: "2006-01-02T15:04:05.999999999Z07:00", + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", EnvironmentOverrideColors: true, }) } diff --git a/clash-meta-android/core/src/foss/golang/clash/main.go b/clash-meta-android/core/src/foss/golang/clash/main.go index 685fc89f6a..9a2222df15 100644 --- a/clash-meta-android/core/src/foss/golang/clash/main.go +++ b/clash-meta-android/core/src/foss/golang/clash/main.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "flag" "fmt" + "io" "net" "os" "os/signal" @@ -99,6 +100,13 @@ func main() { log.Fatalln("Initial configuration error: %s", err.Error()) return } + } else if configFile == "-" { + var err error + configBytes, err = io.ReadAll(os.Stdin) + if err != nil { + log.Fatalln("Initial configuration error: %s", err.Error()) + return + } } else { if configFile != "" { if !filepath.IsAbs(configFile) { diff --git a/clash-meta-android/core/src/foss/golang/clash/rules/common/base.go b/clash-meta-android/core/src/foss/golang/clash/rules/common/base.go index 496bcaeecd..1abbe72cf3 100644 --- a/clash-meta-android/core/src/foss/golang/clash/rules/common/base.go +++ b/clash-meta-android/core/src/foss/golang/clash/rules/common/base.go @@ -3,6 +3,8 @@ package common import ( "errors" + C "github.com/metacubex/mihomo/constant" + "golang.org/x/exp/slices" ) @@ -38,3 +40,5 @@ func ParseParams(params []string) (isSrc bool, noResolve bool) { } return } + +type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) diff --git a/clash-meta-android/core/src/foss/golang/clash/rules/logic/logic.go b/clash-meta-android/core/src/foss/golang/clash/rules/logic/logic.go index 6e67285268..f7b5a987ef 100644 --- a/clash-meta-android/core/src/foss/golang/clash/rules/logic/logic.go +++ b/clash-meta-android/core/src/foss/golang/clash/rules/logic/logic.go @@ -23,9 +23,7 @@ type Logic struct { payloadOnce sync.Once } -type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) - -func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule ParseRuleFunc) (*Logic, error) { +func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules, subRules: subRules} err := logic.parsePayload(fmt.Sprintf("(%s)", payload), parseRule) if err != nil { @@ -38,7 +36,7 @@ func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule return logic, nil } -func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewNOT(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.NOT} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -51,7 +49,7 @@ func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, er return logic, nil } -func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewOR(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.OR} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -60,7 +58,7 @@ func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, err return logic, nil } -func NewAND(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewAND(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.AND} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -79,7 +77,7 @@ func (r Range) containRange(preStart, preEnd int) bool { return preStart < r.start && preEnd > r.end } -func (logic *Logic) payloadToRule(subPayload string, parseRule ParseRuleFunc) (C.Rule, error) { +func (logic *Logic) payloadToRule(subPayload string, parseRule common.ParseRuleFunc) (C.Rule, error) { splitStr := strings.SplitN(subPayload, ",", 2) if len(splitStr) < 2 { return nil, fmt.Errorf("[%s] format is error", subPayload) @@ -160,7 +158,7 @@ func (logic *Logic) findSubRuleRange(payload string, ruleRanges []Range) []Range return subRuleRange } -func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error { +func (logic *Logic) parsePayload(payload string, parseRule common.ParseRuleFunc) error { regex, err := regexp.Compile("\\(.*\\)") if err != nil { return err diff --git a/clash-meta-android/core/src/foss/golang/clash/rules/parser.go b/clash-meta-android/core/src/foss/golang/clash/rules/parser.go index 4f7ddbe14f..83325433d4 100644 --- a/clash-meta-android/core/src/foss/golang/clash/rules/parser.go +++ b/clash-meta-android/core/src/foss/golang/clash/rules/parser.go @@ -91,3 +91,5 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string] return } + +var _ RC.ParseRuleFunc = ParseRule diff --git a/clash-meta-android/core/src/foss/golang/clash/rules/provider/parse.go b/clash-meta-android/core/src/foss/golang/clash/rules/provider/parse.go index b04096fb3c..4589317d36 100644 --- a/clash-meta-android/core/src/foss/golang/clash/rules/provider/parse.go +++ b/clash-meta-android/core/src/foss/golang/clash/rules/provider/parse.go @@ -9,6 +9,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" ) var ( @@ -16,17 +17,18 @@ var ( ) type ruleProviderSchema struct { - Type string `provider:"type"` - Behavior string `provider:"behavior"` - Path string `provider:"path,omitempty"` - URL string `provider:"url,omitempty"` - Proxy string `provider:"proxy,omitempty"` - Format string `provider:"format,omitempty"` - Interval int `provider:"interval,omitempty"` - SizeLimit int64 `provider:"size-limit,omitempty"` + Type string `provider:"type"` + Behavior string `provider:"behavior"` + Path string `provider:"path,omitempty"` + URL string `provider:"url,omitempty"` + Proxy string `provider:"proxy,omitempty"` + Format string `provider:"format,omitempty"` + Interval int `provider:"interval,omitempty"` + SizeLimit int64 `provider:"size-limit,omitempty"` + Payload []string `provider:"payload,omitempty"` } -func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) (P.RuleProvider, error) { +func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc) (P.RuleProvider, error) { schema := &ruleProviderSchema{} decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true}) if err := decoder.Decode(mapping, schema); err != nil { @@ -55,6 +57,8 @@ func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(t } } vehicle = resource.NewHTTPVehicle(schema.URL, path, schema.Proxy, nil, resource.DefaultHttpTimeout, schema.SizeLimit) + case "inline": + return newInlineProvider(name, behavior, schema.Payload, parse), nil default: return nil, fmt.Errorf("unsupported vehicle type: %s", schema.Type) } diff --git a/clash-meta-android/core/src/foss/golang/clash/rules/provider/provider.go b/clash-meta-android/core/src/foss/golang/clash/rules/provider/provider.go index 0cbf83bacd..13c713c8c2 100644 --- a/clash-meta-android/core/src/foss/golang/clash/rules/provider/provider.go +++ b/clash-meta-android/core/src/foss/golang/clash/rules/provider/provider.go @@ -13,6 +13,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" "gopkg.in/yaml.v3" ) @@ -24,9 +25,13 @@ func SetTunnel(t P.Tunnel) { } type ruleSetProvider struct { + ruleSetProviderBase *resource.Fetcher[ruleStrategy] + format P.RuleFormat +} + +type ruleSetProviderBase struct { behavior P.RuleBehavior - format P.RuleFormat strategy ruleStrategy } @@ -61,7 +66,7 @@ type mrsRuleStrategy interface { DumpMrs(f func(key string) bool) } -func (rp *ruleSetProvider) Type() P.ProviderType { +func (rp *ruleSetProviderBase) Type() P.ProviderType { return P.Rule } @@ -75,40 +80,51 @@ func (rp *ruleSetProvider) Update() error { return err } -func (rp *ruleSetProvider) Behavior() P.RuleBehavior { +func (rp *ruleSetProviderBase) Behavior() P.RuleBehavior { return rp.behavior } -func (rp *ruleSetProvider) Count() int { +func (rp *ruleSetProviderBase) Count() int { return rp.strategy.Count() } -func (rp *ruleSetProvider) Match(metadata *C.Metadata) bool { +func (rp *ruleSetProviderBase) Match(metadata *C.Metadata) bool { return rp.strategy != nil && rp.strategy.Match(metadata) } -func (rp *ruleSetProvider) ShouldResolveIP() bool { +func (rp *ruleSetProviderBase) ShouldResolveIP() bool { return rp.strategy.ShouldResolveIP() } -func (rp *ruleSetProvider) ShouldFindProcess() bool { +func (rp *ruleSetProviderBase) ShouldFindProcess() bool { return rp.strategy.ShouldFindProcess() } -func (rp *ruleSetProvider) Strategy() any { +func (rp *ruleSetProviderBase) Strategy() any { return rp.strategy } +type providerForApi struct { + Behavior string `json:"behavior"` + Format string `json:"format"` + Name string `json:"name"` + RuleCount int `json:"ruleCount"` + Type string `json:"type"` + VehicleType string `json:"vehicleType"` + UpdatedAt time.Time `json:"updatedAt"` + Payload []string `json:"payload,omitempty"` +} + func (rp *ruleSetProvider) MarshalJSON() ([]byte, error) { return json.Marshal( - map[string]interface{}{ - "behavior": rp.behavior.String(), - "format": rp.format.String(), - "name": rp.Name(), - "ruleCount": rp.strategy.Count(), - "type": rp.Type().String(), - "updatedAt": rp.UpdatedAt(), - "vehicleType": rp.VehicleType().String(), + providerForApi{ + Behavior: rp.behavior.String(), + Format: rp.format.String(), + Name: rp.Fetcher.Name(), + RuleCount: rp.strategy.Count(), + Type: rp.Type().String(), + UpdatedAt: rp.UpdatedAt(), + VehicleType: rp.VehicleType().String(), }) } @@ -117,11 +133,12 @@ func (rp *RuleSetProvider) Close() error { return rp.ruleSetProvider.Close() } -func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, - parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) P.RuleProvider { +func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, parse common.ParseRuleFunc) P.RuleProvider { rp := &ruleSetProvider{ - behavior: behavior, - format: format, + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + }, + format: format, } onUpdate := func(strategy ruleStrategy) { @@ -142,7 +159,7 @@ func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleForma return wrapper } -func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) ruleStrategy { +func newStrategy(behavior P.RuleBehavior, parse common.ParseRuleFunc) ruleStrategy { switch behavior { case P.Domain: strategy := NewDomainStrategy() @@ -158,8 +175,10 @@ func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, } } -var ErrNoPayload = errors.New("file must have a `payload` field") -var ErrInvalidFormat = errors.New("invalid format") +var ( + ErrNoPayload = errors.New("file must have a `payload` field") + ErrInvalidFormat = errors.New("invalid format") +) func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStrategy, error) { strategy.Reset() @@ -254,3 +273,66 @@ func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStr return strategy, nil } + +func rulesParseInline(rs []string, strategy ruleStrategy) ruleStrategy { + strategy.Reset() + for _, r := range rs { + if r != "" { + strategy.Insert(r) + } + } + strategy.FinishInsert() + return strategy +} + +type inlineProvider struct { + ruleSetProviderBase + name string + updateTime time.Time + payload []string +} + +func (i *inlineProvider) Name() string { + return i.name +} + +func (i *inlineProvider) Initial() error { + return nil +} + +func (i *inlineProvider) Update() error { + // make api update happy + i.updateTime = time.Now() + return nil +} + +func (i *inlineProvider) VehicleType() P.VehicleType { + return P.Inline +} + +func (i *inlineProvider) MarshalJSON() ([]byte, error) { + return json.Marshal( + providerForApi{ + Behavior: i.behavior.String(), + Name: i.Name(), + RuleCount: i.strategy.Count(), + Type: i.Type().String(), + VehicleType: i.VehicleType().String(), + UpdatedAt: i.updateTime, + Payload: i.payload, + }) +} + +func newInlineProvider(name string, behavior P.RuleBehavior, payload []string, parse common.ParseRuleFunc) P.RuleProvider { + rp := &inlineProvider{ + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + strategy: newStrategy(behavior, parse), + }, + payload: payload, + name: name, + updateTime: time.Now(), + } + rp.strategy = rulesParseInline(payload, rp.strategy) + return rp +} diff --git a/clash-meta-android/core/src/foss/golang/clash/tunnel/statistic/manager.go b/clash-meta-android/core/src/foss/golang/clash/tunnel/statistic/manager.go index 0b3092992b..3f2770c249 100644 --- a/clash-meta-android/core/src/foss/golang/clash/tunnel/statistic/manager.go +++ b/clash-meta-android/core/src/foss/golang/clash/tunnel/statistic/manager.go @@ -7,7 +7,7 @@ import ( "github.com/metacubex/mihomo/common/atomic" "github.com/puzpuzpuz/xsync/v3" - "github.com/shirou/gopsutil/v3/process" + "github.com/shirou/gopsutil/v4/process" ) var DefaultManager *Manager diff --git a/clash-meta-android/core/src/foss/golang/go.mod b/clash-meta-android/core/src/foss/golang/go.mod index 4671eace8b..d919c47740 100644 --- a/clash-meta-android/core/src/foss/golang/go.mod +++ b/clash-meta-android/core/src/foss/golang/go.mod @@ -15,7 +15,8 @@ require ( github.com/cloudflare/circl v1.3.7 // indirect github.com/coreos/go-iptables v0.8.0 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect - github.com/enfein/mieru/v3 v3.8.3 // indirect + github.com/ebitengine/purego v0.8.1 // indirect + github.com/enfein/mieru/v3 v3.8.4 // indirect github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 // indirect github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 // indirect github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1 // indirect @@ -30,14 +31,15 @@ require ( github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.4.0 // indirect github.com/gofrs/uuid/v5 v5.3.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect - github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect + github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef // indirect github.com/josharian/native v1.1.0 // indirect github.com/klauspost/compress v1.17.9 // indirect - github.com/klauspost/cpuid/v2 v2.2.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.9 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -76,12 +78,11 @@ require ( github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect github.com/sagernet/nftables v0.3.0-beta.4 // indirect github.com/sagernet/sing v0.5.1 // indirect - github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 // indirect - github.com/sagernet/sing-shadowtls v0.1.4 // indirect + github.com/sagernet/sing-mux v0.2.1 // indirect + github.com/sagernet/sing-shadowtls v0.1.5 // indirect github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect github.com/samber/lo v1.47.0 // indirect - github.com/shirou/gopsutil/v3 v3.24.5 // indirect - github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/shirou/gopsutil/v4 v4.24.11 // indirect github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b // indirect github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c // indirect github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e // indirect @@ -98,17 +99,15 @@ require ( gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect go.uber.org/mock v0.4.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/crypto v0.29.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.31.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.7.0 // indirect golang.org/x/tools v0.24.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect - google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect diff --git a/clash-meta-android/core/src/foss/golang/go.sum b/clash-meta-android/core/src/foss/golang/go.sum index 0db4e003c4..bfc7516b20 100644 --- a/clash-meta-android/core/src/foss/golang/go.sum +++ b/clash-meta-android/core/src/foss/golang/go.sum @@ -26,8 +26,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/enfein/mieru/v3 v3.8.3 h1:s4K0hMFDg6LHltokR8/nBTVCq15XnnxPsvc1LrHwpoo= -github.com/enfein/mieru/v3 v3.8.3/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/enfein/mieru/v3 v3.8.4 h1:PmBQykuEcl8yKcQ647pg8Qbjl433CRYgUbW6VLBgGn4= +github.com/enfein/mieru/v3 v3.8.4/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 h1:/5RkVc9Rc81XmMyVqawCiDyrBHZbLAZgTTCqou4mwj8= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9/go.mod h1:hkIFzoiIPZYxdFOOLyDho59b7SrDfo+w3h+yWdlg45I= github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 h1:8j2RH289RJplhA6WfdaPqzg1MjH2K8wX5e0uhAxrw2g= @@ -61,6 +63,7 @@ github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -69,19 +72,19 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/tink/go v1.6.1 h1:t7JHqO8Ath2w2ig5vjwQYJzhGEZymedQc90lQXUBa4I= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 h1:hxST5pwMBEOWmxpkX20w9oZG+hXdhKmAIPQ3NGGAxas= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef h1:NzQKDfd5ZOPnuZYf9MnRee8x2qecsVqzsnaLjEZiBko= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= -github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc= @@ -163,19 +166,16 @@ github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZN github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I= github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 h1:5bCAkvDDzSMITiHFjolBwpdqYsvycdTu71FsMEFXQ14= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6/go.mod h1:khzr9AOPocLa+g53dBplwNDz4gdsyx/YM3swtAhlkHQ= -github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k= -github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4= +github.com/sagernet/sing-mux v0.2.1 h1:N/3MHymfnFZRd29tE3TaXwPUVVgKvxhtOkiCMLp9HVo= +github.com/sagernet/sing-mux v0.2.1/go.mod h1:dm3BWL6NvES9pbib7llpylrq7Gq+LjlzG+0RacdxcyE= +github.com/sagernet/sing-shadowtls v0.1.5 h1:uXxmq/HXh8DIiBGLzpMjCbWnzIAFs+lIxiTOjdgG5qo= +github.com/sagernet/sing-shadowtls v0.1.5/go.mod h1:tvrDPTGLrSM46Wnf7mSr+L8NHvgvF8M4YnJF790rZX4= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7/go.mod h1:FP9X2xjT/Az1EsG/orYYoC+5MojWnuI7hrffz8fGwwo= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= -github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= -github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= -github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= -github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8= +github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b h1:rXHg9GrUEtWZhEkrykicdND3VPjlVbYiLdX9J7gimS8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b/go.mod h1:X7qrxNQViEaAN9LNZOPl9PfvQtp3V3c7LTo0dvGi0fM= github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c h1:DjKMC30y6yjG3IxDaeAj3PCoRr+IsO+bzyT+Se2m2Hk= @@ -194,8 +194,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -225,8 +225,8 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -235,11 +235,11 @@ golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -251,17 +251,16 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -269,10 +268,6 @@ golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/clash-meta-android/core/src/main/golang/go.mod b/clash-meta-android/core/src/main/golang/go.mod index 381d85610b..f796192adb 100644 --- a/clash-meta-android/core/src/main/golang/go.mod +++ b/clash-meta-android/core/src/main/golang/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/dlclark/regexp2 v1.11.4 github.com/metacubex/mihomo v1.7.0 - golang.org/x/sync v0.9.0 + golang.org/x/sync v0.10.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -23,7 +23,8 @@ require ( github.com/buger/jsonparser v1.1.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/coreos/go-iptables v0.8.0 // indirect - github.com/enfein/mieru/v3 v3.8.3 // indirect + github.com/ebitengine/purego v0.8.1 // indirect + github.com/enfein/mieru/v3 v3.8.4 // indirect github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 // indirect github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 // indirect github.com/ericlagergren/siv v0.0.0-20220507050439-0b757b3aa5f1 // indirect @@ -38,14 +39,15 @@ require ( github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.4.0 // indirect github.com/gofrs/uuid/v5 v5.3.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect - github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect + github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef // indirect github.com/josharian/native v1.1.0 // indirect github.com/klauspost/compress v1.17.9 // indirect - github.com/klauspost/cpuid/v2 v2.2.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.9 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -83,12 +85,11 @@ require ( github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect github.com/sagernet/nftables v0.3.0-beta.4 // indirect github.com/sagernet/sing v0.5.1 // indirect - github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 // indirect - github.com/sagernet/sing-shadowtls v0.1.4 // indirect + github.com/sagernet/sing-mux v0.2.1 // indirect + github.com/sagernet/sing-shadowtls v0.1.5 // indirect github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect github.com/samber/lo v1.47.0 // indirect - github.com/shirou/gopsutil/v3 v3.24.5 // indirect - github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/shirou/gopsutil/v4 v4.24.11 // indirect github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b // indirect github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c // indirect github.com/sina-ghaderi/rabbitio v0.0.0-20220730151941-9ce26f4f872e // indirect @@ -105,16 +106,14 @@ require ( gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect go.uber.org/mock v0.4.0 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/crypto v0.29.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.31.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.7.0 // indirect golang.org/x/tools v0.24.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect - google.golang.org/grpc v1.64.1 // indirect google.golang.org/protobuf v1.34.2 // indirect lukechampine.com/blake3 v1.3.0 // indirect ) diff --git a/clash-meta-android/core/src/main/golang/go.sum b/clash-meta-android/core/src/main/golang/go.sum index 0db4e003c4..bfc7516b20 100644 --- a/clash-meta-android/core/src/main/golang/go.sum +++ b/clash-meta-android/core/src/main/golang/go.sum @@ -26,8 +26,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/enfein/mieru/v3 v3.8.3 h1:s4K0hMFDg6LHltokR8/nBTVCq15XnnxPsvc1LrHwpoo= -github.com/enfein/mieru/v3 v3.8.3/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/enfein/mieru/v3 v3.8.4 h1:PmBQykuEcl8yKcQ647pg8Qbjl433CRYgUbW6VLBgGn4= +github.com/enfein/mieru/v3 v3.8.4/go.mod h1:YtU00qjAEt54mCBQu4WZPCey6cBdB1BUtXjvrHLEUNQ= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 h1:/5RkVc9Rc81XmMyVqawCiDyrBHZbLAZgTTCqou4mwj8= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9/go.mod h1:hkIFzoiIPZYxdFOOLyDho59b7SrDfo+w3h+yWdlg45I= github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 h1:8j2RH289RJplhA6WfdaPqzg1MjH2K8wX5e0uhAxrw2g= @@ -61,6 +63,7 @@ github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -69,19 +72,19 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/tink/go v1.6.1 h1:t7JHqO8Ath2w2ig5vjwQYJzhGEZymedQc90lQXUBa4I= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475 h1:hxST5pwMBEOWmxpkX20w9oZG+hXdhKmAIPQ3NGGAxas= -github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef h1:NzQKDfd5ZOPnuZYf9MnRee8x2qecsVqzsnaLjEZiBko= +github.com/insomniacslk/dhcp v0.0.0-20241203100832-a481575ed0ef/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= -github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc= @@ -163,19 +166,16 @@ github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZN github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I= github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6 h1:5bCAkvDDzSMITiHFjolBwpdqYsvycdTu71FsMEFXQ14= -github.com/sagernet/sing-mux v0.2.1-0.20240124034317-9bfb33698bb6/go.mod h1:khzr9AOPocLa+g53dBplwNDz4gdsyx/YM3swtAhlkHQ= -github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k= -github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4= +github.com/sagernet/sing-mux v0.2.1 h1:N/3MHymfnFZRd29tE3TaXwPUVVgKvxhtOkiCMLp9HVo= +github.com/sagernet/sing-mux v0.2.1/go.mod h1:dm3BWL6NvES9pbib7llpylrq7Gq+LjlzG+0RacdxcyE= +github.com/sagernet/sing-shadowtls v0.1.5 h1:uXxmq/HXh8DIiBGLzpMjCbWnzIAFs+lIxiTOjdgG5qo= +github.com/sagernet/sing-shadowtls v0.1.5/go.mod h1:tvrDPTGLrSM46Wnf7mSr+L8NHvgvF8M4YnJF790rZX4= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7/go.mod h1:FP9X2xjT/Az1EsG/orYYoC+5MojWnuI7hrffz8fGwwo= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= -github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI= -github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk= -github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= -github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8= +github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b h1:rXHg9GrUEtWZhEkrykicdND3VPjlVbYiLdX9J7gimS8= github.com/sina-ghaderi/poly1305 v0.0.0-20220724002748-c5926b03988b/go.mod h1:X7qrxNQViEaAN9LNZOPl9PfvQtp3V3c7LTo0dvGi0fM= github.com/sina-ghaderi/rabaead v0.0.0-20220730151906-ab6e06b96e8c h1:DjKMC30y6yjG3IxDaeAj3PCoRr+IsO+bzyT+Se2m2Hk= @@ -194,8 +194,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= @@ -225,8 +225,8 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -235,11 +235,11 @@ golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -251,17 +251,16 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -269,10 +268,6 @@ golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/clash-meta-android/core/src/main/java/com/github/kr328/clash/core/model/Proxy.kt b/clash-meta-android/core/src/main/java/com/github/kr328/clash/core/model/Proxy.kt index fecbb43036..a74d2097bb 100644 --- a/clash-meta-android/core/src/main/java/com/github/kr328/clash/core/model/Proxy.kt +++ b/clash-meta-android/core/src/main/java/com/github/kr328/clash/core/model/Proxy.kt @@ -35,6 +35,7 @@ data class Proxy( WireGuard(false), Dns(false), Ssh(false), + Mieru(false), Relay(true), diff --git a/clash-meta/constant/provider/interface.go b/clash-meta/constant/provider/interface.go index 925c173469..4309adacbf 100644 --- a/clash-meta/constant/provider/interface.go +++ b/clash-meta/constant/provider/interface.go @@ -13,6 +13,7 @@ const ( File VehicleType = iota HTTP Compatible + Inline ) // VehicleType defined @@ -26,6 +27,8 @@ func (v VehicleType) String() string { return "HTTP" case Compatible: return "Compatible" + case Inline: + return "Inline" default: return "Unknown" } diff --git a/clash-meta/docs/config.yaml b/clash-meta/docs/config.yaml index fda14820bb..ca48f0e231 100644 --- a/clash-meta/docs/config.yaml +++ b/clash-meta/docs/config.yaml @@ -1014,6 +1014,14 @@ rule-providers: format: mrs behavior: domain path: /path/to/save/file.mrs + rule4: + type: inline + behavior: domain # classical / ipcidr + payload: + - '.blogger.com' + - '*.*.microsoft.com' + - 'books.itunes.apple.com' + rules: - RULE-SET,rule1,REJECT - IP-ASN,1,PROXY diff --git a/clash-meta/log/log.go b/clash-meta/log/log.go index 6f565e7cbb..f1c68b4270 100644 --- a/clash-meta/log/log.go +++ b/clash-meta/log/log.go @@ -20,7 +20,7 @@ func init() { log.SetLevel(log.DebugLevel) log.SetFormatter(&log.TextFormatter{ FullTimestamp: true, - TimestampFormat: "2006-01-02T15:04:05.999999999Z07:00", + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", EnvironmentOverrideColors: true, }) } diff --git a/clash-meta/rules/common/base.go b/clash-meta/rules/common/base.go index 496bcaeecd..1abbe72cf3 100644 --- a/clash-meta/rules/common/base.go +++ b/clash-meta/rules/common/base.go @@ -3,6 +3,8 @@ package common import ( "errors" + C "github.com/metacubex/mihomo/constant" + "golang.org/x/exp/slices" ) @@ -38,3 +40,5 @@ func ParseParams(params []string) (isSrc bool, noResolve bool) { } return } + +type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) diff --git a/clash-meta/rules/logic/logic.go b/clash-meta/rules/logic/logic.go index 6e67285268..f7b5a987ef 100644 --- a/clash-meta/rules/logic/logic.go +++ b/clash-meta/rules/logic/logic.go @@ -23,9 +23,7 @@ type Logic struct { payloadOnce sync.Once } -type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) - -func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule ParseRuleFunc) (*Logic, error) { +func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules, subRules: subRules} err := logic.parsePayload(fmt.Sprintf("(%s)", payload), parseRule) if err != nil { @@ -38,7 +36,7 @@ func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule return logic, nil } -func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewNOT(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.NOT} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -51,7 +49,7 @@ func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, er return logic, nil } -func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewOR(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.OR} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -60,7 +58,7 @@ func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, err return logic, nil } -func NewAND(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewAND(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.AND} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -79,7 +77,7 @@ func (r Range) containRange(preStart, preEnd int) bool { return preStart < r.start && preEnd > r.end } -func (logic *Logic) payloadToRule(subPayload string, parseRule ParseRuleFunc) (C.Rule, error) { +func (logic *Logic) payloadToRule(subPayload string, parseRule common.ParseRuleFunc) (C.Rule, error) { splitStr := strings.SplitN(subPayload, ",", 2) if len(splitStr) < 2 { return nil, fmt.Errorf("[%s] format is error", subPayload) @@ -160,7 +158,7 @@ func (logic *Logic) findSubRuleRange(payload string, ruleRanges []Range) []Range return subRuleRange } -func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error { +func (logic *Logic) parsePayload(payload string, parseRule common.ParseRuleFunc) error { regex, err := regexp.Compile("\\(.*\\)") if err != nil { return err diff --git a/clash-meta/rules/parser.go b/clash-meta/rules/parser.go index 4f7ddbe14f..83325433d4 100644 --- a/clash-meta/rules/parser.go +++ b/clash-meta/rules/parser.go @@ -91,3 +91,5 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string] return } + +var _ RC.ParseRuleFunc = ParseRule diff --git a/clash-meta/rules/provider/parse.go b/clash-meta/rules/provider/parse.go index b04096fb3c..4589317d36 100644 --- a/clash-meta/rules/provider/parse.go +++ b/clash-meta/rules/provider/parse.go @@ -9,6 +9,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" ) var ( @@ -16,17 +17,18 @@ var ( ) type ruleProviderSchema struct { - Type string `provider:"type"` - Behavior string `provider:"behavior"` - Path string `provider:"path,omitempty"` - URL string `provider:"url,omitempty"` - Proxy string `provider:"proxy,omitempty"` - Format string `provider:"format,omitempty"` - Interval int `provider:"interval,omitempty"` - SizeLimit int64 `provider:"size-limit,omitempty"` + Type string `provider:"type"` + Behavior string `provider:"behavior"` + Path string `provider:"path,omitempty"` + URL string `provider:"url,omitempty"` + Proxy string `provider:"proxy,omitempty"` + Format string `provider:"format,omitempty"` + Interval int `provider:"interval,omitempty"` + SizeLimit int64 `provider:"size-limit,omitempty"` + Payload []string `provider:"payload,omitempty"` } -func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) (P.RuleProvider, error) { +func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc) (P.RuleProvider, error) { schema := &ruleProviderSchema{} decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true}) if err := decoder.Decode(mapping, schema); err != nil { @@ -55,6 +57,8 @@ func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(t } } vehicle = resource.NewHTTPVehicle(schema.URL, path, schema.Proxy, nil, resource.DefaultHttpTimeout, schema.SizeLimit) + case "inline": + return newInlineProvider(name, behavior, schema.Payload, parse), nil default: return nil, fmt.Errorf("unsupported vehicle type: %s", schema.Type) } diff --git a/clash-meta/rules/provider/provider.go b/clash-meta/rules/provider/provider.go index 0cbf83bacd..13c713c8c2 100644 --- a/clash-meta/rules/provider/provider.go +++ b/clash-meta/rules/provider/provider.go @@ -13,6 +13,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" "gopkg.in/yaml.v3" ) @@ -24,9 +25,13 @@ func SetTunnel(t P.Tunnel) { } type ruleSetProvider struct { + ruleSetProviderBase *resource.Fetcher[ruleStrategy] + format P.RuleFormat +} + +type ruleSetProviderBase struct { behavior P.RuleBehavior - format P.RuleFormat strategy ruleStrategy } @@ -61,7 +66,7 @@ type mrsRuleStrategy interface { DumpMrs(f func(key string) bool) } -func (rp *ruleSetProvider) Type() P.ProviderType { +func (rp *ruleSetProviderBase) Type() P.ProviderType { return P.Rule } @@ -75,40 +80,51 @@ func (rp *ruleSetProvider) Update() error { return err } -func (rp *ruleSetProvider) Behavior() P.RuleBehavior { +func (rp *ruleSetProviderBase) Behavior() P.RuleBehavior { return rp.behavior } -func (rp *ruleSetProvider) Count() int { +func (rp *ruleSetProviderBase) Count() int { return rp.strategy.Count() } -func (rp *ruleSetProvider) Match(metadata *C.Metadata) bool { +func (rp *ruleSetProviderBase) Match(metadata *C.Metadata) bool { return rp.strategy != nil && rp.strategy.Match(metadata) } -func (rp *ruleSetProvider) ShouldResolveIP() bool { +func (rp *ruleSetProviderBase) ShouldResolveIP() bool { return rp.strategy.ShouldResolveIP() } -func (rp *ruleSetProvider) ShouldFindProcess() bool { +func (rp *ruleSetProviderBase) ShouldFindProcess() bool { return rp.strategy.ShouldFindProcess() } -func (rp *ruleSetProvider) Strategy() any { +func (rp *ruleSetProviderBase) Strategy() any { return rp.strategy } +type providerForApi struct { + Behavior string `json:"behavior"` + Format string `json:"format"` + Name string `json:"name"` + RuleCount int `json:"ruleCount"` + Type string `json:"type"` + VehicleType string `json:"vehicleType"` + UpdatedAt time.Time `json:"updatedAt"` + Payload []string `json:"payload,omitempty"` +} + func (rp *ruleSetProvider) MarshalJSON() ([]byte, error) { return json.Marshal( - map[string]interface{}{ - "behavior": rp.behavior.String(), - "format": rp.format.String(), - "name": rp.Name(), - "ruleCount": rp.strategy.Count(), - "type": rp.Type().String(), - "updatedAt": rp.UpdatedAt(), - "vehicleType": rp.VehicleType().String(), + providerForApi{ + Behavior: rp.behavior.String(), + Format: rp.format.String(), + Name: rp.Fetcher.Name(), + RuleCount: rp.strategy.Count(), + Type: rp.Type().String(), + UpdatedAt: rp.UpdatedAt(), + VehicleType: rp.VehicleType().String(), }) } @@ -117,11 +133,12 @@ func (rp *RuleSetProvider) Close() error { return rp.ruleSetProvider.Close() } -func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, - parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) P.RuleProvider { +func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, parse common.ParseRuleFunc) P.RuleProvider { rp := &ruleSetProvider{ - behavior: behavior, - format: format, + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + }, + format: format, } onUpdate := func(strategy ruleStrategy) { @@ -142,7 +159,7 @@ func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleForma return wrapper } -func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) ruleStrategy { +func newStrategy(behavior P.RuleBehavior, parse common.ParseRuleFunc) ruleStrategy { switch behavior { case P.Domain: strategy := NewDomainStrategy() @@ -158,8 +175,10 @@ func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, } } -var ErrNoPayload = errors.New("file must have a `payload` field") -var ErrInvalidFormat = errors.New("invalid format") +var ( + ErrNoPayload = errors.New("file must have a `payload` field") + ErrInvalidFormat = errors.New("invalid format") +) func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStrategy, error) { strategy.Reset() @@ -254,3 +273,66 @@ func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStr return strategy, nil } + +func rulesParseInline(rs []string, strategy ruleStrategy) ruleStrategy { + strategy.Reset() + for _, r := range rs { + if r != "" { + strategy.Insert(r) + } + } + strategy.FinishInsert() + return strategy +} + +type inlineProvider struct { + ruleSetProviderBase + name string + updateTime time.Time + payload []string +} + +func (i *inlineProvider) Name() string { + return i.name +} + +func (i *inlineProvider) Initial() error { + return nil +} + +func (i *inlineProvider) Update() error { + // make api update happy + i.updateTime = time.Now() + return nil +} + +func (i *inlineProvider) VehicleType() P.VehicleType { + return P.Inline +} + +func (i *inlineProvider) MarshalJSON() ([]byte, error) { + return json.Marshal( + providerForApi{ + Behavior: i.behavior.String(), + Name: i.Name(), + RuleCount: i.strategy.Count(), + Type: i.Type().String(), + VehicleType: i.VehicleType().String(), + UpdatedAt: i.updateTime, + Payload: i.payload, + }) +} + +func newInlineProvider(name string, behavior P.RuleBehavior, payload []string, parse common.ParseRuleFunc) P.RuleProvider { + rp := &inlineProvider{ + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + strategy: newStrategy(behavior, parse), + }, + payload: payload, + name: name, + updateTime: time.Now(), + } + rp.strategy = rulesParseInline(payload, rp.strategy) + return rp +} diff --git a/clash-nyanpasu/frontend/interface/package.json b/clash-nyanpasu/frontend/interface/package.json index be3b127158..6f61617fcf 100644 --- a/clash-nyanpasu/frontend/interface/package.json +++ b/clash-nyanpasu/frontend/interface/package.json @@ -18,6 +18,6 @@ "swr": "2.2.5" }, "devDependencies": { - "@types/react": "19.0.1" + "@types/react": "19.0.2" } } diff --git a/clash-nyanpasu/frontend/nyanpasu/package.json b/clash-nyanpasu/frontend/nyanpasu/package.json index 63e81afdc4..bd20ae0970 100644 --- a/clash-nyanpasu/frontend/nyanpasu/package.json +++ b/clash-nyanpasu/frontend/nyanpasu/package.json @@ -52,7 +52,7 @@ "@csstools/normalize.css": "12.1.1", "@emotion/babel-plugin": "11.13.5", "@emotion/react": "11.14.0", - "@iconify/json": "2.2.285", + "@iconify/json": "2.2.286", "@monaco-editor/react": "4.6.0", "@tanstack/react-router": "1.89.2", "@tanstack/router-devtools": "1.89.2", @@ -65,7 +65,7 @@ "@tauri-apps/plugin-process": "2.2.0", "@tauri-apps/plugin-shell": "2.2.0", "@tauri-apps/plugin-updater": "2.3.0", - "@types/react": "19.0.1", + "@types/react": "19.0.2", "@types/react-dom": "19.0.2", "@types/validator": "13.12.2", "@vitejs/plugin-legacy": "6.0.0", diff --git a/clash-nyanpasu/frontend/ui/package.json b/clash-nyanpasu/frontend/ui/package.json index a9d2cf3761..daa5ca4cbc 100644 --- a/clash-nyanpasu/frontend/ui/package.json +++ b/clash-nyanpasu/frontend/ui/package.json @@ -24,7 +24,7 @@ "@radix-ui/react-scroll-area": "1.2.2", "@tauri-apps/api": "2.1.1", "@types/d3": "7.4.3", - "@types/react": "19.0.1", + "@types/react": "19.0.2", "@vitejs/plugin-react": "4.3.4", "ahooks": "3.8.4", "d3": "7.9.0", @@ -45,6 +45,6 @@ "sass-embedded": "1.83.0", "tailwind-merge": "2.5.5", "typescript-plugin-css-modules": "5.1.0", - "vite-plugin-dts": "4.3.0" + "vite-plugin-dts": "4.4.0" } } diff --git a/clash-nyanpasu/package.json b/clash-nyanpasu/package.json index 231c39ff4f..1706f29a87 100644 --- a/clash-nyanpasu/package.json +++ b/clash-nyanpasu/package.json @@ -83,8 +83,8 @@ "eslint-plugin-react": "7.37.2", "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124", "eslint-plugin-react-hooks": "5.1.0", - "globals": "15.13.0", - "knip": "5.40.0", + "globals": "15.14.0", + "knip": "5.41.1", "lint-staged": "15.2.11", "neostandard": "0.12.0", "npm-run-all2": "7.0.1", diff --git a/clash-nyanpasu/pnpm-lock.yaml b/clash-nyanpasu/pnpm-lock.yaml index 5eb83668ee..aa26edbff4 100644 --- a/clash-nyanpasu/pnpm-lock.yaml +++ b/clash-nyanpasu/pnpm-lock.yaml @@ -97,11 +97,11 @@ importers: specifier: 5.1.0 version: 5.1.0(eslint@9.17.0(jiti@2.4.1)) globals: - specifier: 15.13.0 - version: 15.13.0 + specifier: 15.14.0 + version: 15.14.0 knip: - specifier: 5.40.0 - version: 5.40.0(@types/node@22.10.2)(typescript@5.7.2) + specifier: 5.41.1 + version: 5.41.1(@types/node@22.10.2)(typescript@5.7.2) lint-staged: specifier: 15.2.11 version: 15.2.11 @@ -188,8 +188,8 @@ importers: version: 2.2.5(react@19.0.0) devDependencies: '@types/react': - specifier: 19.0.1 - version: 19.0.1 + specifier: 19.0.2 + version: 19.0.2 frontend/nyanpasu: dependencies: @@ -204,7 +204,7 @@ importers: version: 3.2.2(react@19.0.0) '@emotion/styled': specifier: 11.14.0 - version: 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) '@juggle/resize-observer': specifier: 3.4.0 version: 3.4.0 @@ -213,13 +213,13 @@ importers: version: 0.3.0 '@mui/icons-material': specifier: 6.2.1 - version: 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + version: 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) '@mui/lab': specifier: 6.0.0-beta.20 - version: 6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@mui/material': specifier: 6.2.1 - version: 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@nyanpasu/interface': specifier: workspace:^ version: link:../interface @@ -255,19 +255,19 @@ importers: version: 24.1.2(typescript@5.7.2) jotai: specifier: 2.10.4 - version: 2.10.4(@types/react@19.0.1)(react@19.0.0) + version: 2.10.4(@types/react@19.0.2)(react@19.0.0) json-schema: specifier: 0.4.0 version: 0.4.0 material-react-table: specifier: 3.0.3 - version: 3.0.3(xhq44wvo2c45mjuwm6njnozb7i) + version: 3.0.3(kuquuzfhnojzmzfsc3urrgc2f4) monaco-editor: specifier: 0.52.2 version: 0.52.2 mui-color-input: specifier: 5.0.1 - version: 5.0.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 5.0.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: specifier: 19.0.0 version: 19.0.0 @@ -282,13 +282,13 @@ importers: version: 1.6.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react-hook-form-mui: specifier: 7.4.1 - version: 7.4.1(uahyfzt5pda25sft5p5s5dq7gy) + version: 7.4.1(vsxmc45kw5ykhcshxfgehxm6sy) react-i18next: specifier: 15.2.0 version: 15.2.0(i18next@24.1.2(typescript@5.7.2))(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react-markdown: specifier: 9.0.1 - version: 9.0.1(@types/react@19.0.1)(react@19.0.0) + version: 9.0.1(@types/react@19.0.2)(react@19.0.0) react-split-grid: specifier: 1.0.4 version: 1.0.4(react@19.0.0) @@ -313,10 +313,10 @@ importers: version: 11.13.5 '@emotion/react': specifier: 11.14.0 - version: 11.14.0(@types/react@19.0.1)(react@19.0.0) + version: 11.14.0(@types/react@19.0.2)(react@19.0.0) '@iconify/json': - specifier: 2.2.285 - version: 2.2.285 + specifier: 2.2.286 + version: 2.2.286 '@monaco-editor/react': specifier: 4.6.0 version: 4.6.0(monaco-editor@0.52.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -354,11 +354,11 @@ importers: specifier: 2.3.0 version: 2.3.0 '@types/react': - specifier: 19.0.1 - version: 19.0.1 + specifier: 19.0.2 + version: 19.0.2 '@types/react-dom': specifier: 19.0.2 - version: 19.0.2(@types/react@19.0.1) + version: 19.0.2(@types/react@19.0.2) '@types/validator': specifier: 13.12.2 version: 13.12.2 @@ -433,19 +433,19 @@ importers: version: 0.3.0 '@mui/icons-material': specifier: 6.2.1 - version: 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + version: 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) '@mui/lab': specifier: 6.0.0-beta.20 - version: 6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@mui/material': specifier: 6.2.1 - version: 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@radix-ui/react-portal': specifier: 1.1.3 - version: 1.1.3(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 1.1.3(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@radix-ui/react-scroll-area': specifier: 1.2.2 - version: 1.2.2(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 1.2.2(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@tauri-apps/api': specifier: 2.1.1 version: 2.1.1 @@ -453,8 +453,8 @@ importers: specifier: 7.4.3 version: 7.4.3 '@types/react': - specifier: 19.0.1 - version: 19.0.1 + specifier: 19.0.2 + version: 19.0.2 '@vitejs/plugin-react': specifier: 4.3.4 version: 4.3.4(vite@6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) @@ -491,7 +491,7 @@ importers: devDependencies: '@emotion/react': specifier: 11.14.0 - version: 11.14.0(@types/react@19.0.1)(react@19.0.0) + version: 11.14.0(@types/react@19.0.2)(react@19.0.0) '@types/d3-interpolate-path': specifier: 2.0.3 version: 2.0.3 @@ -511,8 +511,8 @@ importers: specifier: 5.1.0 version: 5.1.0(typescript@5.7.2) vite-plugin-dts: - specifier: 4.3.0 - version: 4.3.0(@types/node@22.10.2)(rollup@4.27.4)(typescript@5.7.2)(vite@6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) + specifier: 4.4.0 + version: 4.4.0(@types/node@22.10.2)(rollup@4.27.4)(typescript@5.7.2)(vite@6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) scripts: dependencies: @@ -569,8 +569,8 @@ importers: specifier: 2.26.8 version: 2.26.8 undici: - specifier: 7.1.1 - version: 7.1.1 + specifier: 7.2.0 + version: 7.2.0 packages: @@ -1747,8 +1747,8 @@ packages: '@vue/compiler-sfc': optional: true - '@iconify/json@2.2.285': - resolution: {integrity: sha512-oyH9NQ3aMdPuBl7miNcX7IavISwv5o07O6MBTQhW+X1mvyzrGwTxFf5bZmGYOsH3yB0MDGZkir3v+JiQE3UInA==} + '@iconify/json@2.2.286': + resolution: {integrity: sha512-tVl/fYvCyU5flYl4zfuJgig+ZEnpG3DJdTTTIjsiPu7xsk4s0gT1BktWvcFGr2B4UUiTRdb+XHWzW8Eu9WwhKQ==} '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} @@ -1791,18 +1791,18 @@ packages: '@material/material-color-utilities@0.3.0': resolution: {integrity: sha512-ztmtTd6xwnuh2/xu+Vb01btgV8SQWYCaK56CkRK8gEkWe5TuDyBcYJ0wgkMRn+2VcE9KUmhvkz+N9GHrqw/C0g==} - '@microsoft/api-extractor-model@7.29.8': - resolution: {integrity: sha512-t3Z/xcO6TRbMcnKGVMs4uMzv/gd5j0NhMiJIGjD4cJMeFJ1Hf8wnLSx37vxlRlL0GWlGJhnFgxvnaL6JlS+73g==} + '@microsoft/api-extractor-model@7.30.1': + resolution: {integrity: sha512-CTS2PlASJHxVY8hqHORVb1HdECWOEMcMnM6/kDkPr0RZapAFSIHhg9D4jxuE8g+OWYHtPc10LCpmde5pylTRlA==} - '@microsoft/api-extractor@7.47.11': - resolution: {integrity: sha512-lrudfbPub5wzBhymfFtgZKuBvXxoSIAdrvS2UbHjoMT2TjIEddq6Z13pcve7A03BAouw0x8sW8G4txdgfiSwpQ==} + '@microsoft/api-extractor@7.48.1': + resolution: {integrity: sha512-HN9Osa1WxqLM66RaqB5nPAadx+nTIQmY/XtkFdaJvusjG8Tus++QqZtD7KPZDSkhEMGHsYeSyeU8qUzCDUXPjg==} hasBin: true - '@microsoft/tsdoc-config@0.17.0': - resolution: {integrity: sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==} + '@microsoft/tsdoc-config@0.17.1': + resolution: {integrity: sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==} - '@microsoft/tsdoc@0.15.0': - resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==} + '@microsoft/tsdoc@0.15.1': + resolution: {integrity: sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==} '@monaco-editor/loader@1.4.0': resolution: {integrity: sha512-00ioBig0x642hytVspPl7DbQyaSWRaolYie/UFNjoTdvoKPzo6xrXLhTk9ixgIKcLH5b5vDOjVNiGyY+uDCUlg==} @@ -1816,17 +1816,6 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - '@mui/base@5.0.0-beta.66': - resolution: {integrity: sha512-1SzcNbtIms0o/Dx+599B6QbvR5qUMBUjwc2Gs47h1HsF7RcEFXxqaq7zrWkIWbvGctIIPx0j330oGx/SkF+UmA==} - engines: {node: '>=14.0.0'} - peerDependencies: - '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 - react: ^17.0.0 || ^18.0.0 || ^19.0.0 - react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0 - peerDependenciesMeta: - '@types/react': - optional: true - '@mui/base@5.0.0-beta.67': resolution: {integrity: sha512-pwjibXqBrSw1Z1fZEIhWJnMJHSvh3BLz0pZcrX/x01B/BVf6QUbFlGVV/k8KCsZ9sPzln1l8bBJ+ynIIE9LtjA==} engines: {node: '>=14.0.0'} @@ -1971,14 +1960,6 @@ packages: '@types/react': optional: true - '@mui/types@7.2.19': - resolution: {integrity: sha512-6XpZEM/Q3epK9RN8ENoXuygnqUQxE+siN/6rGRi2iwJPgBUR25mphYQ9ZI87plGh58YoZ5pp40bFvKYOCDJ3tA==} - peerDependencies: - '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 - peerDependenciesMeta: - '@types/react': - optional: true - '@mui/types@7.2.20': resolution: {integrity: sha512-straFHD7L8v05l/N5vcWk+y7eL9JF0C2mtph/y4BPm3gn2Eh61dDwDB65pa8DLss3WJfDXYC7Kx5yjP0EmXpgw==} peerDependencies: @@ -1997,16 +1978,6 @@ packages: '@types/react': optional: true - '@mui/utils@6.2.0': - resolution: {integrity: sha512-77CaFJi+OIi2SjbPwCis8z5DXvE0dfx9hBz5FguZHt1VYFlWEPCWTHcMsQCahSErnfik5ebLsYK8+D+nsjGVfw==} - engines: {node: '>=14.0.0'} - peerDependencies: - '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 - react: ^17.0.0 || ^18.0.0 || ^19.0.0 - peerDependenciesMeta: - '@types/react': - optional: true - '@mui/utils@6.2.1': resolution: {integrity: sha512-ubLqGIMhKUH2TF/Um+wRzYXgAooQw35th+DPemGrTpgrZHpOgcnUDIDbwsk1e8iQiuJ3mV/ErTtcQrecmlj5cg==} engines: {node: '>=14.0.0'} @@ -2417,8 +2388,8 @@ packages: '@types/react': optional: true - '@rollup/pluginutils@5.1.0': - resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + '@rollup/pluginutils@5.1.3': + resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 @@ -2426,8 +2397,8 @@ packages: rollup: optional: true - '@rollup/pluginutils@5.1.3': - resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} + '@rollup/pluginutils@5.1.4': + resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 @@ -2528,8 +2499,8 @@ packages: '@rtsao/scc@1.1.0': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} - '@rushstack/node-core-library@5.9.0': - resolution: {integrity: sha512-MMsshEWkTbXqxqFxD4gcIUWQOCeBChlGczdZbHfqmNZQFLHB3yWxDFSMHFUdu2/OB9NUk7Awn5qRL+rws4HQNg==} + '@rushstack/node-core-library@5.10.1': + resolution: {integrity: sha512-BSb/KcyBHmUQwINrgtzo6jiH0HlGFmrUy33vO6unmceuVKTEyL2q+P0fQq2oB5hvXVWOEUhxB2QvlkZluvUEmg==} peerDependencies: '@types/node': '*' peerDependenciesMeta: @@ -2539,16 +2510,16 @@ packages: '@rushstack/rig-package@0.5.3': resolution: {integrity: sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==} - '@rushstack/terminal@0.14.2': - resolution: {integrity: sha512-2fC1wqu1VCExKC0/L+0noVcFQEXEnoBOtCIex1TOjBzEDWcw8KzJjjj7aTP6mLxepG0XIyn9OufeFb6SFsa+sg==} + '@rushstack/terminal@0.14.4': + resolution: {integrity: sha512-NxACqERW0PHq8Rpq1V6v5iTHEwkRGxenjEW+VWqRYQ8T9puUzgmGHmEZUaUEDHAe9Qyvp0/Ew04sAiQw9XjhJg==} peerDependencies: '@types/node': '*' peerDependenciesMeta: '@types/node': optional: true - '@rushstack/ts-command-line@4.23.0': - resolution: {integrity: sha512-jYREBtsxduPV6ptNq8jOKp9+yx0ld1Tb/Tkdnlj8gTjazl1sF3DwX2VbluyYrNd0meWIL0bNeer7WDf5tKFjaQ==} + '@rushstack/ts-command-line@4.23.2': + resolution: {integrity: sha512-JJ7XZX5K3ThBBva38aomgsPv1L7FV6XmSOcR6HtM7HDFZJkepqT65imw26h9ggGqMjsY0R9jcl30tzKcVj9aOQ==} '@shikijs/core@1.24.2': resolution: {integrity: sha512-BpbNUSKIwbKrRRA+BQj0BEWSw+8kOPKDJevWeSE/xIqGX7K0xrCZQ9kK0nnEQyrzsUoka1l81ZtJ2mGaCA32HQ==} @@ -3120,16 +3091,13 @@ packages: peerDependencies: '@types/react': ^19.0.0 - '@types/react-transition-group@4.4.11': - resolution: {integrity: sha512-RM05tAniPZ5DZPzzNFP+DmrcOdD0efDUxMy3145oljWSl3x9ZV5vhme98gTxFrj2lhXvmGNnUiuDyJgY9IKkNA==} - '@types/react-transition-group@4.4.12': resolution: {integrity: sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==} peerDependencies: '@types/react': '*' - '@types/react@19.0.1': - resolution: {integrity: sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ==} + '@types/react@19.0.2': + resolution: {integrity: sha512-USU8ZI/xyKJwFTpjSVIrSeHBVAGagkHQKPNbxeWwql/vDmnTIBgx+TJnhFnj1NXgz8XfprU0egV2dROLGpsBEg==} '@types/responselike@1.0.3': resolution: {integrity: sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==} @@ -3217,34 +3185,34 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 || ^6.0.0 - '@volar/language-core@2.4.5': - resolution: {integrity: sha512-F4tA0DCO5Q1F5mScHmca0umsi2ufKULAnMOVBfMsZdT4myhVl4WdKRwCaKcfOkIEuyrAVvtq1ESBdZ+rSyLVww==} + '@volar/language-core@2.4.11': + resolution: {integrity: sha512-lN2C1+ByfW9/JRPpqScuZt/4OrUUse57GLI6TbLgTIqBVemdl1wNcZ1qYGEo2+Gw8coYLgCy7SuKqn6IrQcQgg==} - '@volar/source-map@2.4.5': - resolution: {integrity: sha512-varwD7RaKE2J/Z+Zu6j3mNNJbNT394qIxXwdvz/4ao/vxOfyClZpSDtLKkwWmecinkOVos5+PWkWraelfMLfpw==} + '@volar/source-map@2.4.11': + resolution: {integrity: sha512-ZQpmafIGvaZMn/8iuvCFGrW3smeqkq/IIh9F1SdSx9aUl0J4Iurzd6/FhmjNO5g2ejF3rT45dKskgXWiofqlZQ==} - '@volar/typescript@2.4.5': - resolution: {integrity: sha512-mcT1mHvLljAEtHviVcBuOyAwwMKz1ibXTi5uYtP/pf4XxoAzpdkQ+Br2IC0NPCvLCbjPZmbf3I0udndkfB1CDg==} + '@volar/typescript@2.4.11': + resolution: {integrity: sha512-2DT+Tdh88Spp5PyPbqhyoYavYCPDsqbHLFwcUI9K1NlY1YgUJvujGdrqUp0zWxnW7KWNTr3xSpMuv2WnaTKDAw==} - '@vue/compiler-core@3.4.38': - resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} + '@vue/compiler-core@3.5.13': + resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==} - '@vue/compiler-dom@3.4.38': - resolution: {integrity: sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==} + '@vue/compiler-dom@3.5.13': + resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==} '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} - '@vue/language-core@2.1.6': - resolution: {integrity: sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==} + '@vue/language-core@2.1.10': + resolution: {integrity: sha512-DAI289d0K3AB5TUG3xDp9OuQ71CnrujQwJrQnfuZDwo6eGNf0UoRlPuaVNO+Zrn65PC3j0oB2i7mNmVPggeGeQ==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - '@vue/shared@3.4.38': - resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} + '@vue/shared@3.5.13': + resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} '@xobotyi/scrollbar-width@1.9.5': resolution: {integrity: sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ==} @@ -3325,6 +3293,9 @@ packages: ajv@8.17.1: resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} + alien-signals@0.2.2: + resolution: {integrity: sha512-cZIRkbERILsBOXTQmMrxc9hgpxglstn69zm+F1ARf4aPAzdAFYd6sBq87ErO0Fj3DV94tglcyHG5kQz9nDC/8A==} + allotment@1.20.2: resolution: {integrity: sha512-TaCuHfYNcsJS9EPk04M7TlG5Rl3vbAdHeAyrTE9D5vbpzV+wxnRoUrulDbfnzaQcPIZKpHJNixDOoZNuzliKEA==} peerDependencies: @@ -3737,9 +3708,6 @@ packages: compare-versions@6.1.1: resolution: {integrity: sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==} - computeds@0.0.1: - resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==} - concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -4789,8 +4757,8 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} - globals@15.13.0: - resolution: {integrity: sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==} + globals@15.14.0: + resolution: {integrity: sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==} engines: {node: '>=18'} globalthis@1.0.4: @@ -5290,10 +5258,6 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true - jiti@2.4.0: - resolution: {integrity: sha512-H5UpaUI+aHOqZXlYOaFP/8AzKsg+guWu+Pr3Y8i7+Y3zr1aXAvCvTAQ1RxSc6oVD8R8c7brgNtTVP91E7upH/g==} - hasBin: true - jiti@2.4.1: resolution: {integrity: sha512-yPBThwecp1wS9DmoA4x4KR2h3QoslacnDR8ypuFM962kI4/456Iy1oHx2RAgh4jfZNdn0bctsdadceiBUgpU1g==} hasBin: true @@ -5404,8 +5368,8 @@ packages: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} - knip@5.40.0: - resolution: {integrity: sha512-EzBfQDz4YBzYnMLueWnaaVr15mneqZs1c3RanttciuVuRcodlNjzAmR2nch/khlRdVABAxAdMGFxfSvhvcH1NA==} + knip@5.41.1: + resolution: {integrity: sha512-yNpCCe2REU7U3VRvMASnXSEtfEC2HmOoDW9Vp9teQ9FktJYnuagvSZD3xWq8Ru7sPABkmvbC5TVWuMzIaeADNA==} engines: {node: '>=18.6.0'} hasBin: true peerDependencies: @@ -5451,10 +5415,6 @@ packages: resolution: {integrity: sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==} engines: {node: '>=18.0.0'} - local-pkg@0.5.0: - resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} - engines: {node: '>=14'} - local-pkg@0.5.1: resolution: {integrity: sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==} engines: {node: '>=14'} @@ -5551,15 +5511,15 @@ packages: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} - magic-string@0.30.11: - resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} - magic-string@0.30.14: resolution: {integrity: sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==} magic-string@0.30.15: resolution: {integrity: sha512-zXeaYRgZ6ldS1RJJUrMrYgNJ4fdwnyI6tVqoiIhyCyv5IVTK9BU8Ic2l253GGETQHxI4HNUwhJ3fjDhKqEoaAw==} + magic-string@0.30.17: + resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} + make-dir@1.3.0: resolution: {integrity: sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==} engines: {node: '>=4'} @@ -7443,8 +7403,8 @@ packages: resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==} engines: {node: '>=14.0'} - undici@7.1.1: - resolution: {integrity: sha512-WZkQ6eH9f5ZT93gaIffsbUaDpBwjbpvmMbfaEhOnbdUneurTESeRxwPGwjI28mRFESH3W3e8Togijh37ptOQqA==} + undici@7.2.0: + resolution: {integrity: sha512-klt+0S55GBViA9nsq48/NSCo4YX5mjydjypxD7UmHh/brMu8h/Mhd/F7qAeoH2NOO8SDTk6kjnTFc4WpzmfYpQ==} engines: {node: '>=20.18.1'} unicode-canonical-property-names-ecmascript@2.0.1: @@ -7644,8 +7604,8 @@ packages: engines: {node: ^18.19.0 || >=20.6.0} hasBin: true - vite-plugin-dts@4.3.0: - resolution: {integrity: sha512-LkBJh9IbLwL6/rxh0C1/bOurDrIEmRE7joC+jFdOEEciAFPbpEKOLSAr5nNh5R7CJ45cMbksTrFfy52szzC5eA==} + vite-plugin-dts@4.4.0: + resolution: {integrity: sha512-CJ6phvnnPLF+aFk8Jz2ZcMBLleJ4gKJOXb9We5Kzmsp5bPuD+uMDeVefjFNYSXZ+wdcqnf+Yp2P7oA5hBKQTlQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -8905,7 +8865,7 @@ snapshots: '@emotion/memoize@0.9.0': {} - '@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0)': + '@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@emotion/babel-plugin': 11.13.5 @@ -8917,7 +8877,7 @@ snapshots: hoist-non-react-statics: 3.3.2 react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 transitivePeerDependencies: - supports-color @@ -8931,18 +8891,18 @@ snapshots: '@emotion/sheet@1.4.0': {} - '@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0)': + '@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@emotion/babel-plugin': 11.13.5 '@emotion/is-prop-valid': 1.3.0 - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) '@emotion/serialize': 1.3.3 '@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@19.0.0) '@emotion/utils': 1.4.2 react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 transitivePeerDependencies: - supports-color @@ -9197,7 +9157,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@iconify/json@2.2.285': + '@iconify/json@2.2.286': dependencies: '@iconify/types': 2.0.0 pathe: 1.1.2 @@ -9210,7 +9170,7 @@ snapshots: '@antfu/utils': 0.7.10 '@iconify/types': 2.0.0 debug: 4.4.0 - globals: 15.13.0 + globals: 15.14.0 kolorist: 1.8.0 local-pkg: 0.5.1 mlly: 1.7.3 @@ -9256,23 +9216,23 @@ snapshots: '@material/material-color-utilities@0.3.0': {} - '@microsoft/api-extractor-model@7.29.8(@types/node@22.10.2)': + '@microsoft/api-extractor-model@7.30.1(@types/node@22.10.2)': dependencies: - '@microsoft/tsdoc': 0.15.0 - '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@22.10.2) + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.1(@types/node@22.10.2) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.47.11(@types/node@22.10.2)': + '@microsoft/api-extractor@7.48.1(@types/node@22.10.2)': dependencies: - '@microsoft/api-extractor-model': 7.29.8(@types/node@22.10.2) - '@microsoft/tsdoc': 0.15.0 - '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@22.10.2) + '@microsoft/api-extractor-model': 7.30.1(@types/node@22.10.2) + '@microsoft/tsdoc': 0.15.1 + '@microsoft/tsdoc-config': 0.17.1 + '@rushstack/node-core-library': 5.10.1(@types/node@22.10.2) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.14.2(@types/node@22.10.2) - '@rushstack/ts-command-line': 4.23.0(@types/node@22.10.2) + '@rushstack/terminal': 0.14.4(@types/node@22.10.2) + '@rushstack/ts-command-line': 4.23.2(@types/node@22.10.2) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.8 @@ -9282,14 +9242,14 @@ snapshots: transitivePeerDependencies: - '@types/node' - '@microsoft/tsdoc-config@0.17.0': + '@microsoft/tsdoc-config@0.17.1': dependencies: - '@microsoft/tsdoc': 0.15.0 + '@microsoft/tsdoc': 0.15.1 ajv: 8.12.0 jju: 1.4.0 resolve: 1.22.8 - '@microsoft/tsdoc@0.15.0': {} + '@microsoft/tsdoc@0.15.1': {} '@monaco-editor/loader@1.4.0(monaco-editor@0.52.2)': dependencies: @@ -9303,70 +9263,56 @@ snapshots: react: 19.0.0 react-dom: 19.0.0(react@19.0.0) - '@mui/base@5.0.0-beta.66(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@mui/base@5.0.0-beta.67(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.19(@types/react@19.0.1) - '@mui/utils': 6.2.0(@types/react@19.0.1)(react@19.0.0) + '@mui/types': 7.2.20(@types/react@19.0.2) + '@mui/utils': 6.2.1(@types/react@19.0.2)(react@19.0.0) '@popperjs/core': 2.11.8 clsx: 2.1.1 prop-types: 15.8.1 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 - - '@mui/base@5.0.0-beta.67(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': - dependencies: - '@babel/runtime': 7.26.0 - '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.20(@types/react@19.0.1) - '@mui/utils': 6.2.1(@types/react@19.0.1)(react@19.0.0) - '@popperjs/core': 2.11.8 - clsx: 2.1.1 - prop-types: 15.8.1 - react: 19.0.0 - react-dom: 19.0.0(react@19.0.0) - optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 '@mui/core-downloads-tracker@6.2.1': {} - '@mui/icons-material@6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react@19.0.0)': + '@mui/icons-material@6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/lab@6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@mui/lab@6.0.0-beta.20(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/base': 5.0.0-beta.67(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/system': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/types': 7.2.20(@types/react@19.0.1) - '@mui/utils': 6.2.1(@types/react@19.0.1)(react@19.0.0) + '@mui/base': 5.0.0-beta.67(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/system': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/types': 7.2.20(@types/react@19.0.2) + '@mui/utils': 6.2.1(@types/react@19.0.2)(react@19.0.0) clsx: 2.1.1 prop-types: 15.8.1 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@types/react': 19.0.1 + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@types/react': 19.0.2 - '@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@mui/core-downloads-tracker': 6.2.1 - '@mui/system': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/types': 7.2.20(@types/react@19.0.1) - '@mui/utils': 6.2.1(@types/react@19.0.1)(react@19.0.0) + '@mui/system': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/types': 7.2.20(@types/react@19.0.2) + '@mui/utils': 6.2.1(@types/react@19.0.2)(react@19.0.0) '@popperjs/core': 2.11.8 - '@types/react-transition-group': 4.4.12(@types/react@19.0.1) + '@types/react-transition-group': 4.4.12(@types/react@19.0.2) clsx: 2.1.1 csstype: 3.1.3 prop-types: 15.8.1 @@ -9375,29 +9321,29 @@ snapshots: react-is: 19.0.0 react-transition-group: 4.4.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0) optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@types/react': 19.0.1 + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@types/react': 19.0.2 - '@mui/private-theming@5.16.6(@types/react@19.0.1)(react@19.0.0)': + '@mui/private-theming@5.16.6(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/utils': 5.16.6(@types/react@19.0.1)(react@19.0.0) + '@mui/utils': 5.16.6(@types/react@19.0.2)(react@19.0.0) prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/private-theming@6.2.1(@types/react@19.0.1)(react@19.0.0)': + '@mui/private-theming@6.2.1(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/utils': 6.2.1(@types/react@19.0.1)(react@19.0.0) + '@mui/utils': 6.2.1(@types/react@19.0.2)(react@19.0.0) prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/styled-engine@5.16.6(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(react@19.0.0)': + '@mui/styled-engine@5.16.6(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@emotion/cache': 11.14.0 @@ -9405,10 +9351,10 @@ snapshots: prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) - '@mui/styled-engine@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(react@19.0.0)': + '@mui/styled-engine@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 '@emotion/cache': 11.14.0 @@ -9418,101 +9364,85 @@ snapshots: prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) - '@mui/system@5.16.7(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0)': + '@mui/system@5.16.7(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/private-theming': 5.16.6(@types/react@19.0.1)(react@19.0.0) - '@mui/styled-engine': 5.16.6(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.19(@types/react@19.0.1) - '@mui/utils': 5.16.6(@types/react@19.0.1)(react@19.0.0) + '@mui/private-theming': 5.16.6(@types/react@19.0.2)(react@19.0.0) + '@mui/styled-engine': 5.16.6(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(react@19.0.0) + '@mui/types': 7.2.20(@types/react@19.0.2) + '@mui/utils': 5.16.6(@types/react@19.0.2)(react@19.0.0) clsx: 2.1.1 csstype: 3.1.3 prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@types/react': 19.0.1 + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@types/react': 19.0.2 - '@mui/system@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0)': + '@mui/system@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/private-theming': 6.2.1(@types/react@19.0.1)(react@19.0.0) - '@mui/styled-engine': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(react@19.0.0) - '@mui/types': 7.2.20(@types/react@19.0.1) - '@mui/utils': 6.2.1(@types/react@19.0.1)(react@19.0.0) + '@mui/private-theming': 6.2.1(@types/react@19.0.2)(react@19.0.0) + '@mui/styled-engine': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(react@19.0.0) + '@mui/types': 7.2.20(@types/react@19.0.2) + '@mui/utils': 6.2.1(@types/react@19.0.2)(react@19.0.0) clsx: 2.1.1 csstype: 3.1.3 prop-types: 15.8.1 react: 19.0.0 optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@types/react': 19.0.1 + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@types/react': 19.0.2 - '@mui/types@7.2.19(@types/react@19.0.1)': + '@mui/types@7.2.20(@types/react@19.0.2)': optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/types@7.2.20(@types/react@19.0.1)': - optionalDependencies: - '@types/react': 19.0.1 - - '@mui/utils@5.16.6(@types/react@19.0.1)(react@19.0.0)': + '@mui/utils@5.16.6(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/types': 7.2.19(@types/react@19.0.1) + '@mui/types': 7.2.20(@types/react@19.0.2) '@types/prop-types': 15.7.14 clsx: 2.1.1 prop-types: 15.8.1 react: 19.0.0 react-is: 18.3.1 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/utils@6.2.0(@types/react@19.0.1)(react@19.0.0)': + '@mui/utils@6.2.1(@types/react@19.0.2)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/types': 7.2.19(@types/react@19.0.1) + '@mui/types': 7.2.20(@types/react@19.0.2) '@types/prop-types': 15.7.14 clsx: 2.1.1 prop-types: 15.8.1 react: 19.0.0 react-is: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@mui/utils@6.2.1(@types/react@19.0.1)(react@19.0.0)': + '@mui/x-date-pickers@7.9.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 - '@mui/types': 7.2.20(@types/react@19.0.1) - '@types/prop-types': 15.7.14 - clsx: 2.1.1 - prop-types: 15.8.1 - react: 19.0.0 - react-is: 19.0.0 - optionalDependencies: - '@types/react': 19.0.1 - - '@mui/x-date-pickers@7.9.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': - dependencies: - '@babel/runtime': 7.26.0 - '@mui/base': 5.0.0-beta.66(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/system': 5.16.7(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/utils': 5.16.6(@types/react@19.0.1)(react@19.0.0) - '@types/react-transition-group': 4.4.11 + '@mui/base': 5.0.0-beta.67(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/system': 5.16.7(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/utils': 5.16.6(@types/react@19.0.2)(react@19.0.0) + '@types/react-transition-group': 4.4.12(@types/react@19.0.2) clsx: 2.1.1 prop-types: 15.8.1 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) react-transition-group: 4.4.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0) optionalDependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) dayjs: 1.11.13 transitivePeerDependencies: - '@types/react' @@ -9798,98 +9728,98 @@ snapshots: '@radix-ui/primitive@1.1.1': {} - '@radix-ui/react-compose-refs@1.1.1(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-compose-refs@1.1.1(@types/react@19.0.2)(react@19.0.0)': dependencies: react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@radix-ui/react-context@1.1.1(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-context@1.1.1(@types/react@19.0.2)(react@19.0.0)': dependencies: react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@radix-ui/react-direction@1.1.0(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-direction@1.1.0(@types/react@19.0.2)(react@19.0.0)': dependencies: react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@radix-ui/react-portal@1.1.3(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-portal@1.1.3(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: - '@radix-ui/react-primitive': 2.0.1(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.1)(react@19.0.0) + '@radix-ui/react-primitive': 2.0.1(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.2)(react@19.0.0) react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 - '@types/react-dom': 19.0.2(@types/react@19.0.1) + '@types/react': 19.0.2 + '@types/react-dom': 19.0.2(@types/react@19.0.2) - '@radix-ui/react-presence@1.1.2(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-presence@1.1.2(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: - '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.1)(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.1)(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.2)(react@19.0.0) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.2)(react@19.0.0) react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 - '@types/react-dom': 19.0.2(@types/react@19.0.1) + '@types/react': 19.0.2 + '@types/react-dom': 19.0.2(@types/react@19.0.2) - '@radix-ui/react-primitive@2.0.1(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-primitive@2.0.1(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: - '@radix-ui/react-slot': 1.1.1(@types/react@19.0.1)(react@19.0.0) + '@radix-ui/react-slot': 1.1.1(@types/react@19.0.2)(react@19.0.0) react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 - '@types/react-dom': 19.0.2(@types/react@19.0.1) + '@types/react': 19.0.2 + '@types/react-dom': 19.0.2(@types/react@19.0.2) - '@radix-ui/react-scroll-area@1.2.2(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + '@radix-ui/react-scroll-area@1.2.2(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@radix-ui/number': 1.1.0 '@radix-ui/primitive': 1.1.1 - '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.1)(react@19.0.0) - '@radix-ui/react-context': 1.1.1(@types/react@19.0.1)(react@19.0.0) - '@radix-ui/react-direction': 1.1.0(@types/react@19.0.1)(react@19.0.0) - '@radix-ui/react-presence': 1.1.2(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-primitive': 2.0.1(@types/react-dom@19.0.2(@types/react@19.0.1))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.1)(react@19.0.0) - '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.1)(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.2)(react@19.0.0) + '@radix-ui/react-context': 1.1.1(@types/react@19.0.2)(react@19.0.0) + '@radix-ui/react-direction': 1.1.0(@types/react@19.0.2)(react@19.0.0) + '@radix-ui/react-presence': 1.1.2(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-primitive': 2.0.1(@types/react-dom@19.0.2(@types/react@19.0.2))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.2)(react@19.0.0) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.2)(react@19.0.0) react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 - '@types/react-dom': 19.0.2(@types/react@19.0.1) + '@types/react': 19.0.2 + '@types/react-dom': 19.0.2(@types/react@19.0.2) - '@radix-ui/react-slot@1.1.1(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-slot@1.1.1(@types/react@19.0.2)(react@19.0.0)': dependencies: - '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.1)(react@19.0.0) + '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.2)(react@19.0.0) react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@radix-ui/react-use-callback-ref@1.1.0(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-use-callback-ref@1.1.0(@types/react@19.0.2)(react@19.0.0)': dependencies: react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@radix-ui/react-use-layout-effect@1.1.0(@types/react@19.0.1)(react@19.0.0)': + '@radix-ui/react-use-layout-effect@1.1.0(@types/react@19.0.2)(react@19.0.0)': dependencies: react: 19.0.0 optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@rollup/pluginutils@5.1.0(rollup@4.27.4)': + '@rollup/pluginutils@5.1.3(rollup@4.27.4)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 - picomatch: 2.3.1 + picomatch: 4.0.2 optionalDependencies: rollup: 4.27.4 - '@rollup/pluginutils@5.1.3(rollup@4.27.4)': + '@rollup/pluginutils@5.1.4(rollup@4.27.4)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 @@ -9953,7 +9883,7 @@ snapshots: '@rtsao/scc@1.1.0': {} - '@rushstack/node-core-library@5.9.0(@types/node@22.10.2)': + '@rushstack/node-core-library@5.10.1(@types/node@22.10.2)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -9971,16 +9901,16 @@ snapshots: resolve: 1.22.8 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.14.2(@types/node@22.10.2)': + '@rushstack/terminal@0.14.4(@types/node@22.10.2)': dependencies: - '@rushstack/node-core-library': 5.9.0(@types/node@22.10.2) + '@rushstack/node-core-library': 5.10.1(@types/node@22.10.2) supports-color: 8.1.1 optionalDependencies: '@types/node': 22.10.2 - '@rushstack/ts-command-line@4.23.0(@types/node@22.10.2)': + '@rushstack/ts-command-line@4.23.2(@types/node@22.10.2)': dependencies: - '@rushstack/terminal': 0.14.2(@types/node@22.10.2) + '@rushstack/terminal': 0.14.4(@types/node@22.10.2) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -10580,19 +10510,15 @@ snapshots: '@types/prop-types@15.7.14': {} - '@types/react-dom@19.0.2(@types/react@19.0.1)': + '@types/react-dom@19.0.2(@types/react@19.0.2)': dependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@types/react-transition-group@4.4.11': + '@types/react-transition-group@4.4.12(@types/react@19.0.2)': dependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 - '@types/react-transition-group@4.4.12(@types/react@19.0.1)': - dependencies: - '@types/react': 19.0.1 - - '@types/react@19.0.1': + '@types/react@19.0.2': dependencies: csstype: 3.1.3 @@ -10725,50 +10651,50 @@ snapshots: transitivePeerDependencies: - supports-color - '@volar/language-core@2.4.5': + '@volar/language-core@2.4.11': dependencies: - '@volar/source-map': 2.4.5 + '@volar/source-map': 2.4.11 - '@volar/source-map@2.4.5': {} + '@volar/source-map@2.4.11': {} - '@volar/typescript@2.4.5': + '@volar/typescript@2.4.11': dependencies: - '@volar/language-core': 2.4.5 + '@volar/language-core': 2.4.11 path-browserify: 1.0.1 vscode-uri: 3.0.8 - '@vue/compiler-core@3.4.38': + '@vue/compiler-core@3.5.13': dependencies: '@babel/parser': 7.26.3 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.13 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.4.38': + '@vue/compiler-dom@3.5.13': dependencies: - '@vue/compiler-core': 3.4.38 - '@vue/shared': 3.4.38 + '@vue/compiler-core': 3.5.13 + '@vue/shared': 3.5.13 '@vue/compiler-vue2@2.7.16': dependencies: de-indent: 1.0.2 he: 1.2.0 - '@vue/language-core@2.1.6(typescript@5.7.2)': + '@vue/language-core@2.1.10(typescript@5.7.2)': dependencies: - '@volar/language-core': 2.4.5 - '@vue/compiler-dom': 3.4.38 + '@volar/language-core': 2.4.11 + '@vue/compiler-dom': 3.5.13 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.4.38 - computeds: 0.0.1 + '@vue/shared': 3.5.13 + alien-signals: 0.2.2 minimatch: 9.0.5 muggle-string: 0.4.1 path-browserify: 1.0.1 optionalDependencies: typescript: 5.7.2 - '@vue/shared@3.4.38': {} + '@vue/shared@3.5.13': {} '@xobotyi/scrollbar-width@1.9.5': {} @@ -10860,6 +10786,8 @@ snapshots: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + alien-signals@0.2.2: {} + allotment@1.20.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: classnames: 2.5.1 @@ -11301,8 +11229,6 @@ snapshots: compare-versions@6.1.1: {} - computeds@0.0.1: {} - concat-map@0.0.1: {} confbox@0.1.8: {} @@ -12137,7 +12063,7 @@ snapshots: eslint: 9.17.0(jiti@2.4.1) eslint-plugin-es-x: 7.8.0(eslint@9.17.0(jiti@2.4.1)) get-tsconfig: 4.8.1 - globals: 15.13.0 + globals: 15.14.0 ignore: 5.3.2 minimatch: 9.0.5 semver: 7.6.3 @@ -12571,7 +12497,7 @@ snapshots: globals@14.0.0: {} - globals@15.13.0: {} + globals@15.14.0: {} globalthis@1.0.4: dependencies: @@ -13053,15 +12979,13 @@ snapshots: jiti@1.21.6: {} - jiti@2.4.0: {} - jiti@2.4.1: {} jju@1.4.0: {} - jotai@2.10.4(@types/react@19.0.1)(react@19.0.0): + jotai@2.10.4(@types/react@19.0.2)(react@19.0.0): optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 react: 19.0.0 js-cookie@2.2.1: {} @@ -13135,7 +13059,7 @@ snapshots: kind-of@6.0.3: {} - knip@5.40.0(@types/node@22.10.2)(typescript@5.7.2): + knip@5.41.1(@types/node@22.10.2)(typescript@5.7.2): dependencies: '@nodelib/fs.walk': 1.2.8 '@snyk/github-codeowners': 1.1.0 @@ -13143,7 +13067,7 @@ snapshots: easy-table: 1.2.0 enhanced-resolve: 5.17.1 fast-glob: 3.3.2 - jiti: 2.4.0 + jiti: 2.4.1 js-yaml: 4.1.0 minimist: 1.2.8 picocolors: 1.1.1 @@ -13213,11 +13137,6 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.0 - local-pkg@0.5.0: - dependencies: - mlly: 1.7.3 - pkg-types: 1.2.1 - local-pkg@0.5.1: dependencies: mlly: 1.7.3 @@ -13300,10 +13219,6 @@ snapshots: dependencies: yallist: 4.0.0 - magic-string@0.30.11: - dependencies: - '@jridgewell/sourcemap-codec': 1.5.0 - magic-string@0.30.14: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -13312,6 +13227,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + magic-string@0.30.17: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + make-dir@1.3.0: dependencies: pify: 3.0.0 @@ -13327,13 +13246,13 @@ snapshots: escape-string-regexp: 4.0.0 optional: true - material-react-table@3.0.3(xhq44wvo2c45mjuwm6njnozb7i): + material-react-table@3.0.3(kuquuzfhnojzmzfsc3urrgc2f4): dependencies: - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/icons-material': 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@mui/x-date-pickers': 7.9.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/icons-material': 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/x-date-pickers': 7.9.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@tanstack/match-sorter-utils': 8.19.4 '@tanstack/react-table': 8.20.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@tanstack/react-virtual': 3.10.9(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -13672,16 +13591,16 @@ snapshots: muggle-string@0.4.1: {} - mui-color-input@5.0.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + mui-color-input@5.0.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: '@ctrl/tinycolor': 4.1.0 - '@emotion/react': 11.14.0(@types/react@19.0.1)(react@19.0.0) - '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@emotion/react': 11.14.0(@types/react@19.0.2)(react@19.0.0) + '@emotion/styled': 11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: 19.0.0 react-dom: 19.0.0(react@19.0.0) optionalDependencies: - '@types/react': 19.0.1 + '@types/react': 19.0.2 mz@2.7.0: dependencies: @@ -13725,7 +13644,7 @@ snapshots: eslint-plugin-promise: 7.2.1(eslint@9.17.0(jiti@2.4.1)) eslint-plugin-react: 7.37.2(eslint@9.17.0(jiti@2.4.1)) find-up: 5.0.0 - globals: 15.13.0 + globals: 15.14.0 peowly: 1.3.2 typescript-eslint: 8.18.1(eslint@9.17.0(jiti@2.4.1))(typescript@5.7.2) transitivePeerDependencies: @@ -14284,14 +14203,14 @@ snapshots: react: 19.0.0 react-dom: 19.0.0(react@19.0.0) - react-hook-form-mui@7.4.1(uahyfzt5pda25sft5p5s5dq7gy): + react-hook-form-mui@7.4.1(vsxmc45kw5ykhcshxfgehxm6sy): dependencies: - '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/material': 6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: 19.0.0 react-hook-form: 7.52.1(react@19.0.0) optionalDependencies: - '@mui/icons-material': 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(react@19.0.0) - '@mui/x-date-pickers': 7.9.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react@19.0.0))(@types/react@19.0.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.1)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@mui/icons-material': 6.2.1(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(react@19.0.0) + '@mui/x-date-pickers': 7.9.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@mui/material@6.2.1(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react@19.0.0))(@types/react@19.0.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(@types/react@19.0.2)(dayjs@1.11.13)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react-hook-form@7.52.1(react@19.0.0): dependencies: @@ -14312,10 +14231,10 @@ snapshots: react-is@19.0.0: {} - react-markdown@9.0.1(@types/react@19.0.1)(react@19.0.0): + react-markdown@9.0.1(@types/react@19.0.2)(react@19.0.0): dependencies: '@types/hast': 3.0.4 - '@types/react': 19.0.1 + '@types/react': 19.0.2 devlop: 1.1.0 hast-util-to-jsx-runtime: 2.3.0 html-url-attributes: 3.0.0 @@ -15415,7 +15334,7 @@ snapshots: dependencies: '@fastify/busboy': 2.1.1 - undici@7.1.1: {} + undici@7.2.0: {} unicode-canonical-property-names-ecmascript@2.0.1: {} @@ -15624,17 +15543,17 @@ snapshots: - rollup - supports-color - vite-plugin-dts@4.3.0(@types/node@22.10.2)(rollup@4.27.4)(typescript@5.7.2)(vite@6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)): + vite-plugin-dts@4.4.0(@types/node@22.10.2)(rollup@4.27.4)(typescript@5.7.2)(vite@6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)): dependencies: - '@microsoft/api-extractor': 7.47.11(@types/node@22.10.2) - '@rollup/pluginutils': 5.1.0(rollup@4.27.4) - '@volar/typescript': 2.4.5 - '@vue/language-core': 2.1.6(typescript@5.7.2) + '@microsoft/api-extractor': 7.48.1(@types/node@22.10.2) + '@rollup/pluginutils': 5.1.4(rollup@4.27.4) + '@volar/typescript': 2.4.11 + '@vue/language-core': 2.1.10(typescript@5.7.2) compare-versions: 6.1.1 - debug: 4.3.7 + debug: 4.4.0 kolorist: 1.8.0 - local-pkg: 0.5.0 - magic-string: 0.30.11 + local-pkg: 0.5.1 + magic-string: 0.30.17 typescript: 5.7.2 optionalDependencies: vite: 6.0.3(@types/node@22.10.2)(jiti@2.4.1)(less@4.2.0)(sass-embedded@1.83.0)(sass@1.83.0)(stylus@0.62.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1) diff --git a/clash-nyanpasu/scripts/package.json b/clash-nyanpasu/scripts/package.json index b0aa44e015..1d81c8d8e1 100644 --- a/clash-nyanpasu/scripts/package.json +++ b/clash-nyanpasu/scripts/package.json @@ -22,6 +22,6 @@ "picocolors": "1.1.1", "tar": "7.4.3", "telegram": "2.26.8", - "undici": "7.1.1" + "undici": "7.2.0" } } diff --git a/lede/target/linux/rockchip/armv8/config-6.6 b/lede/target/linux/rockchip/armv8/config-6.6 index ed5bb8a590..8fc7654d25 100644 --- a/lede/target/linux/rockchip/armv8/config-6.6 +++ b/lede/target/linux/rockchip/armv8/config-6.6 @@ -170,11 +170,11 @@ CONFIG_CONTIG_ALLOC=y CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y diff --git a/lede/target/linux/rockchip/patches-6.12/005-arm64-dts-rockchip-add-EEPROM-node-for-NanoPi-R4S.patch b/lede/target/linux/rockchip/patches-6.12/005-arm64-dts-rockchip-add-EEPROM-node-for-NanoPi-R4S.patch new file mode 100644 index 0000000000..792028b292 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/005-arm64-dts-rockchip-add-EEPROM-node-for-NanoPi-R4S.patch @@ -0,0 +1,31 @@ +From af20b3384e8723077cc6484160b0cf4e9be321de Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Mon, 7 Jun 2021 15:45:37 +0800 +Subject: [PATCH] arm64: dts: rockchip: add EEPROM node for NanoPi R4S + +NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which +stores the MAC address. + +Signed-off-by: Tianling Shen +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -68,6 +68,15 @@ + status = "disabled"; + }; + ++&i2c2 { ++ eeprom@51 { ++ compatible = "microchip,24c02", "atmel,24c02"; ++ reg = <0x51>; ++ pagesize = <16>; ++ read-only; /* This holds our MAC */ ++ }; ++}; ++ + &i2c4 { + status = "disabled"; + }; diff --git a/lede/target/linux/rockchip/patches-6.12/010-v6.13-arm64-dts-rockchip-Add-rk3576-SoC-base-DT.patch b/lede/target/linux/rockchip/patches-6.12/010-v6.13-arm64-dts-rockchip-Add-rk3576-SoC-base-DT.patch new file mode 100644 index 0000000000..7bfdee07fd --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/010-v6.13-arm64-dts-rockchip-Add-rk3576-SoC-base-DT.patch @@ -0,0 +1,7486 @@ +From 4b9dc5d536b988fbd84e68e8d8ac420752b185b6 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Tue, 3 Sep 2024 11:22:38 -0400 +Subject: [PATCH] arm64: dts: rockchip: Add rk3576 SoC base DT + +This device tree contains all devices necessary for booting from network +or SD Card. + +It supports CPU, CRU, PM domains, dma, interrupts, timers, UART, I2C +and SDHCI (everything necessary to boot Linux on this system on chip) +as well as Ethernet, SPI, GPU and RTC. + +Signed-off-by: Liang Chen +Signed-off-by: Finley Xiao +Signed-off-by: Yifeng Zhao +Signed-off-by: Elaine Zhang +Signed-off-by: Detlev Casanova +Tested-by: Liang Chen +Link: https://lore.kernel.org/r/20240903152308.13565-9-detlev.casanova@collabora.com +Signed-off-by: Heiko Stuebner +--- + .../boot/dts/rockchip/rk3576-pinctrl.dtsi | 5775 +++++++++++++++++ + arch/arm64/boot/dts/rockchip/rk3576.dtsi | 1678 +++++ + 2 files changed, 7453 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi + create mode 100644 arch/arm64/boot/dts/rockchip/rk3576.dtsi + +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3576-pinctrl.dtsi +@@ -0,0 +1,5775 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2023 Rockchip Electronics Co., Ltd. ++ */ ++ ++#include ++#include "rockchip-pinconf.dtsi" ++ ++/* ++ * This file is auto generated by pin2dts tool, please keep these code ++ * by adding changes at end of this file. ++ */ ++&pinctrl { ++ aupll_clk { ++ /omit-if-no-ref/ ++ aupll_clkm0_pins: aupll_clkm0-pins { ++ rockchip,pins = ++ /* aupll_clk_in_m0 */ ++ <0 RK_PA0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ aupll_clkm1_pins: aupll_clkm1-pins { ++ rockchip,pins = ++ /* aupll_clk_in_m1 */ ++ <0 RK_PB0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ aupll_clkm2_pins: aupll_clkm2-pins { ++ rockchip,pins = ++ /* aupll_clk_in_m2 */ ++ <4 RK_PA2 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ cam_clk0 { ++ /omit-if-no-ref/ ++ cam_clk0m0_clk0: cam_clk0m0-clk0 { ++ rockchip,pins = ++ /* cam_clk0_out_m0 */ ++ <3 RK_PD7 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ cam_clk0m1_clk0: cam_clk0m1-clk0 { ++ rockchip,pins = ++ /* cam_clk0_out_m1 */ ++ <2 RK_PD2 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ cam_clk1 { ++ /omit-if-no-ref/ ++ cam_clk1m0_clk1: cam_clk1m0-clk1 { ++ rockchip,pins = ++ /* cam_clk1_out_m0 */ ++ <4 RK_PA0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ cam_clk1m1_clk1: cam_clk1m1-clk1 { ++ rockchip,pins = ++ /* cam_clk1_out_m1 */ ++ <2 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ cam_clk2 { ++ /omit-if-no-ref/ ++ cam_clk2m0_clk2: cam_clk2m0-clk2 { ++ rockchip,pins = ++ /* cam_clk2_out_m0 */ ++ <4 RK_PA1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ cam_clk2m1_clk2: cam_clk2m1-clk2 { ++ rockchip,pins = ++ /* cam_clk2_out_m1 */ ++ <2 RK_PD7 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ can0 { ++ /omit-if-no-ref/ ++ can0m0_pins: can0m0-pins { ++ rockchip,pins = ++ /* can0_rx_m0 */ ++ <2 RK_PA0 13 &pcfg_pull_none>, ++ /* can0_tx_m0 */ ++ <2 RK_PA1 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can0m1_pins: can0m1-pins { ++ rockchip,pins = ++ /* can0_rx_m1 */ ++ <4 RK_PC3 12 &pcfg_pull_none>, ++ /* can0_tx_m1 */ ++ <4 RK_PC2 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can0m2_pins: can0m2-pins { ++ rockchip,pins = ++ /* can0_rx_m2 */ ++ <4 RK_PA6 13 &pcfg_pull_none>, ++ /* can0_tx_m2 */ ++ <4 RK_PA4 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can0m3_pins: can0m3-pins { ++ rockchip,pins = ++ /* can0_rx_m3 */ ++ <3 RK_PC1 12 &pcfg_pull_none>, ++ /* can0_tx_m3 */ ++ <3 RK_PC4 12 &pcfg_pull_none>; ++ }; ++ }; ++ ++ can1 { ++ /omit-if-no-ref/ ++ can1m0_pins: can1m0-pins { ++ rockchip,pins = ++ /* can1_rx_m0 */ ++ <2 RK_PA2 13 &pcfg_pull_none>, ++ /* can1_tx_m0 */ ++ <2 RK_PA3 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can1m1_pins: can1m1-pins { ++ rockchip,pins = ++ /* can1_rx_m1 */ ++ <4 RK_PC7 13 &pcfg_pull_none>, ++ /* can1_tx_m1 */ ++ <4 RK_PC6 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can1m2_pins: can1m2-pins { ++ rockchip,pins = ++ /* can1_rx_m2 */ ++ <4 RK_PB4 13 &pcfg_pull_none>, ++ /* can1_tx_m2 */ ++ <4 RK_PB5 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ can1m3_pins: can1m3-pins { ++ rockchip,pins = ++ /* can1_rx_m3 */ ++ <3 RK_PA3 11 &pcfg_pull_none>, ++ /* can1_tx_m3 */ ++ <3 RK_PA2 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ clk0_32k { ++ /omit-if-no-ref/ ++ clk0_32k_pins: clk0_32k-pins { ++ rockchip,pins = ++ /* clk0_32k_out */ ++ <0 RK_PA2 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ clk1_32k { ++ /omit-if-no-ref/ ++ clk1_32k_pins: clk1_32k-pins { ++ rockchip,pins = ++ /* clk1_32k_out */ ++ <1 RK_PD5 13 &pcfg_pull_none>; ++ }; ++ }; ++ ++ clk_32k { ++ /omit-if-no-ref/ ++ clk_32k_pins: clk_32k-pins { ++ rockchip,pins = ++ /* clk_32k_in */ ++ <0 RK_PA2 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ cpubig { ++ /omit-if-no-ref/ ++ cpubig_pins: cpubig-pins { ++ rockchip,pins = ++ /* cpubig_avs */ ++ <0 RK_PD2 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ cpulit { ++ /omit-if-no-ref/ ++ cpulit_pins: cpulit-pins { ++ rockchip,pins = ++ /* cpulit_avs */ ++ <0 RK_PC0 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug0_test { ++ /omit-if-no-ref/ ++ debug0_test_pins: debug0_test-pins { ++ rockchip,pins = ++ /* debug0_test_out */ ++ <1 RK_PC4 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug1_test { ++ /omit-if-no-ref/ ++ debug1_test_pins: debug1_test-pins { ++ rockchip,pins = ++ /* debug1_test_out */ ++ <1 RK_PC5 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug2_test { ++ /omit-if-no-ref/ ++ debug2_test_pins: debug2_test-pins { ++ rockchip,pins = ++ /* debug2_test_out */ ++ <1 RK_PC6 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug3_test { ++ /omit-if-no-ref/ ++ debug3_test_pins: debug3_test-pins { ++ rockchip,pins = ++ /* debug3_test_out */ ++ <1 RK_PC7 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug4_test { ++ /omit-if-no-ref/ ++ debug4_test_pins: debug4_test-pins { ++ rockchip,pins = ++ /* debug4_test_out */ ++ <1 RK_PD0 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug5_test { ++ /omit-if-no-ref/ ++ debug5_test_pins: debug5_test-pins { ++ rockchip,pins = ++ /* debug5_test_out */ ++ <1 RK_PD1 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug6_test { ++ /omit-if-no-ref/ ++ debug6_test_pins: debug6_test-pins { ++ rockchip,pins = ++ /* debug6_test_out */ ++ <1 RK_PD2 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ debug7_test { ++ /omit-if-no-ref/ ++ debug7_test_pins: debug7_test-pins { ++ rockchip,pins = ++ /* debug7_test_out */ ++ <1 RK_PD3 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ dp { ++ /omit-if-no-ref/ ++ dpm0_pins: dpm0-pins { ++ rockchip,pins = ++ /* dp_hpdin_m0 */ ++ <4 RK_PC4 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dpm1_pins: dpm1-pins { ++ rockchip,pins = ++ /* dp_hpdin_m1 */ ++ <0 RK_PC5 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ dsm_aud { ++ /omit-if-no-ref/ ++ dsm_audm0_ln: dsm_audm0-ln { ++ rockchip,pins = ++ /* dsm_aud_ln_m0 */ ++ <2 RK_PA1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm0_lp: dsm_audm0-lp { ++ rockchip,pins = ++ /* dsm_aud_lp_m0 */ ++ <2 RK_PA0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm0_rn: dsm_audm0-rn { ++ rockchip,pins = ++ /* dsm_aud_rn_m0 */ ++ <2 RK_PA3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm0_rp: dsm_audm0-rp { ++ rockchip,pins = ++ /* dsm_aud_rp_m0 */ ++ <2 RK_PA2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm1_ln: dsm_audm1-ln { ++ rockchip,pins = ++ /* dsm_aud_ln_m1 */ ++ <4 RK_PC1 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm1_lp: dsm_audm1-lp { ++ rockchip,pins = ++ /* dsm_aud_lp_m1 */ ++ <4 RK_PC0 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm1_rn: dsm_audm1-rn { ++ rockchip,pins = ++ /* dsm_aud_rn_m1 */ ++ <4 RK_PC3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ dsm_audm1_rp: dsm_audm1-rp { ++ rockchip,pins = ++ /* dsm_aud_rp_m1 */ ++ <4 RK_PC2 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ dsmc { ++ /omit-if-no-ref/ ++ dsmc_clkn: dsmc-clkn { ++ rockchip,pins = ++ /* dsmc_clkn */ ++ <3 RK_PD6 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_clkp: dsmc-clkp { ++ rockchip,pins = ++ /* dsmc_clkp */ ++ <3 RK_PD5 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_csn0: dsmc-csn0 { ++ rockchip,pins = ++ /* dsmc_csn0 */ ++ <3 RK_PD3 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_csn1: dsmc-csn1 { ++ rockchip,pins = ++ /* dsmc_csn1 */ ++ <3 RK_PB0 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_csn2: dsmc-csn2 { ++ rockchip,pins = ++ /* dsmc_csn2 */ ++ <3 RK_PD1 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_csn3: dsmc-csn3 { ++ rockchip,pins = ++ /* dsmc_csn3 */ ++ <3 RK_PD2 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data0: dsmc-data0 { ++ rockchip,pins = ++ /* dsmc_data0 */ ++ <3 RK_PD4 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data1: dsmc-data1 { ++ rockchip,pins = ++ /* dsmc_data1 */ ++ <3 RK_PD0 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data2: dsmc-data2 { ++ rockchip,pins = ++ /* dsmc_data2 */ ++ <3 RK_PC7 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data3: dsmc-data3 { ++ rockchip,pins = ++ /* dsmc_data3 */ ++ <3 RK_PC6 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data4: dsmc-data4 { ++ rockchip,pins = ++ /* dsmc_data4 */ ++ <3 RK_PC5 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data5: dsmc-data5 { ++ rockchip,pins = ++ /* dsmc_data5 */ ++ <3 RK_PC4 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data6: dsmc-data6 { ++ rockchip,pins = ++ /* dsmc_data6 */ ++ <3 RK_PC1 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data7: dsmc-data7 { ++ rockchip,pins = ++ /* dsmc_data7 */ ++ <3 RK_PC0 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data8: dsmc-data8 { ++ rockchip,pins = ++ /* dsmc_data8 */ ++ <3 RK_PB5 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data9: dsmc-data9 { ++ rockchip,pins = ++ /* dsmc_data9 */ ++ <3 RK_PB4 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data10: dsmc-data10 { ++ rockchip,pins = ++ /* dsmc_data10 */ ++ <3 RK_PB3 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data11: dsmc-data11 { ++ rockchip,pins = ++ /* dsmc_data11 */ ++ <3 RK_PB2 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data12: dsmc-data12 { ++ rockchip,pins = ++ /* dsmc_data12 */ ++ <3 RK_PB1 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data13: dsmc-data13 { ++ rockchip,pins = ++ /* dsmc_data13 */ ++ <3 RK_PA7 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data14: dsmc-data14 { ++ rockchip,pins = ++ /* dsmc_data14 */ ++ <3 RK_PA6 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_data15: dsmc-data15 { ++ rockchip,pins = ++ /* dsmc_data15 */ ++ <3 RK_PA5 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_dqs0: dsmc-dqs0 { ++ rockchip,pins = ++ /* dsmc_dqs0 */ ++ <3 RK_PB7 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_dqs1: dsmc-dqs1 { ++ rockchip,pins = ++ /* dsmc_dqs1 */ ++ <3 RK_PB6 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_int0: dsmc-int0 { ++ rockchip,pins = ++ /* dsmc_int0 */ ++ <4 RK_PA0 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_int1: dsmc-int1 { ++ rockchip,pins = ++ /* dsmc_int1 */ ++ <3 RK_PC2 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_int2: dsmc-int2 { ++ rockchip,pins = ++ /* dsmc_int2 */ ++ <4 RK_PA1 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_int3: dsmc-int3 { ++ rockchip,pins = ++ /* dsmc_int3 */ ++ <3 RK_PC3 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_rdyn: dsmc-rdyn { ++ rockchip,pins = ++ /* dsmc_rdyn */ ++ <3 RK_PA4 5 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ dsmc_resetn: dsmc-resetn { ++ rockchip,pins = ++ /* dsmc_resetn */ ++ <3 RK_PD7 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ dsmc_testclk { ++ /omit-if-no-ref/ ++ dsmc_testclk_out: dsmc-testclk-out { ++ rockchip,pins = ++ /* dsmc_testclk_out */ ++ <3 RK_PC2 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ dsmc_testdata { ++ /omit-if-no-ref/ ++ dsmc_testdata_out: dsmc-testdata-out { ++ rockchip,pins = ++ /* dsmc_testdata_out */ ++ <3 RK_PC3 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ edp_tx { ++ /omit-if-no-ref/ ++ edp_txm0_pins: edp_txm0-pins { ++ rockchip,pins = ++ /* edp_tx_hpdin_m0 */ ++ <4 RK_PC1 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ edp_txm1_pins: edp_txm1-pins { ++ rockchip,pins = ++ /* edp_tx_hpdin_m1 */ ++ <0 RK_PB6 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ emmc { ++ /omit-if-no-ref/ ++ emmc_rstnout: emmc-rstnout { ++ rockchip,pins = ++ /* emmc_rstn */ ++ <1 RK_PB3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ emmc_bus8: emmc-bus8 { ++ rockchip,pins = ++ /* emmc_d0 */ ++ <1 RK_PA0 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d1 */ ++ <1 RK_PA1 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d2 */ ++ <1 RK_PA2 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d3 */ ++ <1 RK_PA3 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d4 */ ++ <1 RK_PA4 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d5 */ ++ <1 RK_PA5 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d6 */ ++ <1 RK_PA6 1 &pcfg_pull_up_drv_level_2>, ++ /* emmc_d7 */ ++ <1 RK_PA7 1 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ emmc_clk: emmc-clk { ++ rockchip,pins = ++ /* emmc_clk */ ++ <1 RK_PB1 1 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ emmc_cmd: emmc-cmd { ++ rockchip,pins = ++ /* emmc_cmd */ ++ <1 RK_PB0 1 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ emmc_strb: emmc-strb { ++ rockchip,pins = ++ /* emmc_strb */ ++ <1 RK_PB2 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ emmc_testclk { ++ /omit-if-no-ref/ ++ emmc_testclk_test: emmc_testclk-test { ++ rockchip,pins = ++ /* emmc_testclk_out */ ++ <1 RK_PB3 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ emmc_testdata { ++ /omit-if-no-ref/ ++ emmc_testdata_test: emmc_testdata-test { ++ rockchip,pins = ++ /* emmc_testdata_out */ ++ <1 RK_PB7 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth0 { ++ /omit-if-no-ref/ ++ eth0m0_miim: eth0m0-miim { ++ rockchip,pins = ++ /* eth0_mdc_m0 */ ++ <3 RK_PA6 3 &pcfg_pull_none>, ++ /* eth0_mdio_m0 */ ++ <3 RK_PA5 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m0_rx_bus2: eth0m0-rx_bus2 { ++ rockchip,pins = ++ /* eth0_rxctl_m0 */ ++ <3 RK_PA7 3 &pcfg_pull_none>, ++ /* eth0_rxd0_m0 */ ++ <3 RK_PB2 3 &pcfg_pull_none>, ++ /* eth0_rxd1_m0 */ ++ <3 RK_PB1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m0_tx_bus2: eth0m0-tx_bus2 { ++ rockchip,pins = ++ /* eth0_txctl_m0 */ ++ <3 RK_PB3 3 &pcfg_pull_none>, ++ /* eth0_txd0_m0 */ ++ <3 RK_PB5 3 &pcfg_pull_none>, ++ /* eth0_txd1_m0 */ ++ <3 RK_PB4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m0_rgmii_clk: eth0m0-rgmii_clk { ++ rockchip,pins = ++ /* eth0_rxclk_m0 */ ++ <3 RK_PD1 3 &pcfg_pull_none>, ++ /* eth0_txclk_m0 */ ++ <3 RK_PB6 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m0_rgmii_bus: eth0m0-rgmii_bus { ++ rockchip,pins = ++ /* eth0_rxd2_m0 */ ++ <3 RK_PD3 3 &pcfg_pull_none>, ++ /* eth0_rxd3_m0 */ ++ <3 RK_PD2 3 &pcfg_pull_none>, ++ /* eth0_txd2_m0 */ ++ <3 RK_PC3 3 &pcfg_pull_none>, ++ /* eth0_txd3_m0 */ ++ <3 RK_PC2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m0_mclk: eth0m0-mclk { ++ rockchip,pins = ++ /* eth0m0_mclk */ ++ <3 RK_PB0 3 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth0m0_ppsclk: eth0m0-ppsclk { ++ rockchip,pins = ++ /* eth0m0_ppsclk */ ++ <3 RK_PC0 3 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth0m0_ppstrig: eth0m0-ppstrig { ++ rockchip,pins = ++ /* eth0m0_ppstrig */ ++ <3 RK_PB7 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_miim: eth0m1-miim { ++ rockchip,pins = ++ /* eth0_mdc_m1 */ ++ <3 RK_PA1 3 &pcfg_pull_none>, ++ /* eth0_mdio_m1 */ ++ <3 RK_PA0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_rx_bus2: eth0m1-rx_bus2 { ++ rockchip,pins = ++ /* eth0_rxctl_m1 */ ++ <3 RK_PA2 3 &pcfg_pull_none>, ++ /* eth0_rxd0_m1 */ ++ <2 RK_PA6 3 &pcfg_pull_none>, ++ /* eth0_rxd1_m1 */ ++ <3 RK_PA3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_tx_bus2: eth0m1-tx_bus2 { ++ rockchip,pins = ++ /* eth0_txctl_m1 */ ++ <2 RK_PA7 3 &pcfg_pull_none>, ++ /* eth0_txd0_m1 */ ++ <2 RK_PB1 3 &pcfg_pull_none>, ++ /* eth0_txd1_m1 */ ++ <2 RK_PB0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_rgmii_clk: eth0m1-rgmii_clk { ++ rockchip,pins = ++ /* eth0_rxclk_m1 */ ++ <2 RK_PB5 3 &pcfg_pull_none>, ++ /* eth0_txclk_m1 */ ++ <2 RK_PB3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_rgmii_bus: eth0m1-rgmii_bus { ++ rockchip,pins = ++ /* eth0_rxd2_m1 */ ++ <2 RK_PB7 3 &pcfg_pull_none>, ++ /* eth0_rxd3_m1 */ ++ <2 RK_PB6 3 &pcfg_pull_none>, ++ /* eth0_txd2_m1 */ ++ <2 RK_PB4 3 &pcfg_pull_none>, ++ /* eth0_txd3_m1 */ ++ <2 RK_PB2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_mclk: eth0m1-mclk { ++ rockchip,pins = ++ /* eth0m1_mclk */ ++ <2 RK_PD6 3 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth0m1_ppsclk: eth0m1-ppsclk { ++ rockchip,pins = ++ /* eth0m1_ppsclk */ ++ <2 RK_PC1 3 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth0m1_ppstrig: eth0m1-ppstrig { ++ rockchip,pins = ++ /* eth0m1_ppstrig */ ++ <2 RK_PC2 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth1 { ++ /omit-if-no-ref/ ++ eth1m0_miim: eth1m0-miim { ++ rockchip,pins = ++ /* eth1_mdc_m0 */ ++ <2 RK_PD4 2 &pcfg_pull_none>, ++ /* eth1_mdio_m0 */ ++ <2 RK_PD5 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m0_rx_bus2: eth1m0-rx_bus2 { ++ rockchip,pins = ++ /* eth1_rxctl_m0 */ ++ <2 RK_PD3 2 &pcfg_pull_none>, ++ /* eth1_rxd0_m0 */ ++ <2 RK_PD1 2 &pcfg_pull_none>, ++ /* eth1_rxd1_m0 */ ++ <2 RK_PD2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m0_tx_bus2: eth1m0-tx_bus2 { ++ rockchip,pins = ++ /* eth1_txctl_m0 */ ++ <2 RK_PD0 2 &pcfg_pull_none>, ++ /* eth1_txd0_m0 */ ++ <2 RK_PC6 2 &pcfg_pull_none>, ++ /* eth1_txd1_m0 */ ++ <2 RK_PC7 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m0_rgmii_clk: eth1m0-rgmii_clk { ++ rockchip,pins = ++ /* eth1_rxclk_m0 */ ++ <2 RK_PC2 2 &pcfg_pull_none>, ++ /* eth1_txclk_m0 */ ++ <2 RK_PC5 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m0_rgmii_bus: eth1m0-rgmii_bus { ++ rockchip,pins = ++ /* eth1_rxd2_m0 */ ++ <2 RK_PC0 2 &pcfg_pull_none>, ++ /* eth1_rxd3_m0 */ ++ <2 RK_PC1 2 &pcfg_pull_none>, ++ /* eth1_txd2_m0 */ ++ <2 RK_PC3 2 &pcfg_pull_none>, ++ /* eth1_txd3_m0 */ ++ <2 RK_PC4 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m0_mclk: eth1m0-mclk { ++ rockchip,pins = ++ /* eth1m0_mclk */ ++ <2 RK_PD7 2 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth1m0_ppsclk: eth1m0-ppsclk { ++ rockchip,pins = ++ /* eth1m0_ppsclk */ ++ <3 RK_PA2 2 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth1m0_ppstrig: eth1m0-ppstrig { ++ rockchip,pins = ++ /* eth1m0_ppstrig */ ++ <3 RK_PA1 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_miim: eth1m1-miim { ++ rockchip,pins = ++ /* eth1_mdc_m1 */ ++ <1 RK_PD2 1 &pcfg_pull_none>, ++ /* eth1_mdio_m1 */ ++ <1 RK_PD3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_rx_bus2: eth1m1-rx_bus2 { ++ rockchip,pins = ++ /* eth1_rxctl_m1 */ ++ <1 RK_PD1 1 &pcfg_pull_none>, ++ /* eth1_rxd0_m1 */ ++ <1 RK_PC7 1 &pcfg_pull_none>, ++ /* eth1_rxd1_m1 */ ++ <1 RK_PD0 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_tx_bus2: eth1m1-tx_bus2 { ++ rockchip,pins = ++ /* eth1_txctl_m1 */ ++ <1 RK_PC6 1 &pcfg_pull_none>, ++ /* eth1_txd0_m1 */ ++ <1 RK_PC4 1 &pcfg_pull_none>, ++ /* eth1_txd1_m1 */ ++ <1 RK_PC5 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_rgmii_clk: eth1m1-rgmii_clk { ++ rockchip,pins = ++ /* eth1_rxclk_m1 */ ++ <1 RK_PB6 1 &pcfg_pull_none>, ++ /* eth1_txclk_m1 */ ++ <1 RK_PC1 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_rgmii_bus: eth1m1-rgmii_bus { ++ rockchip,pins = ++ /* eth1_rxd2_m1 */ ++ <1 RK_PB4 1 &pcfg_pull_none>, ++ /* eth1_rxd3_m1 */ ++ <1 RK_PB5 1 &pcfg_pull_none>, ++ /* eth1_txd2_m1 */ ++ <1 RK_PB7 1 &pcfg_pull_none>, ++ /* eth1_txd3_m1 */ ++ <1 RK_PC0 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_mclk: eth1m1-mclk { ++ rockchip,pins = ++ /* eth1m1_mclk */ ++ <1 RK_PD4 1 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth1m1_ppsclk: eth1m1-ppsclk { ++ rockchip,pins = ++ /* eth1m1_ppsclk */ ++ <1 RK_PC2 1 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ eth1m1_ppstrig: eth1m1-ppstrig { ++ rockchip,pins = ++ /* eth1m1_ppstrig */ ++ <1 RK_PC3 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth0_ptp { ++ /omit-if-no-ref/ ++ eth0m0_ptp_refclk: eth0m0-ptp-refclk { ++ rockchip,pins = ++ /* eth0m0_ptp_refclk */ ++ <3 RK_PC1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0m1_ptp_refclk: eth0m1-ptp-refclk { ++ rockchip,pins = ++ /* eth0m1_ptp_refclk */ ++ <2 RK_PC0 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth0_testrxclk { ++ /omit-if-no-ref/ ++ eth0_testrxclkm0_test: eth0_testrxclkm0-test { ++ rockchip,pins = ++ /* eth0_testrxclk_out_m0 */ ++ <3 RK_PC7 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0_testrxclkm1_test: eth0_testrxclkm1-test { ++ rockchip,pins = ++ /* eth0_testrxclk_out_m1 */ ++ <2 RK_PC5 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth0_testrxd { ++ /omit-if-no-ref/ ++ eth0_testrxdm0_test: eth0_testrxdm0-test { ++ rockchip,pins = ++ /* eth0_testrxd_out_m0 */ ++ <3 RK_PD0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth0_testrxdm1_test: eth0_testrxdm1-test { ++ rockchip,pins = ++ /* eth0_testrxd_out_m1 */ ++ <2 RK_PC4 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth1_ptp { ++ /omit-if-no-ref/ ++ eth1m0_ptp_refclk: eth1m0-ptp-refclk { ++ rockchip,pins = ++ /* eth1m0_ptp_refclk */ ++ <3 RK_PA3 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1m1_ptp_refclk: eth1m1-ptp-refclk { ++ rockchip,pins = ++ /* eth1m1_ptp_refclk */ ++ <2 RK_PB6 2 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth1_testrxclk { ++ /omit-if-no-ref/ ++ eth1_testrxclkm0_test: eth1_testrxclkm0-test { ++ rockchip,pins = ++ /* eth1_testrxclk_out_m0 */ ++ <3 RK_PA1 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1_testrxclkm1_test: eth1_testrxclkm1-test { ++ rockchip,pins = ++ /* eth1_testrxclk_out_m1 */ ++ <1 RK_PC3 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth1_testrxd { ++ /omit-if-no-ref/ ++ eth1_testrxdm0_test: eth1_testrxdm0-test { ++ rockchip,pins = ++ /* eth1_testrxd_out_m0 */ ++ <3 RK_PA0 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ eth1_testrxdm1_test: eth1_testrxdm1-test { ++ rockchip,pins = ++ /* eth1_testrxd_out_m1 */ ++ <1 RK_PC2 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth_clk0_25m { ++ /omit-if-no-ref/ ++ ethm0_clk0_25m_out: ethm0-clk0-25m-out { ++ rockchip,pins = ++ /* ethm0_clk0_25m_out */ ++ <3 RK_PA4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ ethm1_clk0_25m_out: ethm1-clk0-25m-out { ++ rockchip,pins = ++ /* ethm1_clk0_25m_out */ ++ <2 RK_PD7 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ eth_clk1_25m { ++ /omit-if-no-ref/ ++ ethm0_clk1_25m_out: ethm0-clk1-25m-out { ++ rockchip,pins = ++ /* ethm0_clk1_25m_out */ ++ <2 RK_PD6 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ ethm1_clk1_25m_out: ethm1-clk1-25m-out { ++ rockchip,pins = ++ /* ethm1_clk1_25m_out */ ++ <1 RK_PD5 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus0 { ++ /omit-if-no-ref/ ++ flexbus0m0_csn: flexbus0m0-csn { ++ rockchip,pins = ++ /* flexbus0_csn_m0 */ ++ <3 RK_PA4 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m0_d13: flexbus0m0-d13 { ++ rockchip,pins = ++ /* flexbus0_d13_m0 */ ++ <4 RK_PA0 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m0_d14: flexbus0m0-d14 { ++ rockchip,pins = ++ /* flexbus0_d14_m0 */ ++ <4 RK_PA1 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m0_d15: flexbus0m0-d15 { ++ rockchip,pins = ++ /* flexbus0_d15_m0 */ ++ <3 RK_PD7 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m1_csn: flexbus0m1-csn { ++ rockchip,pins = ++ /* flexbus0_csn_m1 */ ++ <4 RK_PA1 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m1_d13: flexbus0m1-d13 { ++ rockchip,pins = ++ /* flexbus0_d13_m1 */ ++ <4 RK_PA4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m1_d14: flexbus0m1-d14 { ++ rockchip,pins = ++ /* flexbus0_d14_m1 */ ++ <4 RK_PA6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m1_d15: flexbus0m1-d15 { ++ rockchip,pins = ++ /* flexbus0_d15_m1 */ ++ <4 RK_PB5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m2_csn: flexbus0m2-csn { ++ rockchip,pins = ++ /* flexbus0_csn_m2 */ ++ <3 RK_PC3 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m3_csn: flexbus0m3-csn { ++ rockchip,pins = ++ /* flexbus0_csn_m3 */ ++ <3 RK_PD2 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0m4_csn: flexbus0m4-csn { ++ rockchip,pins = ++ /* flexbus0_csn_m4 */ ++ <4 RK_PB4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_clk: flexbus0-clk { ++ rockchip,pins = ++ /* flexbus0_clk */ ++ <3 RK_PB6 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d10: flexbus0-d10 { ++ rockchip,pins = ++ /* flexbus0_d10 */ ++ <3 RK_PC3 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d11: flexbus0-d11 { ++ rockchip,pins = ++ /* flexbus0_d11 */ ++ <3 RK_PD1 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d12: flexbus0-d12 { ++ rockchip,pins = ++ /* flexbus0_d12 */ ++ <3 RK_PD2 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d0: flexbus0-d0 { ++ rockchip,pins = ++ /* flexbus0_d0 */ ++ <3 RK_PB5 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d1: flexbus0-d1 { ++ rockchip,pins = ++ /* flexbus0_d1 */ ++ <3 RK_PB4 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d2: flexbus0-d2 { ++ rockchip,pins = ++ /* flexbus0_d2 */ ++ <3 RK_PB3 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d3: flexbus0-d3 { ++ rockchip,pins = ++ /* flexbus0_d3 */ ++ <3 RK_PB2 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d4: flexbus0-d4 { ++ rockchip,pins = ++ /* flexbus0_d4 */ ++ <3 RK_PB1 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d5: flexbus0-d5 { ++ rockchip,pins = ++ /* flexbus0_d5 */ ++ <3 RK_PA7 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d6: flexbus0-d6 { ++ rockchip,pins = ++ /* flexbus0_d6 */ ++ <3 RK_PA6 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d7: flexbus0-d7 { ++ rockchip,pins = ++ /* flexbus0_d7 */ ++ <3 RK_PA5 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d8: flexbus0-d8 { ++ rockchip,pins = ++ /* flexbus0_d8 */ ++ <3 RK_PB0 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus0_d9: flexbus0-d9 { ++ rockchip,pins = ++ /* flexbus0_d9 */ ++ <3 RK_PC2 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus1 { ++ /omit-if-no-ref/ ++ flexbus1m0_csn: flexbus1m0-csn { ++ rockchip,pins = ++ /* flexbus1_csn_m0 */ ++ <3 RK_PB7 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m0_d12: flexbus1m0-d12 { ++ rockchip,pins = ++ /* flexbus1_d12_m0 */ ++ <3 RK_PD7 7 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m0_d13: flexbus1m0-d13 { ++ rockchip,pins = ++ /* flexbus1_d13_m0 */ ++ <4 RK_PA1 7 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m0_d14: flexbus1m0-d14 { ++ rockchip,pins = ++ /* flexbus1_d14_m0 */ ++ <4 RK_PA0 7 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m0_d15: flexbus1m0-d15 { ++ rockchip,pins = ++ /* flexbus1_d15_m0 */ ++ <3 RK_PD2 7 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m1_csn: flexbus1m1-csn { ++ rockchip,pins = ++ /* flexbus1_csn_m1 */ ++ <3 RK_PD7 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m1_d12: flexbus1m1-d12 { ++ rockchip,pins = ++ /* flexbus1_d12_m1 */ ++ <4 RK_PA5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m1_d13: flexbus1m1-d13 { ++ rockchip,pins = ++ /* flexbus1_d13_m1 */ ++ <4 RK_PB0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m1_d14: flexbus1m1-d14 { ++ rockchip,pins = ++ /* flexbus1_d14_m1 */ ++ <4 RK_PB1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m1_d15: flexbus1m1-d15 { ++ rockchip,pins = ++ /* flexbus1_d15_m1 */ ++ <4 RK_PB2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m2_csn: flexbus1m2-csn { ++ rockchip,pins = ++ /* flexbus1_csn_m2 */ ++ <3 RK_PD1 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m3_csn: flexbus1m3-csn { ++ rockchip,pins = ++ /* flexbus1_csn_m3 */ ++ <4 RK_PA0 8 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1m4_csn: flexbus1m4-csn { ++ rockchip,pins = ++ /* flexbus1_csn_m4 */ ++ <4 RK_PA3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_clk: flexbus1-clk { ++ rockchip,pins = ++ /* flexbus1_clk */ ++ <3 RK_PD6 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d10: flexbus1-d10 { ++ rockchip,pins = ++ /* flexbus1_d10 */ ++ <3 RK_PB7 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d11: flexbus1-d11 { ++ rockchip,pins = ++ /* flexbus1_d11 */ ++ <3 RK_PA4 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d0: flexbus1-d0 { ++ rockchip,pins = ++ /* flexbus1_d0 */ ++ <3 RK_PD5 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d1: flexbus1-d1 { ++ rockchip,pins = ++ /* flexbus1_d1 */ ++ <3 RK_PD4 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d2: flexbus1-d2 { ++ rockchip,pins = ++ /* flexbus1_d2 */ ++ <3 RK_PD3 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d3: flexbus1-d3 { ++ rockchip,pins = ++ /* flexbus1_d3 */ ++ <3 RK_PD0 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d4: flexbus1-d4 { ++ rockchip,pins = ++ /* flexbus1_d4 */ ++ <3 RK_PC7 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d5: flexbus1-d5 { ++ rockchip,pins = ++ /* flexbus1_d5 */ ++ <3 RK_PC6 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d6: flexbus1-d6 { ++ rockchip,pins = ++ /* flexbus1_d6 */ ++ <3 RK_PC5 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d7: flexbus1-d7 { ++ rockchip,pins = ++ /* flexbus1_d7 */ ++ <3 RK_PC4 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d8: flexbus1-d8 { ++ rockchip,pins = ++ /* flexbus1_d8 */ ++ <3 RK_PC1 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ flexbus1_d9: flexbus1-d9 { ++ rockchip,pins = ++ /* flexbus1_d9 */ ++ <3 RK_PC0 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus0_testclk { ++ /omit-if-no-ref/ ++ flexbus0_testclk_testclk: flexbus0_testclk-testclk { ++ rockchip,pins = ++ /* flexbus0_testclk_out */ ++ <2 RK_PA3 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus0_testdata { ++ /omit-if-no-ref/ ++ flexbus0_testdata_testdata: flexbus0_testdata-testdata { ++ rockchip,pins = ++ /* flexbus0_testdata_out */ ++ <2 RK_PA2 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus1_testclk { ++ /omit-if-no-ref/ ++ flexbus1_testclk_testclk: flexbus1_testclk-testclk { ++ rockchip,pins = ++ /* flexbus1_testclk_out */ ++ <2 RK_PA5 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ flexbus1_testdata { ++ /omit-if-no-ref/ ++ flexbus1_testdata_testdata: flexbus1_testdata-testdata { ++ rockchip,pins = ++ /* flexbus1_testdata_out */ ++ <2 RK_PA4 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi0 { ++ /omit-if-no-ref/ ++ fspi0_pins: fspi0-pins { ++ rockchip,pins = ++ /* fspi0_clk */ ++ <1 RK_PB1 2 &pcfg_pull_none>, ++ /* fspi0_d0 */ ++ <1 RK_PA0 2 &pcfg_pull_none>, ++ /* fspi0_d1 */ ++ <1 RK_PA1 2 &pcfg_pull_none>, ++ /* fspi0_d2 */ ++ <1 RK_PA2 2 &pcfg_pull_none>, ++ /* fspi0_d3 */ ++ <1 RK_PA3 2 &pcfg_pull_none>, ++ /* fspi0_d4 */ ++ <1 RK_PA4 2 &pcfg_pull_none>, ++ /* fspi0_d5 */ ++ <1 RK_PA5 2 &pcfg_pull_none>, ++ /* fspi0_d6 */ ++ <1 RK_PA6 2 &pcfg_pull_none>, ++ /* fspi0_d7 */ ++ <1 RK_PA7 2 &pcfg_pull_none>, ++ /* fspi0_dqs */ ++ <1 RK_PB2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ fspi0_csn0: fspi0-csn0 { ++ rockchip,pins = ++ /* fspi0_csn0 */ ++ <1 RK_PB3 2 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ fspi0_csn1: fspi0-csn1 { ++ rockchip,pins = ++ /* fspi0_csn1 */ ++ <1 RK_PB0 2 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi1 { ++ /omit-if-no-ref/ ++ fspi1m0_pins: fspi1m0-pins { ++ rockchip,pins = ++ /* fspi1_clk_m0 */ ++ <2 RK_PA5 2 &pcfg_pull_none>, ++ /* fspi1_d0_m0 */ ++ <2 RK_PA0 2 &pcfg_pull_none>, ++ /* fspi1_d1_m0 */ ++ <2 RK_PA1 2 &pcfg_pull_none>, ++ /* fspi1_d2_m0 */ ++ <2 RK_PA2 2 &pcfg_pull_none>, ++ /* fspi1_d3_m0 */ ++ <2 RK_PA3 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ fspi1m0_csn0: fspi1m0-csn0 { ++ rockchip,pins = ++ /* fspi1m0_csn0 */ ++ <2 RK_PA4 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ fspi1m1_pins: fspi1m1-pins { ++ rockchip,pins = ++ /* fspi1_clk_m1 */ ++ <1 RK_PD5 3 &pcfg_pull_none>, ++ /* fspi1_d0_m1 */ ++ <1 RK_PC4 3 &pcfg_pull_none>, ++ /* fspi1_d1_m1 */ ++ <1 RK_PC5 3 &pcfg_pull_none>, ++ /* fspi1_d2_m1 */ ++ <1 RK_PC6 3 &pcfg_pull_none>, ++ /* fspi1_d3_m1 */ ++ <1 RK_PC7 3 &pcfg_pull_none>, ++ /* fspi1_d4_m1 */ ++ <1 RK_PD0 3 &pcfg_pull_none>, ++ /* fspi1_d5_m1 */ ++ <1 RK_PD1 3 &pcfg_pull_none>, ++ /* fspi1_d6_m1 */ ++ <1 RK_PD2 3 &pcfg_pull_none>, ++ /* fspi1_d7_m1 */ ++ <1 RK_PD3 3 &pcfg_pull_none>, ++ /* fspi1_dqs_m1 */ ++ <1 RK_PD4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ fspi1m1_csn0: fspi1m1-csn0 { ++ rockchip,pins = ++ /* fspi1m1_csn0 */ ++ <1 RK_PC3 3 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ fspi1m1_csn1: fspi1m1-csn1 { ++ rockchip,pins = ++ /* fspi1m1_csn1 */ ++ <1 RK_PC2 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi0_testclk { ++ /omit-if-no-ref/ ++ fspi0_testclk_test: fspi0_testclk-test { ++ rockchip,pins = ++ /* fspi0_testclk_out */ ++ <1 RK_PB0 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi0_testdata { ++ /omit-if-no-ref/ ++ fspi0_testdata_test: fspi0_testdata-test { ++ rockchip,pins = ++ /* fspi0_testdata_out */ ++ <1 RK_PB7 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi1_testclk { ++ /omit-if-no-ref/ ++ fspi1_testclkm1_test: fspi1_testclkm1-test { ++ rockchip,pins = ++ /* fspi1_testclk_out_m1 */ ++ <1 RK_PC1 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ fspi1_testdata { ++ /omit-if-no-ref/ ++ fspi1_testdatam1_test: fspi1_testdatam1-test { ++ rockchip,pins = ++ /* fspi1_testdata_out_m1 */ ++ <1 RK_PB7 7 &pcfg_pull_none>; ++ }; ++ }; ++ ++ gpu { ++ /omit-if-no-ref/ ++ gpu_pins: gpu-pins { ++ rockchip,pins = ++ /* gpu_avs */ ++ <0 RK_PD3 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ hdmi_tx { ++ /omit-if-no-ref/ ++ hdmi_txm0_pins: hdmi_txm0-pins { ++ rockchip,pins = ++ /* hdmi_tx_cec_m0 */ ++ <4 RK_PC0 9 &pcfg_pull_none>, ++ /* hdmi_tx_hpdin_m0 */ ++ <4 RK_PC1 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmi_txm1_pins: hdmi_txm1-pins { ++ rockchip,pins = ++ /* hdmi_tx_cec_m1 */ ++ <0 RK_PC3 9 &pcfg_pull_none>, ++ /* hdmi_tx_hpdin_m1 */ ++ <0 RK_PB6 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmi_tx_scl: hdmi-tx-scl { ++ rockchip,pins = ++ /* hdmi_tx_scl */ ++ <4 RK_PC2 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ hdmi_tx_sda: hdmi-tx-sda { ++ rockchip,pins = ++ /* hdmi_tx_sda */ ++ <4 RK_PC3 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ i2c0 { ++ /omit-if-no-ref/ ++ i2c0m0_xfer: i2c0m0-xfer { ++ rockchip,pins = ++ /* i2c0_scl_m0 */ ++ <0 RK_PB0 11 &pcfg_pull_none_smt>, ++ /* i2c0_sda_m0 */ ++ <0 RK_PB1 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c0m1_xfer: i2c0m1-xfer { ++ rockchip,pins = ++ /* i2c0_scl_m1 */ ++ <0 RK_PC1 9 &pcfg_pull_none_smt>, ++ /* i2c0_sda_m1 */ ++ <0 RK_PC2 9 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c1 { ++ /omit-if-no-ref/ ++ i2c1m0_xfer: i2c1m0-xfer { ++ rockchip,pins = ++ /* i2c1_scl_m0 */ ++ <0 RK_PB2 11 &pcfg_pull_none_smt>, ++ /* i2c1_sda_m0 */ ++ <0 RK_PB3 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c1m1_xfer: i2c1m1-xfer { ++ rockchip,pins = ++ /* i2c1_scl_m1 */ ++ <0 RK_PB4 9 &pcfg_pull_none_smt>, ++ /* i2c1_sda_m1 */ ++ <0 RK_PB5 9 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c2 { ++ /omit-if-no-ref/ ++ i2c2m0_xfer: i2c2m0-xfer { ++ rockchip,pins = ++ /* i2c2_scl_m0 */ ++ <0 RK_PB7 9 &pcfg_pull_none_smt>, ++ /* i2c2_sda_m0 */ ++ <0 RK_PC0 9 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c2m1_xfer: i2c2m1-xfer { ++ rockchip,pins = ++ /* i2c2_scl_m1 */ ++ <1 RK_PA0 10 &pcfg_pull_none_smt>, ++ /* i2c2_sda_m1 */ ++ <1 RK_PA1 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c2m2_xfer: i2c2m2-xfer { ++ rockchip,pins = ++ /* i2c2_scl_m2 */ ++ <4 RK_PA3 11 &pcfg_pull_none_smt>, ++ /* i2c2_sda_m2 */ ++ <4 RK_PA5 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c2m3_xfer: i2c2m3-xfer { ++ rockchip,pins = ++ /* i2c2_scl_m3 */ ++ <4 RK_PC2 11 &pcfg_pull_none_smt>, ++ /* i2c2_sda_m3 */ ++ <4 RK_PC3 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c3 { ++ /omit-if-no-ref/ ++ i2c3m0_xfer: i2c3m0-xfer { ++ rockchip,pins = ++ /* i2c3_scl_m0 */ ++ <4 RK_PB5 11 &pcfg_pull_none_smt>, ++ /* i2c3_sda_m0 */ ++ <4 RK_PB4 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c3m1_xfer: i2c3m1-xfer { ++ rockchip,pins = ++ /* i2c3_scl_m1 */ ++ <0 RK_PC6 9 &pcfg_pull_none_smt>, ++ /* i2c3_sda_m1 */ ++ <0 RK_PC7 9 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c3m2_xfer: i2c3m2-xfer { ++ rockchip,pins = ++ /* i2c3_scl_m2 */ ++ <3 RK_PD4 11 &pcfg_pull_none_smt>, ++ /* i2c3_sda_m2 */ ++ <3 RK_PD5 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c3m3_xfer: i2c3m3-xfer { ++ rockchip,pins = ++ /* i2c3_scl_m3 */ ++ <4 RK_PC4 11 &pcfg_pull_none_smt>, ++ /* i2c3_sda_m3 */ ++ <4 RK_PC5 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c4 { ++ /omit-if-no-ref/ ++ i2c4m0_xfer: i2c4m0-xfer { ++ rockchip,pins = ++ /* i2c4_scl_m0 */ ++ <0 RK_PD2 9 &pcfg_pull_none_smt>, ++ /* i2c4_sda_m0 */ ++ <0 RK_PD3 9 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c4m1_xfer: i2c4m1-xfer { ++ rockchip,pins = ++ /* i2c4_scl_m1 */ ++ <4 RK_PA4 11 &pcfg_pull_none_smt>, ++ /* i2c4_sda_m1 */ ++ <4 RK_PA6 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c4m2_xfer: i2c4m2-xfer { ++ rockchip,pins = ++ /* i2c4_scl_m2 */ ++ <2 RK_PA6 11 &pcfg_pull_none_smt>, ++ /* i2c4_sda_m2 */ ++ <2 RK_PA7 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c4m3_xfer: i2c4m3-xfer { ++ rockchip,pins = ++ /* i2c4_scl_m3 */ ++ <3 RK_PC0 11 &pcfg_pull_none_smt>, ++ /* i2c4_sda_m3 */ ++ <3 RK_PB7 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c5 { ++ /omit-if-no-ref/ ++ i2c5m0_xfer: i2c5m0-xfer { ++ rockchip,pins = ++ /* i2c5_scl_m0 */ ++ <2 RK_PA5 11 &pcfg_pull_none_smt>, ++ /* i2c5_sda_m0 */ ++ <2 RK_PA4 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c5m1_xfer: i2c5m1-xfer { ++ rockchip,pins = ++ /* i2c5_scl_m1 */ ++ <1 RK_PD4 10 &pcfg_pull_none_smt>, ++ /* i2c5_sda_m1 */ ++ <1 RK_PD5 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c5m2_xfer: i2c5m2-xfer { ++ rockchip,pins = ++ /* i2c5_scl_m2 */ ++ <2 RK_PC6 11 &pcfg_pull_none_smt>, ++ /* i2c5_sda_m2 */ ++ <2 RK_PC7 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c5m3_xfer: i2c5m3-xfer { ++ rockchip,pins = ++ /* i2c5_scl_m3 */ ++ <3 RK_PC4 11 &pcfg_pull_none_smt>, ++ /* i2c5_sda_m3 */ ++ <3 RK_PC1 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c6 { ++ /omit-if-no-ref/ ++ i2c6m0_xfer: i2c6m0-xfer { ++ rockchip,pins = ++ /* i2c6_scl_m0 */ ++ <0 RK_PA2 11 &pcfg_pull_none_smt>, ++ /* i2c6_sda_m0 */ ++ <0 RK_PA5 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c6m1_xfer: i2c6m1-xfer { ++ rockchip,pins = ++ /* i2c6_scl_m1 */ ++ <1 RK_PC2 10 &pcfg_pull_none_smt>, ++ /* i2c6_sda_m1 */ ++ <1 RK_PC3 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c6m2_xfer: i2c6m2-xfer { ++ rockchip,pins = ++ /* i2c6_scl_m2 */ ++ <2 RK_PD0 11 &pcfg_pull_none_smt>, ++ /* i2c6_sda_m2 */ ++ <2 RK_PD1 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c6m3_xfer: i2c6m3-xfer { ++ rockchip,pins = ++ /* i2c6_scl_m3 */ ++ <4 RK_PC6 11 &pcfg_pull_none_smt>, ++ /* i2c6_sda_m3 */ ++ <4 RK_PC7 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c7 { ++ /omit-if-no-ref/ ++ i2c7m0_xfer: i2c7m0-xfer { ++ rockchip,pins = ++ /* i2c7_scl_m0 */ ++ <1 RK_PB0 10 &pcfg_pull_none_smt>, ++ /* i2c7_sda_m0 */ ++ <1 RK_PB3 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c7m1_xfer: i2c7m1-xfer { ++ rockchip,pins = ++ /* i2c7_scl_m1 */ ++ <3 RK_PA0 11 &pcfg_pull_none_smt>, ++ /* i2c7_sda_m1 */ ++ <3 RK_PA1 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c7m2_xfer: i2c7m2-xfer { ++ rockchip,pins = ++ /* i2c7_scl_m2 */ ++ <4 RK_PA0 11 &pcfg_pull_none_smt>, ++ /* i2c7_sda_m2 */ ++ <4 RK_PA1 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c7m3_xfer: i2c7m3-xfer { ++ rockchip,pins = ++ /* i2c7_scl_m3 */ ++ <4 RK_PC0 11 &pcfg_pull_none_smt>, ++ /* i2c7_sda_m3 */ ++ <4 RK_PC1 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c8 { ++ /omit-if-no-ref/ ++ i2c8m0_xfer: i2c8m0-xfer { ++ rockchip,pins = ++ /* i2c8_scl_m0 */ ++ <2 RK_PA0 11 &pcfg_pull_none_smt>, ++ /* i2c8_sda_m0 */ ++ <2 RK_PA1 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c8m1_xfer: i2c8m1-xfer { ++ rockchip,pins = ++ /* i2c8_scl_m1 */ ++ <1 RK_PC6 10 &pcfg_pull_none_smt>, ++ /* i2c8_sda_m1 */ ++ <1 RK_PC7 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c8m2_xfer: i2c8m2-xfer { ++ rockchip,pins = ++ /* i2c8_scl_m2 */ ++ <2 RK_PB6 11 &pcfg_pull_none_smt>, ++ /* i2c8_sda_m2 */ ++ <2 RK_PB7 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c8m3_xfer: i2c8m3-xfer { ++ rockchip,pins = ++ /* i2c8_scl_m3 */ ++ <3 RK_PB3 11 &pcfg_pull_none_smt>, ++ /* i2c8_sda_m3 */ ++ <3 RK_PB2 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i2c9 { ++ /omit-if-no-ref/ ++ i2c9m0_xfer: i2c9m0-xfer { ++ rockchip,pins = ++ /* i2c9_scl_m0 */ ++ <1 RK_PA5 10 &pcfg_pull_none_smt>, ++ /* i2c9_sda_m0 */ ++ <1 RK_PA6 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c9m1_xfer: i2c9m1-xfer { ++ rockchip,pins = ++ /* i2c9_scl_m1 */ ++ <1 RK_PB5 10 &pcfg_pull_none_smt>, ++ /* i2c9_sda_m1 */ ++ <1 RK_PB4 10 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c9m2_xfer: i2c9m2-xfer { ++ rockchip,pins = ++ /* i2c9_scl_m2 */ ++ <2 RK_PD5 11 &pcfg_pull_none_smt>, ++ /* i2c9_sda_m2 */ ++ <2 RK_PD4 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c9m3_xfer: i2c9m3-xfer { ++ rockchip,pins = ++ /* i2c9_scl_m3 */ ++ <3 RK_PC2 11 &pcfg_pull_none_smt>, ++ /* i2c9_sda_m3 */ ++ <3 RK_PC3 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i3c0 { ++ /omit-if-no-ref/ ++ i3c0m0_xfer: i3c0m0-xfer { ++ rockchip,pins = ++ /* i3c0_scl_m0 */ ++ <0 RK_PC1 11 &pcfg_pull_none_smt>, ++ /* i3c0_sda_m0 */ ++ <0 RK_PC2 11 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c0m1_xfer: i3c0m1-xfer { ++ rockchip,pins = ++ /* i3c0_scl_m1 */ ++ <1 RK_PD2 10 &pcfg_pull_none_smt>, ++ /* i3c0_sda_m1 */ ++ <1 RK_PD3 10 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i3c1 { ++ /omit-if-no-ref/ ++ i3c1m0_xfer: i3c1m0-xfer { ++ rockchip,pins = ++ /* i3c1_scl_m0 */ ++ <2 RK_PD2 12 &pcfg_pull_none_smt>, ++ /* i3c1_sda_m0 */ ++ <2 RK_PD3 12 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c1m1_xfer: i3c1m1-xfer { ++ rockchip,pins = ++ /* i3c1_scl_m1 */ ++ <2 RK_PA2 14 &pcfg_pull_none_smt>, ++ /* i3c1_sda_m1 */ ++ <2 RK_PA3 14 &pcfg_pull_none_smt>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c1m2_xfer: i3c1m2-xfer { ++ rockchip,pins = ++ /* i3c1_scl_m2 */ ++ <3 RK_PD3 11 &pcfg_pull_none_smt>, ++ /* i3c1_sda_m2 */ ++ <3 RK_PD2 11 &pcfg_pull_none_smt>; ++ }; ++ }; ++ ++ i3c0_sda { ++ /omit-if-no-ref/ ++ i3c0_sdam0_pu: i3c0_sdam0-pu { ++ rockchip,pins = ++ /* i3c0_sda_pu_m0 */ ++ <0 RK_PC5 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c0_sdam1_pu: i3c0_sdam1-pu { ++ rockchip,pins = ++ /* i3c0_sda_pu_m1 */ ++ <1 RK_PD1 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ i3c1_sda { ++ /omit-if-no-ref/ ++ i3c1_sdam0_pu: i3c1_sdam0-pu { ++ rockchip,pins = ++ /* i3c1_sda_pu_m0 */ ++ <2 RK_PD6 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c1_sdam1_pu: i3c1_sdam1-pu { ++ rockchip,pins = ++ /* i3c1_sda_pu_m1 */ ++ <2 RK_PA5 14 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ i3c1_sdam2_pu: i3c1_sdam2-pu { ++ rockchip,pins = ++ /* i3c1_sda_pu_m2 */ ++ <3 RK_PD1 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ isp_flash { ++ /omit-if-no-ref/ ++ isp_flashm0_pins: isp_flashm0-pins { ++ rockchip,pins = ++ /* isp_flash_trigout_m0 */ ++ <2 RK_PD5 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ isp_flashm1_pins: isp_flashm1-pins { ++ rockchip,pins = ++ /* isp_flash_trigout_m1 */ ++ <4 RK_PC5 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ isp_prelight { ++ /omit-if-no-ref/ ++ isp_prelightm0_pins: isp_prelightm0-pins { ++ rockchip,pins = ++ /* isp_prelight_trig_m0 */ ++ <2 RK_PD4 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ isp_prelightm1_pins: isp_prelightm1-pins { ++ rockchip,pins = ++ /* isp_prelight_trig_m1 */ ++ <4 RK_PC4 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ jtag { ++ /omit-if-no-ref/ ++ jtagm0_pins: jtagm0-pins { ++ rockchip,pins = ++ /* jtag_tck_m0 */ ++ <2 RK_PA2 9 &pcfg_pull_none>, ++ /* jtag_tms_m0 */ ++ <2 RK_PA3 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ jtagm1_pins: jtagm1-pins { ++ rockchip,pins = ++ /* jtag_tck_m1 */ ++ <0 RK_PD4 10 &pcfg_pull_none>, ++ /* jtag_tms_m1 */ ++ <0 RK_PD5 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ mipi { ++ /omit-if-no-ref/ ++ mipim0_pins: mipim0-pins { ++ rockchip,pins = ++ /* mipi_te_m0 */ ++ <4 RK_PB2 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ mipim1_pins: mipim1-pins { ++ rockchip,pins = ++ /* mipi_te_m1 */ ++ <3 RK_PA2 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ mipim2_pins: mipim2-pins { ++ rockchip,pins = ++ /* mipi_te_m2 */ ++ <4 RK_PA0 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ mipim3_pins: mipim3-pins { ++ rockchip,pins = ++ /* mipi_te_m3 */ ++ <1 RK_PB3 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ npu { ++ /omit-if-no-ref/ ++ npu_pins: npu-pins { ++ rockchip,pins = ++ /* npu_avs */ ++ <0 RK_PB7 11 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie0 { ++ /omit-if-no-ref/ ++ pcie0m0_pins: pcie0m0-pins { ++ rockchip,pins = ++ /* pcie21_port0_clkreq_m0 */ ++ <2 RK_PB2 11 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie0m1_pins: pcie0m1-pins { ++ rockchip,pins = ++ /* pcie0_clkreq_m1 */ ++ <1 RK_PB6 12 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie0m2_pins: pcie0m2-pins { ++ rockchip,pins = ++ /* pcie0_clkreq_m2 */ ++ <4 RK_PB5 12 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie0m3_pins: pcie0m3-pins { ++ rockchip,pins = ++ /* pcie0_clkreq_m3 */ ++ <4 RK_PC6 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie0_buttonrst: pcie21-port0-buttonrst { ++ rockchip,pins = ++ /* pcie0_buttonrst */ ++ <1 RK_PC4 12 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie1 { ++ /omit-if-no-ref/ ++ pcie1m0_pins: pcie1m0-pins { ++ rockchip,pins = ++ /* pcie1_clkreq_m0 */ ++ <2 RK_PB3 11 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie1m1_pins: pcie1m1-pins { ++ rockchip,pins = ++ /* pcie1_clkreq_m1 */ ++ <1 RK_PB4 12 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie1m2_pins: pcie1m2-pins { ++ rockchip,pins = ++ /* pcie1_clkreq_m2 */ ++ <4 RK_PA5 12 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie1m3_pins: pcie1m3-pins { ++ rockchip,pins = ++ /* pcie1_clkreq_m3 */ ++ <4 RK_PC1 10 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ pcie1_buttonrst: pcie21-port1-buttonrst { ++ rockchip,pins = ++ /* pcie1_buttonrst */ ++ <1 RK_PC5 12 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pdm0 { ++ /omit-if-no-ref/ ++ pdm0m0_clk0: pdm0m0-clk0 { ++ rockchip,pins = ++ /* pdm0_clk0_m0 */ ++ <0 RK_PC4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m0_clk1: pdm0m0-clk1 { ++ rockchip,pins = ++ /* pdm0_clk1_m0 */ ++ <0 RK_PC3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m0_sdi0: pdm0m0-sdi0 { ++ rockchip,pins = ++ /* pdm0_sdi0_m0 */ ++ <0 RK_PD0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m0_sdi1: pdm0m0-sdi1 { ++ rockchip,pins = ++ /* pdm0_sdi1_m0 */ ++ <0 RK_PD1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m0_sdi2: pdm0m0-sdi2 { ++ rockchip,pins = ++ /* pdm0_sdi2_m0 */ ++ <0 RK_PD2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m0_sdi3: pdm0m0-sdi3 { ++ rockchip,pins = ++ /* pdm0_sdi3_m0 */ ++ <0 RK_PD3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_clk0: pdm0m1-clk0 { ++ rockchip,pins = ++ /* pdm0_clk0_m1 */ ++ <1 RK_PB1 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_clk1: pdm0m1-clk1 { ++ rockchip,pins = ++ /* pdm0_clk1_m1 */ ++ <1 RK_PA6 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_sdi0: pdm0m1-sdi0 { ++ rockchip,pins = ++ /* pdm0_sdi0_m1 */ ++ <1 RK_PB2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_sdi1: pdm0m1-sdi1 { ++ rockchip,pins = ++ /* pdm0_sdi1_m1 */ ++ <1 RK_PA3 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_sdi2: pdm0m1-sdi2 { ++ rockchip,pins = ++ /* pdm0_sdi2_m1 */ ++ <1 RK_PA5 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m1_sdi3: pdm0m1-sdi3 { ++ rockchip,pins = ++ /* pdm0_sdi3_m1 */ ++ <1 RK_PA2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_clk0: pdm0m2-clk0 { ++ rockchip,pins = ++ /* pdm0_clk0_m2 */ ++ <1 RK_PC1 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_clk1: pdm0m2-clk1 { ++ rockchip,pins = ++ /* pdm0_clk1_m2 */ ++ <1 RK_PD5 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_sdi0: pdm0m2-sdi0 { ++ rockchip,pins = ++ /* pdm0_sdi0_m2 */ ++ <1 RK_PC6 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_sdi1: pdm0m2-sdi1 { ++ rockchip,pins = ++ /* pdm0_sdi1_m2 */ ++ <1 RK_PC7 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_sdi2: pdm0m2-sdi2 { ++ rockchip,pins = ++ /* pdm0_sdi2_m2 */ ++ <1 RK_PC0 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m2_sdi3: pdm0m2-sdi3 { ++ rockchip,pins = ++ /* pdm0_sdi3_m2 */ ++ <1 RK_PD4 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_clk0: pdm0m3-clk0 { ++ rockchip,pins = ++ /* pdm0_clk0_m3 */ ++ <2 RK_PB5 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_clk1: pdm0m3-clk1 { ++ rockchip,pins = ++ /* pdm0_clk1_m3 */ ++ <2 RK_PB3 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_sdi0: pdm0m3-sdi0 { ++ rockchip,pins = ++ /* pdm0_sdi0_m3 */ ++ <2 RK_PB4 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_sdi1: pdm0m3-sdi1 { ++ rockchip,pins = ++ /* pdm0_sdi1_m3 */ ++ <2 RK_PB2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_sdi2: pdm0m3-sdi2 { ++ rockchip,pins = ++ /* pdm0_sdi2_m3 */ ++ <2 RK_PB1 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm0m3_sdi3: pdm0m3-sdi3 { ++ rockchip,pins = ++ /* pdm0_sdi3_m3 */ ++ <2 RK_PB0 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pdm1 { ++ /omit-if-no-ref/ ++ pdm1m0_clk0: pdm1m0-clk0 { ++ rockchip,pins = ++ /* pdm1_clk0_m0 */ ++ <2 RK_PC5 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m0_clk1: pdm1m0-clk1 { ++ rockchip,pins = ++ /* pdm1_clk1_m0 */ ++ <2 RK_PC1 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m0_sdi0: pdm1m0-sdi0 { ++ rockchip,pins = ++ /* pdm1_sdi0_m0 */ ++ <2 RK_PC4 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m0_sdi1: pdm1m0-sdi1 { ++ rockchip,pins = ++ /* pdm1_sdi1_m0 */ ++ <2 RK_PC0 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m0_sdi2: pdm1m0-sdi2 { ++ rockchip,pins = ++ /* pdm1_sdi2_m0 */ ++ <2 RK_PC2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m0_sdi3: pdm1m0-sdi3 { ++ rockchip,pins = ++ /* pdm1_sdi3_m0 */ ++ <2 RK_PC3 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_clk0: pdm1m1-clk0 { ++ rockchip,pins = ++ /* pdm1_clk0_m1 */ ++ <4 RK_PA6 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_clk1: pdm1m1-clk1 { ++ rockchip,pins = ++ /* pdm1_clk1_m1 */ ++ <4 RK_PB0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_sdi0: pdm1m1-sdi0 { ++ rockchip,pins = ++ /* pdm1_sdi0_m1 */ ++ <4 RK_PB3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_sdi1: pdm1m1-sdi1 { ++ rockchip,pins = ++ /* pdm1_sdi1_m1 */ ++ <4 RK_PB2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_sdi2: pdm1m1-sdi2 { ++ rockchip,pins = ++ /* pdm1_sdi2_m1 */ ++ <4 RK_PB1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m1_sdi3: pdm1m1-sdi3 { ++ rockchip,pins = ++ /* pdm1_sdi3_m1 */ ++ <4 RK_PA4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_clk0: pdm1m2-clk0 { ++ rockchip,pins = ++ /* pdm1_clk0_m2 */ ++ <3 RK_PB1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_clk1: pdm1m2-clk1 { ++ rockchip,pins = ++ /* pdm1_clk1_m2 */ ++ <3 RK_PA7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_sdi0: pdm1m2-sdi0 { ++ rockchip,pins = ++ /* pdm1_sdi0_m2 */ ++ <3 RK_PB3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_sdi1: pdm1m2-sdi1 { ++ rockchip,pins = ++ /* pdm1_sdi1_m2 */ ++ <3 RK_PB2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_sdi2: pdm1m2-sdi2 { ++ rockchip,pins = ++ /* pdm1_sdi2_m2 */ ++ <3 RK_PA6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pdm1m2_sdi3: pdm1m2-sdi3 { ++ rockchip,pins = ++ /* pdm1_sdi3_m2 */ ++ <3 RK_PA5 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmu_debug_test { ++ /omit-if-no-ref/ ++ pmu_debug_test_pins: pmu_debug_test-pins { ++ rockchip,pins = ++ /* pmu_debug_test_out */ ++ <0 RK_PB0 2 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pwm0 { ++ /omit-if-no-ref/ ++ pwm0m0_ch0: pwm0m0-ch0 { ++ rockchip,pins = ++ /* pwm0_ch0_m0 */ ++ <0 RK_PC4 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m0_ch1: pwm0m0-ch1 { ++ rockchip,pins = ++ /* pwm0_ch1_m0 */ ++ <0 RK_PC3 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m1_ch0: pwm0m1-ch0 { ++ rockchip,pins = ++ /* pwm0_ch0_m1 */ ++ <1 RK_PC0 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m1_ch1: pwm0m1-ch1 { ++ rockchip,pins = ++ /* pwm0_ch1_m1 */ ++ <4 RK_PC1 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m2_ch0: pwm0m2-ch0 { ++ rockchip,pins = ++ /* pwm0_ch0_m2 */ ++ <2 RK_PC3 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m2_ch1: pwm0m2-ch1 { ++ rockchip,pins = ++ /* pwm0_ch1_m2 */ ++ <2 RK_PC7 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m3_ch0: pwm0m3-ch0 { ++ rockchip,pins = ++ /* pwm0_ch0_m3 */ ++ <3 RK_PB0 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm0m3_ch1: pwm0m3-ch1 { ++ rockchip,pins = ++ /* pwm0_ch1_m3 */ ++ <3 RK_PB6 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ }; ++ ++ pwm1 { ++ /omit-if-no-ref/ ++ pwm1m0_ch0: pwm1m0-ch0 { ++ rockchip,pins = ++ /* pwm1_ch0_m0 */ ++ <0 RK_PB4 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m0_ch1: pwm1m0-ch1 { ++ rockchip,pins = ++ /* pwm1_ch1_m0 */ ++ <0 RK_PB5 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m0_ch2: pwm1m0-ch2 { ++ rockchip,pins = ++ /* pwm1_ch2_m0 */ ++ <0 RK_PB6 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m0_ch3: pwm1m0-ch3 { ++ rockchip,pins = ++ /* pwm1_ch3_m0 */ ++ <0 RK_PC0 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m0_ch4: pwm1m0-ch4 { ++ rockchip,pins = ++ /* pwm1_ch4_m0 */ ++ <0 RK_PB7 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m0_ch5: pwm1m0-ch5 { ++ rockchip,pins = ++ /* pwm1_ch5_m0 */ ++ <0 RK_PD2 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch0: pwm1m1-ch0 { ++ rockchip,pins = ++ /* pwm1_ch0_m1 */ ++ <1 RK_PB4 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch1: pwm1m1-ch1 { ++ rockchip,pins = ++ /* pwm1_ch1_m1 */ ++ <1 RK_PB5 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch2: pwm1m1-ch2 { ++ rockchip,pins = ++ /* pwm1_ch2_m1 */ ++ <1 RK_PC2 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch3: pwm1m1-ch3 { ++ rockchip,pins = ++ /* pwm1_ch3_m1 */ ++ <1 RK_PD2 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch4: pwm1m1-ch4 { ++ rockchip,pins = ++ /* pwm1_ch4_m1 */ ++ <1 RK_PD3 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m1_ch5: pwm1m1-ch5 { ++ rockchip,pins = ++ /* pwm1_ch5_m1 */ ++ <4 RK_PC0 14 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch0: pwm1m2-ch0 { ++ rockchip,pins = ++ /* pwm1_ch0_m2 */ ++ <2 RK_PC0 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch1: pwm1m2-ch1 { ++ rockchip,pins = ++ /* pwm1_ch1_m2 */ ++ <2 RK_PC1 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch2: pwm1m2-ch2 { ++ rockchip,pins = ++ /* pwm1_ch2_m2 */ ++ <2 RK_PC2 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch3: pwm1m2-ch3 { ++ rockchip,pins = ++ /* pwm1_ch3_m2 */ ++ <2 RK_PC4 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch4: pwm1m2-ch4 { ++ rockchip,pins = ++ /* pwm1_ch4_m2 */ ++ <2 RK_PC5 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m2_ch5: pwm1m2-ch5 { ++ rockchip,pins = ++ /* pwm1_ch5_m2 */ ++ <2 RK_PC6 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch0: pwm1m3-ch0 { ++ rockchip,pins = ++ /* pwm1_ch0_m3 */ ++ <3 RK_PA4 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch1: pwm1m3-ch1 { ++ rockchip,pins = ++ /* pwm1_ch1_m3 */ ++ <3 RK_PA5 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch2: pwm1m3-ch2 { ++ rockchip,pins = ++ /* pwm1_ch2_m3 */ ++ <3 RK_PA6 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch3: pwm1m3-ch3 { ++ rockchip,pins = ++ /* pwm1_ch3_m3 */ ++ <3 RK_PB1 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch4: pwm1m3-ch4 { ++ rockchip,pins = ++ /* pwm1_ch4_m3 */ ++ <3 RK_PB4 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm1m3_ch5: pwm1m3-ch5 { ++ rockchip,pins = ++ /* pwm1_ch5_m3 */ ++ <3 RK_PB5 12 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pwm2 { ++ /omit-if-no-ref/ ++ pwm2m0_ch0: pwm2m0-ch0 { ++ rockchip,pins = ++ /* pwm2_ch0_m0 */ ++ <0 RK_PD3 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch1: pwm2m0-ch1 { ++ rockchip,pins = ++ /* pwm2_ch1_m0 */ ++ <1 RK_PB3 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch2: pwm2m0-ch2 { ++ rockchip,pins = ++ /* pwm2_ch2_m0 */ ++ <2 RK_PA0 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch3: pwm2m0-ch3 { ++ rockchip,pins = ++ /* pwm2_ch3_m0 */ ++ <2 RK_PA1 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch4: pwm2m0-ch4 { ++ rockchip,pins = ++ /* pwm2_ch4_m0 */ ++ <2 RK_PA4 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch5: pwm2m0-ch5 { ++ rockchip,pins = ++ /* pwm2_ch5_m0 */ ++ <4 RK_PA2 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch6: pwm2m0-ch6 { ++ rockchip,pins = ++ /* pwm2_ch6_m0 */ ++ <4 RK_PA7 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m0_ch7: pwm2m0-ch7 { ++ rockchip,pins = ++ /* pwm2_ch7_m0 */ ++ <4 RK_PB3 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch0: pwm2m1-ch0 { ++ rockchip,pins = ++ /* pwm2_ch0_m1 */ ++ <4 RK_PC2 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch1: pwm2m1-ch1 { ++ rockchip,pins = ++ /* pwm2_ch1_m1 */ ++ <4 RK_PC3 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch2: pwm2m1-ch2 { ++ rockchip,pins = ++ /* pwm2_ch2_m1 */ ++ <4 RK_PC6 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch3: pwm2m1-ch3 { ++ rockchip,pins = ++ /* pwm2_ch3_m1 */ ++ <4 RK_PC7 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch4: pwm2m1-ch4 { ++ rockchip,pins = ++ /* pwm2_ch4_m1 */ ++ <4 RK_PA3 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch5: pwm2m1-ch5 { ++ rockchip,pins = ++ /* pwm2_ch5_m1 */ ++ <4 RK_PC5 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch6: pwm2m1-ch6 { ++ rockchip,pins = ++ /* pwm2_ch6_m1 */ ++ <4 RK_PC4 14 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m1_ch7: pwm2m1-ch7 { ++ rockchip,pins = ++ /* pwm2_ch7_m1 */ ++ <1 RK_PB1 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch0: pwm2m2-ch0 { ++ rockchip,pins = ++ /* pwm2_ch0_m2 */ ++ <2 RK_PD0 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch1: pwm2m2-ch1 { ++ rockchip,pins = ++ /* pwm2_ch1_m2 */ ++ <2 RK_PD1 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch2: pwm2m2-ch2 { ++ rockchip,pins = ++ /* pwm2_ch2_m2 */ ++ <2 RK_PD2 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch3: pwm2m2-ch3 { ++ rockchip,pins = ++ /* pwm2_ch3_m2 */ ++ <2 RK_PD3 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch4: pwm2m2-ch4 { ++ rockchip,pins = ++ /* pwm2_ch4_m2 */ ++ <2 RK_PD4 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch5: pwm2m2-ch5 { ++ rockchip,pins = ++ /* pwm2_ch5_m2 */ ++ <2 RK_PD5 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch6: pwm2m2-ch6 { ++ rockchip,pins = ++ /* pwm2_ch6_m2 */ ++ <2 RK_PD6 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m2_ch7: pwm2m2-ch7 { ++ rockchip,pins = ++ /* pwm2_ch7_m2 */ ++ <2 RK_PD7 13 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch0: pwm2m3-ch0 { ++ rockchip,pins = ++ /* pwm2_ch0_m3 */ ++ <3 RK_PC2 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch1: pwm2m3-ch1 { ++ rockchip,pins = ++ /* pwm2_ch1_m3 */ ++ <3 RK_PC3 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch2: pwm2m3-ch2 { ++ rockchip,pins = ++ /* pwm2_ch2_m3 */ ++ <3 RK_PC5 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch3: pwm2m3-ch3 { ++ rockchip,pins = ++ /* pwm2_ch3_m3 */ ++ <3 RK_PD0 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch4: pwm2m3-ch4 { ++ rockchip,pins = ++ /* pwm2_ch4_m3 */ ++ <3 RK_PD2 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch5: pwm2m3-ch5 { ++ rockchip,pins = ++ /* pwm2_ch5_m3 */ ++ <3 RK_PD3 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch6: pwm2m3-ch6 { ++ rockchip,pins = ++ /* pwm2_ch6_m3 */ ++ <3 RK_PD6 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2m3_ch7: pwm2m3-ch7 { ++ rockchip,pins = ++ /* pwm2_ch7_m3 */ ++ <3 RK_PD7 12 &pcfg_pull_none_drv_level_2>; ++ }; ++ }; ++ ++ ref_clk0 { ++ /omit-if-no-ref/ ++ ref_clk0_clk0: ref_clk0-clk0 { ++ rockchip,pins = ++ /* ref_clk0_out */ ++ <0 RK_PA0 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ref_clk1 { ++ /omit-if-no-ref/ ++ ref_clk1_clk1: ref_clk1-clk1 { ++ rockchip,pins = ++ /* ref_clk1_out */ ++ <0 RK_PB4 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ref_clk2 { ++ /omit-if-no-ref/ ++ ref_clk2_clk2: ref_clk2-clk2 { ++ rockchip,pins = ++ /* ref_clk2_out */ ++ <0 RK_PB5 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sai0 { ++ /omit-if-no-ref/ ++ sai0m0_lrck: sai0m0-lrck { ++ rockchip,pins = ++ /* sai0_lrck_m0 */ ++ <2 RK_PB7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_mclk: sai0m0-mclk { ++ rockchip,pins = ++ /* sai0_mclk_m0 */ ++ <2 RK_PB5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sclk: sai0m0-sclk { ++ rockchip,pins = ++ /* sai0_sclk_m0 */ ++ <2 RK_PB6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdi0: sai0m0-sdi0 { ++ rockchip,pins = ++ /* sai0_sdi0_m0 */ ++ <2 RK_PB0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdi1: sai0m0-sdi1 { ++ rockchip,pins = ++ /* sai0_sdi1_m0 */ ++ <2 RK_PB1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdi2: sai0m0-sdi2 { ++ rockchip,pins = ++ /* sai0_sdi2_m0 */ ++ <2 RK_PB2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdi3: sai0m0-sdi3 { ++ rockchip,pins = ++ /* sai0_sdi3_m0 */ ++ <2 RK_PB4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdo0: sai0m0-sdo0 { ++ rockchip,pins = ++ /* sai0_sdo0_m0 */ ++ <2 RK_PA6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdo1: sai0m0-sdo1 { ++ rockchip,pins = ++ /* sai0_sdo1_m0 */ ++ <2 RK_PA7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdo2: sai0m0-sdo2 { ++ rockchip,pins = ++ /* sai0_sdo2_m0 */ ++ <2 RK_PB3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m0_sdo3: sai0m0-sdo3 { ++ rockchip,pins = ++ /* sai0_sdo3_m0 */ ++ <2 RK_PD7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_lrck: sai0m1-lrck { ++ rockchip,pins = ++ /* sai0_lrck_m1 */ ++ <0 RK_PC7 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_mclk: sai0m1-mclk { ++ rockchip,pins = ++ /* sai0_mclk_m1 */ ++ <0 RK_PC4 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sclk: sai0m1-sclk { ++ rockchip,pins = ++ /* sai0_sclk_m1 */ ++ <0 RK_PC6 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdi0: sai0m1-sdi0 { ++ rockchip,pins = ++ /* sai0_sdi0_m1 */ ++ <0 RK_PD0 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdi1: sai0m1-sdi1 { ++ rockchip,pins = ++ /* sai0_sdi1_m1 */ ++ <0 RK_PD1 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdi2: sai0m1-sdi2 { ++ rockchip,pins = ++ /* sai0_sdi2_m1 */ ++ <0 RK_PD2 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdi3: sai0m1-sdi3 { ++ rockchip,pins = ++ /* sai0_sdi3_m1 */ ++ <0 RK_PD3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdo0: sai0m1-sdo0 { ++ rockchip,pins = ++ /* sai0_sdo0_m1 */ ++ <0 RK_PC5 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdo1: sai0m1-sdo1 { ++ rockchip,pins = ++ /* sai0_sdo1_m1 */ ++ <0 RK_PD3 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdo2: sai0m1-sdo2 { ++ rockchip,pins = ++ /* sai0_sdo2_m1 */ ++ <0 RK_PD2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m1_sdo3: sai0m1-sdo3 { ++ rockchip,pins = ++ /* sai0_sdo3_m1 */ ++ <0 RK_PD1 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_lrck: sai0m2-lrck { ++ rockchip,pins = ++ /* sai0_lrck_m2 */ ++ <1 RK_PA1 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_mclk: sai0m2-mclk { ++ rockchip,pins = ++ /* sai0_mclk_m2 */ ++ <1 RK_PA4 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sclk: sai0m2-sclk { ++ rockchip,pins = ++ /* sai0_sclk_m2 */ ++ <1 RK_PA0 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdi0: sai0m2-sdi0 { ++ rockchip,pins = ++ /* sai0_sdi0_m2 */ ++ <1 RK_PB2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdi1: sai0m2-sdi1 { ++ rockchip,pins = ++ /* sai0_sdi1_m2 */ ++ <1 RK_PB1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdi2: sai0m2-sdi2 { ++ rockchip,pins = ++ /* sai0_sdi2_m2 */ ++ <1 RK_PA3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdi3: sai0m2-sdi3 { ++ rockchip,pins = ++ /* sai0_sdi3_m2 */ ++ <1 RK_PA2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdo0: sai0m2-sdo0 { ++ rockchip,pins = ++ /* sai0_sdo0_m2 */ ++ <1 RK_PA7 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdo1: sai0m2-sdo1 { ++ rockchip,pins = ++ /* sai0_sdo1_m2 */ ++ <1 RK_PA2 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdo2: sai0m2-sdo2 { ++ rockchip,pins = ++ /* sai0_sdo2_m2 */ ++ <1 RK_PA3 3 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai0m2_sdo3: sai0m2-sdo3 { ++ rockchip,pins = ++ /* sai0_sdo3_m2 */ ++ <1 RK_PB1 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sai1 { ++ /omit-if-no-ref/ ++ sai1m0_lrck: sai1m0-lrck { ++ rockchip,pins = ++ /* sai1_lrck_m0 */ ++ <4 RK_PA5 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_mclk: sai1m0-mclk { ++ rockchip,pins = ++ /* sai1_mclk_m0 */ ++ <4 RK_PA2 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sclk: sai1m0-sclk { ++ rockchip,pins = ++ /* sai1_sclk_m0 */ ++ <4 RK_PA3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdi0: sai1m0-sdi0 { ++ rockchip,pins = ++ /* sai1_sdi0_m0 */ ++ <4 RK_PB3 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdi1: sai1m0-sdi1 { ++ rockchip,pins = ++ /* sai1_sdi1_m0 */ ++ <4 RK_PB2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdi2: sai1m0-sdi2 { ++ rockchip,pins = ++ /* sai1_sdi2_m0 */ ++ <4 RK_PB1 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdi3: sai1m0-sdi3 { ++ rockchip,pins = ++ /* sai1_sdi3_m0 */ ++ <4 RK_PB0 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdo0: sai1m0-sdo0 { ++ rockchip,pins = ++ /* sai1_sdo0_m0 */ ++ <4 RK_PA7 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdo1: sai1m0-sdo1 { ++ rockchip,pins = ++ /* sai1_sdo1_m0 */ ++ <4 RK_PB0 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdo2: sai1m0-sdo2 { ++ rockchip,pins = ++ /* sai1_sdo2_m0 */ ++ <4 RK_PB1 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m0_sdo3: sai1m0-sdo3 { ++ rockchip,pins = ++ /* sai1_sdo3_m0 */ ++ <4 RK_PB2 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_lrck: sai1m1-lrck { ++ rockchip,pins = ++ /* sai1_lrck_m1 */ ++ <3 RK_PC6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_mclk: sai1m1-mclk { ++ rockchip,pins = ++ /* sai1_mclk_m1 */ ++ <3 RK_PD0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sclk: sai1m1-sclk { ++ rockchip,pins = ++ /* sai1_sclk_m1 */ ++ <3 RK_PC7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdi0: sai1m1-sdi0 { ++ rockchip,pins = ++ /* sai1_sdi0_m1 */ ++ <3 RK_PB7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdi1: sai1m1-sdi1 { ++ rockchip,pins = ++ /* sai1_sdi1_m1 */ ++ <3 RK_PD4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdi2: sai1m1-sdi2 { ++ rockchip,pins = ++ /* sai1_sdi2_m1 */ ++ <3 RK_PD5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdi3: sai1m1-sdi3 { ++ rockchip,pins = ++ /* sai1_sdi3_m1 */ ++ <3 RK_PD6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdo0: sai1m1-sdo0 { ++ rockchip,pins = ++ /* sai1_sdo0_m1 */ ++ <3 RK_PC5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdo1: sai1m1-sdo1 { ++ rockchip,pins = ++ /* sai1_sdo1_m1 */ ++ <3 RK_PC4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdo2: sai1m1-sdo2 { ++ rockchip,pins = ++ /* sai1_sdo2_m1 */ ++ <3 RK_PC1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai1m1_sdo3: sai1m1-sdo3 { ++ rockchip,pins = ++ /* sai1_sdo3_m1 */ ++ <3 RK_PC0 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sai2 { ++ /omit-if-no-ref/ ++ sai2m0_lrck: sai2m0-lrck { ++ rockchip,pins = ++ /* sai2_lrck_m0 */ ++ <1 RK_PD2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m0_mclk: sai2m0-mclk { ++ rockchip,pins = ++ /* sai2_mclk_m0 */ ++ <1 RK_PD4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m0_sclk: sai2m0-sclk { ++ rockchip,pins = ++ /* sai2_sclk_m0 */ ++ <1 RK_PD1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m0_sdi: sai2m0-sdi { ++ rockchip,pins = ++ /* sai2m0_sdi */ ++ <1 RK_PD3 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai2m0_sdo: sai2m0-sdo { ++ rockchip,pins = ++ /* sai2m0_sdo */ ++ <1 RK_PD0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m1_lrck: sai2m1-lrck { ++ rockchip,pins = ++ /* sai2_lrck_m1 */ ++ <2 RK_PC3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m1_mclk: sai2m1-mclk { ++ rockchip,pins = ++ /* sai2_mclk_m1 */ ++ <2 RK_PC1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m1_sclk: sai2m1-sclk { ++ rockchip,pins = ++ /* sai2_sclk_m1 */ ++ <2 RK_PC2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m1_sdi: sai2m1-sdi { ++ rockchip,pins = ++ /* sai2m1_sdi */ ++ <2 RK_PC5 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai2m1_sdo: sai2m1-sdo { ++ rockchip,pins = ++ /* sai2m1_sdo */ ++ <2 RK_PC4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m2_lrck: sai2m2-lrck { ++ rockchip,pins = ++ /* sai2_lrck_m2 */ ++ <3 RK_PC3 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m2_mclk: sai2m2-mclk { ++ rockchip,pins = ++ /* sai2_mclk_m2 */ ++ <3 RK_PD1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m2_sclk: sai2m2-sclk { ++ rockchip,pins = ++ /* sai2_sclk_m2 */ ++ <3 RK_PC2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai2m2_sdi: sai2m2-sdi { ++ rockchip,pins = ++ /* sai2m2_sdi */ ++ <3 RK_PD2 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai2m2_sdo: sai2m2-sdo { ++ rockchip,pins = ++ /* sai2m2_sdo */ ++ <3 RK_PD3 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sai3 { ++ /omit-if-no-ref/ ++ sai3m0_lrck: sai3m0-lrck { ++ rockchip,pins = ++ /* sai3_lrck_m0 */ ++ <1 RK_PA6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m0_mclk: sai3m0-mclk { ++ rockchip,pins = ++ /* sai3_mclk_m0 */ ++ <1 RK_PA4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m0_sclk: sai3m0-sclk { ++ rockchip,pins = ++ /* sai3_sclk_m0 */ ++ <1 RK_PA5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m0_sdi: sai3m0-sdi { ++ rockchip,pins = ++ /* sai3m0_sdi */ ++ <1 RK_PA7 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai3m0_sdo: sai3m0-sdo { ++ rockchip,pins = ++ /* sai3m0_sdo */ ++ <1 RK_PB2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m1_lrck: sai3m1-lrck { ++ rockchip,pins = ++ /* sai3_lrck_m1 */ ++ <1 RK_PB5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m1_mclk: sai3m1-mclk { ++ rockchip,pins = ++ /* sai3_mclk_m1 */ ++ <1 RK_PC1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m1_sclk: sai3m1-sclk { ++ rockchip,pins = ++ /* sai3_sclk_m1 */ ++ <1 RK_PB4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m1_sdi: sai3m1-sdi { ++ rockchip,pins = ++ /* sai3m1_sdi */ ++ <1 RK_PB7 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai3m1_sdo: sai3m1-sdo { ++ rockchip,pins = ++ /* sai3m1_sdo */ ++ <1 RK_PB6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m2_lrck: sai3m2-lrck { ++ rockchip,pins = ++ /* sai3_lrck_m2 */ ++ <3 RK_PA1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m2_mclk: sai3m2-mclk { ++ rockchip,pins = ++ /* sai3_mclk_m2 */ ++ <2 RK_PD6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m2_sclk: sai3m2-sclk { ++ rockchip,pins = ++ /* sai3_sclk_m2 */ ++ <3 RK_PA0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m2_sdi: sai3m2-sdi { ++ rockchip,pins = ++ /* sai3m2_sdi */ ++ <3 RK_PA3 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai3m2_sdo: sai3m2-sdo { ++ rockchip,pins = ++ /* sai3m2_sdo */ ++ <3 RK_PA2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m3_lrck: sai3m3-lrck { ++ rockchip,pins = ++ /* sai3_lrck_m3 */ ++ <2 RK_PA2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m3_mclk: sai3m3-mclk { ++ rockchip,pins = ++ /* sai3_mclk_m3 */ ++ <2 RK_PA1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m3_sclk: sai3m3-sclk { ++ rockchip,pins = ++ /* sai3_sclk_m3 */ ++ <2 RK_PA5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai3m3_sdi: sai3m3-sdi { ++ rockchip,pins = ++ /* sai3m3_sdi */ ++ <2 RK_PA3 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai3m3_sdo: sai3m3-sdo { ++ rockchip,pins = ++ /* sai3m3_sdo */ ++ <2 RK_PA4 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sai4 { ++ /omit-if-no-ref/ ++ sai4m0_lrck: sai4m0-lrck { ++ rockchip,pins = ++ /* sai4_lrck_m0 */ ++ <4 RK_PA6 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m0_mclk: sai4m0-mclk { ++ rockchip,pins = ++ /* sai4_mclk_m0 */ ++ <4 RK_PA2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m0_sclk: sai4m0-sclk { ++ rockchip,pins = ++ /* sai4_sclk_m0 */ ++ <4 RK_PA4 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m0_sdi: sai4m0-sdi { ++ rockchip,pins = ++ /* sai4m0_sdi */ ++ <4 RK_PA7 2 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai4m0_sdo: sai4m0-sdo { ++ rockchip,pins = ++ /* sai4m0_sdo */ ++ <4 RK_PB3 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m1_lrck: sai4m1-lrck { ++ rockchip,pins = ++ /* sai4_lrck_m1 */ ++ <4 RK_PA0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m1_mclk: sai4m1-mclk { ++ rockchip,pins = ++ /* sai4_mclk_m1 */ ++ <3 RK_PB0 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m1_sclk: sai4m1-sclk { ++ rockchip,pins = ++ /* sai4_sclk_m1 */ ++ <3 RK_PD7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m1_sdi: sai4m1-sdi { ++ rockchip,pins = ++ /* sai4m1_sdi */ ++ <3 RK_PA4 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai4m1_sdo: sai4m1-sdo { ++ rockchip,pins = ++ /* sai4m1_sdo */ ++ <4 RK_PA1 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m2_lrck: sai4m2-lrck { ++ rockchip,pins = ++ /* sai4_lrck_m2 */ ++ <4 RK_PC4 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m2_mclk: sai4m2-mclk { ++ rockchip,pins = ++ /* sai4_mclk_m2 */ ++ <4 RK_PC0 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m2_sclk: sai4m2-sclk { ++ rockchip,pins = ++ /* sai4_sclk_m2 */ ++ <4 RK_PC7 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m2_sdi: sai4m2-sdi { ++ rockchip,pins = ++ /* sai4m2_sdi */ ++ <4 RK_PC6 2 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai4m2_sdo: sai4m2-sdo { ++ rockchip,pins = ++ /* sai4m2_sdo */ ++ <4 RK_PC5 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m3_lrck: sai4m3-lrck { ++ rockchip,pins = ++ /* sai4_lrck_m3 */ ++ <2 RK_PC7 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m3_mclk: sai4m3-mclk { ++ rockchip,pins = ++ /* sai4_mclk_m3 */ ++ <2 RK_PD2 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m3_sclk: sai4m3-sclk { ++ rockchip,pins = ++ /* sai4_sclk_m3 */ ++ <2 RK_PC6 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sai4m3_sdi: sai4m3-sdi { ++ rockchip,pins = ++ /* sai4m3_sdi */ ++ <2 RK_PD0 4 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ sai4m3_sdo: sai4m3-sdo { ++ rockchip,pins = ++ /* sai4m3_sdo */ ++ <2 RK_PD1 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sata30 { ++ /omit-if-no-ref/ ++ sata30_sata: sata30-sata { ++ rockchip,pins = ++ /* sata30_cpdet */ ++ <1 RK_PC7 12 &pcfg_pull_none>, ++ /* sata30_cppod */ ++ <1 RK_PC6 12 &pcfg_pull_none>, ++ /* sata30_mpswit */ ++ <1 RK_PD5 12 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sata30_port0 { ++ /omit-if-no-ref/ ++ sata30_port0m0_port0: sata30_port0m0-port0 { ++ rockchip,pins = ++ /* sata30_port0_actled_m0 */ ++ <2 RK_PB4 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sata30_port0m1_port0: sata30_port0m1-port0 { ++ rockchip,pins = ++ /* sata30_port0_actled_m1 */ ++ <4 RK_PC6 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sata30_port1 { ++ /omit-if-no-ref/ ++ sata30_port1m0_port1: sata30_port1m0-port1 { ++ rockchip,pins = ++ /* sata30_port1_actled_m0 */ ++ <2 RK_PB5 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sata30_port1m1_port1: sata30_port1m1-port1 { ++ rockchip,pins = ++ /* sata30_port1_actled_m1 */ ++ <4 RK_PC5 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc0 { ++ /omit-if-no-ref/ ++ sdmmc0_bus4: sdmmc0-bus4 { ++ rockchip,pins = ++ /* sdmmc0_d0 */ ++ <2 RK_PA0 1 &pcfg_pull_up_drv_level_3>, ++ /* sdmmc0_d1 */ ++ <2 RK_PA1 1 &pcfg_pull_up_drv_level_3>, ++ /* sdmmc0_d2 */ ++ <2 RK_PA2 1 &pcfg_pull_up_drv_level_3>, ++ /* sdmmc0_d3 */ ++ <2 RK_PA3 1 &pcfg_pull_up_drv_level_3>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc0_clk: sdmmc0-clk { ++ rockchip,pins = ++ /* sdmmc0_clk */ ++ <2 RK_PA5 1 &pcfg_pull_up_drv_level_3>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc0_cmd: sdmmc0-cmd { ++ rockchip,pins = ++ /* sdmmc0_cmd */ ++ <2 RK_PA4 1 &pcfg_pull_up_drv_level_3>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc0_det: sdmmc0-det { ++ rockchip,pins = ++ /* sdmmc0_detn */ ++ <0 RK_PA7 1 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc0_pwren: sdmmc0-pwren { ++ rockchip,pins = ++ /* sdmmc0_pwren */ ++ <0 RK_PB6 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc1 { ++ /omit-if-no-ref/ ++ sdmmc1m0_bus4: sdmmc1m0-bus4 { ++ rockchip,pins = ++ /* sdmmc1_d0_m0 */ ++ <1 RK_PB4 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d1_m0 */ ++ <1 RK_PB5 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d2_m0 */ ++ <1 RK_PB6 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d3_m0 */ ++ <1 RK_PB7 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m0_clk: sdmmc1m0-clk { ++ rockchip,pins = ++ /* sdmmc1_clk_m0 */ ++ <1 RK_PC1 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m0_cmd: sdmmc1m0-cmd { ++ rockchip,pins = ++ /* sdmmc1_cmd_m0 */ ++ <1 RK_PC0 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m0_det: sdmmc1m0-det { ++ rockchip,pins = ++ /* sdmmc1_detn_m0 */ ++ <1 RK_PC3 2 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m0_pwren: sdmmc1m0-pwren { ++ rockchip,pins = ++ /* sdmmc1m0_pwren */ ++ <1 RK_PC2 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m1_bus4: sdmmc1m1-bus4 { ++ rockchip,pins = ++ /* sdmmc1_d0_m1 */ ++ <2 RK_PA6 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d1_m1 */ ++ <2 RK_PA7 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d2_m1 */ ++ <2 RK_PB0 2 &pcfg_pull_up_drv_level_2>, ++ /* sdmmc1_d3_m1 */ ++ <2 RK_PB1 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m1_clk: sdmmc1m1-clk { ++ rockchip,pins = ++ /* sdmmc1_clk_m1 */ ++ <2 RK_PB3 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m1_cmd: sdmmc1m1-cmd { ++ rockchip,pins = ++ /* sdmmc1_cmd_m1 */ ++ <2 RK_PB2 2 &pcfg_pull_up_drv_level_2>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m1_det: sdmmc1m1-det { ++ rockchip,pins = ++ /* sdmmc1_detn_m1 */ ++ <2 RK_PB5 2 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m1_pwren: sdmmc1m1-pwren { ++ rockchip,pins = ++ /* sdmmc1m1_pwren */ ++ <2 RK_PB4 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ sdmmc1m2_det: sdmmc1m2-det { ++ rockchip,pins = ++ /* sdmmc1_detn_m2 */ ++ <0 RK_PB6 2 &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdmmc0_testclk { ++ /omit-if-no-ref/ ++ sdmmc0_testclk_test: sdmmc0_testclk-test { ++ rockchip,pins = ++ /* sdmmc0_testclk_out */ ++ <1 RK_PC4 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc0_testdata { ++ /omit-if-no-ref/ ++ sdmmc0_testdata_test: sdmmc0_testdata-test { ++ rockchip,pins = ++ /* sdmmc0_testdata_out */ ++ <1 RK_PC5 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc1_testclk { ++ /omit-if-no-ref/ ++ sdmmc1_testclkm0_test: sdmmc1_testclkm0-test { ++ rockchip,pins = ++ /* sdmmc1_testclk_out_m0 */ ++ <1 RK_PC4 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdmmc1_testdata { ++ /omit-if-no-ref/ ++ sdmmc1_testdatam0_test: sdmmc1_testdatam0-test { ++ rockchip,pins = ++ /* sdmmc1_testdata_out_m0 */ ++ <1 RK_PC5 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spdif { ++ /omit-if-no-ref/ ++ spdifm0_rx0: spdifm0-rx0 { ++ rockchip,pins = ++ /* spdif_rx0_m0 */ ++ <4 RK_PB4 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm0_rx1: spdifm0-rx1 { ++ rockchip,pins = ++ /* spdif_rx1_m0 */ ++ <3 RK_PB4 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm0_tx0: spdifm0-tx0 { ++ rockchip,pins = ++ /* spdif_tx0_m0 */ ++ <4 RK_PB5 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm0_tx1: spdifm0-tx1 { ++ rockchip,pins = ++ /* spdif_tx1_m0 */ ++ <3 RK_PB5 4 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm1_rx0: spdifm1-rx0 { ++ rockchip,pins = ++ /* spdif_rx0_m1 */ ++ <4 RK_PA0 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm1_rx1: spdifm1-rx1 { ++ rockchip,pins = ++ /* spdif_rx1_m1 */ ++ <3 RK_PA2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm1_tx0: spdifm1-tx0 { ++ rockchip,pins = ++ /* spdif_tx0_m1 */ ++ <4 RK_PA1 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm1_tx1: spdifm1-tx1 { ++ rockchip,pins = ++ /* spdif_tx1_m1 */ ++ <3 RK_PA3 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm2_rx0: spdifm2-rx0 { ++ rockchip,pins = ++ /* spdif_rx0_m2 */ ++ <2 RK_PD6 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm2_rx1: spdifm2-rx1 { ++ rockchip,pins = ++ /* spdif_rx1_m2 */ ++ <1 RK_PD4 6 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm2_tx0: spdifm2-tx0 { ++ rockchip,pins = ++ /* spdif_tx0_m2 */ ++ <2 RK_PD7 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spdifm2_tx1: spdifm2-tx1 { ++ rockchip,pins = ++ /* spdif_tx1_m2 */ ++ <1 RK_PD5 6 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi0 { ++ /omit-if-no-ref/ ++ spi0m0_pins: spi0m0-pins { ++ rockchip,pins = ++ /* spi0_clk_m0 */ ++ <0 RK_PC7 11 &pcfg_pull_none>, ++ /* spi0_miso_m0 */ ++ <0 RK_PD1 11 &pcfg_pull_none>, ++ /* spi0_mosi_m0 */ ++ <0 RK_PD0 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0m0_csn0: spi0m0-csn0 { ++ rockchip,pins = ++ /* spi0m0_csn0 */ ++ <0 RK_PC6 11 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi0m0_csn1: spi0m0-csn1 { ++ rockchip,pins = ++ /* spi0m0_csn1 */ ++ <0 RK_PC3 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0m1_pins: spi0m1-pins { ++ rockchip,pins = ++ /* spi0_clk_m1 */ ++ <2 RK_PA5 12 &pcfg_pull_none>, ++ /* spi0_miso_m1 */ ++ <2 RK_PA1 12 &pcfg_pull_none>, ++ /* spi0_mosi_m1 */ ++ <2 RK_PA0 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0m1_csn0: spi0m1-csn0 { ++ rockchip,pins = ++ /* spi0m1_csn0 */ ++ <2 RK_PA4 12 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi0m1_csn1: spi0m1-csn1 { ++ rockchip,pins = ++ /* spi0m1_csn1 */ ++ <2 RK_PA2 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0m2_pins: spi0m2-pins { ++ rockchip,pins = ++ /* spi0_clk_m2 */ ++ <1 RK_PA7 9 &pcfg_pull_none>, ++ /* spi0_miso_m2 */ ++ <1 RK_PA6 9 &pcfg_pull_none>, ++ /* spi0_mosi_m2 */ ++ <1 RK_PA5 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0m2_csn0: spi0m2-csn0 { ++ rockchip,pins = ++ /* spi0m2_csn0 */ ++ <1 RK_PA4 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi0m2_csn1: spi0m2-csn1 { ++ rockchip,pins = ++ /* spi0m2_csn1 */ ++ <1 RK_PB2 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi1 { ++ /omit-if-no-ref/ ++ spi1m0_pins: spi1m0-pins { ++ rockchip,pins = ++ /* spi1_clk_m0 */ ++ <1 RK_PB4 11 &pcfg_pull_none>, ++ /* spi1_miso_m0 */ ++ <1 RK_PB6 11 &pcfg_pull_none>, ++ /* spi1_mosi_m0 */ ++ <1 RK_PB5 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1m0_csn0: spi1m0-csn0 { ++ rockchip,pins = ++ /* spi1m0_csn0 */ ++ <1 RK_PB7 11 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi1m0_csn1: spi1m0-csn1 { ++ rockchip,pins = ++ /* spi1m0_csn1 */ ++ <1 RK_PC0 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1m1_pins: spi1m1-pins { ++ rockchip,pins = ++ /* spi1_clk_m1 */ ++ <2 RK_PC5 10 &pcfg_pull_none>, ++ /* spi1_miso_m1 */ ++ <2 RK_PC3 10 &pcfg_pull_none>, ++ /* spi1_mosi_m1 */ ++ <2 RK_PC2 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1m1_csn0: spi1m1-csn0 { ++ rockchip,pins = ++ /* spi1m1_csn0 */ ++ <2 RK_PC4 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi1m1_csn1: spi1m1-csn1 { ++ rockchip,pins = ++ /* spi1m1_csn1 */ ++ <2 RK_PC1 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1m2_pins: spi1m2-pins { ++ rockchip,pins = ++ /* spi1_clk_m2 */ ++ <3 RK_PC7 10 &pcfg_pull_none>, ++ /* spi1_miso_m2 */ ++ <3 RK_PC5 10 &pcfg_pull_none>, ++ /* spi1_mosi_m2 */ ++ <3 RK_PC6 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1m2_csn0: spi1m2-csn0 { ++ rockchip,pins = ++ /* spi1m2_csn0 */ ++ <3 RK_PD0 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi1m2_csn1: spi1m2-csn1 { ++ rockchip,pins = ++ /* spi1m2_csn1 */ ++ <4 RK_PA0 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi2 { ++ /omit-if-no-ref/ ++ spi2m0_pins: spi2m0-pins { ++ rockchip,pins = ++ /* spi2_clk_m0 */ ++ <0 RK_PB2 9 &pcfg_pull_none>, ++ /* spi2_miso_m0 */ ++ <0 RK_PB1 9 &pcfg_pull_none>, ++ /* spi2_mosi_m0 */ ++ <0 RK_PB3 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi2m0_csn0: spi2m0-csn0 { ++ rockchip,pins = ++ /* spi2m0_csn0 */ ++ <0 RK_PB0 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi2m0_csn1: spi2m0-csn1 { ++ rockchip,pins = ++ /* spi2m0_csn1 */ ++ <0 RK_PA7 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi2m1_pins: spi2m1-pins { ++ rockchip,pins = ++ /* spi2_clk_m1 */ ++ <1 RK_PD5 11 &pcfg_pull_none>, ++ /* spi2_miso_m1 */ ++ <1 RK_PC5 11 &pcfg_pull_none>, ++ /* spi2_mosi_m1 */ ++ <1 RK_PC4 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi2m1_csn0: spi2m1-csn0 { ++ rockchip,pins = ++ /* spi2m1_csn0 */ ++ <1 RK_PC3 11 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi2m1_csn1: spi2m1-csn1 { ++ rockchip,pins = ++ /* spi2m1_csn1 */ ++ <1 RK_PC2 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi2m2_pins: spi2m2-pins { ++ rockchip,pins = ++ /* spi2_clk_m2 */ ++ <3 RK_PA4 10 &pcfg_pull_none>, ++ /* spi2_miso_m2 */ ++ <3 RK_PC1 10 &pcfg_pull_none>, ++ /* spi2_mosi_m2 */ ++ <3 RK_PB0 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi2m2_csn0: spi2m2-csn0 { ++ rockchip,pins = ++ /* spi2m2_csn0 */ ++ <3 RK_PC4 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi2m2_csn1: spi2m2-csn1 { ++ rockchip,pins = ++ /* spi2m2_csn1 */ ++ <3 RK_PA5 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi3 { ++ /omit-if-no-ref/ ++ spi3m0_pins: spi3m0-pins { ++ rockchip,pins = ++ /* spi3_clk_m0 */ ++ <3 RK_PA0 10 &pcfg_pull_none>, ++ /* spi3_miso_m0 */ ++ <3 RK_PA2 10 &pcfg_pull_none>, ++ /* spi3_mosi_m0 */ ++ <3 RK_PA1 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi3m0_csn0: spi3m0-csn0 { ++ rockchip,pins = ++ /* spi3m0_csn0 */ ++ <3 RK_PA3 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi3m0_csn1: spi3m0-csn1 { ++ rockchip,pins = ++ /* spi3m0_csn1 */ ++ <2 RK_PD7 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi3m1_pins: spi3m1-pins { ++ rockchip,pins = ++ /* spi3_clk_m1 */ ++ <3 RK_PD4 10 &pcfg_pull_none>, ++ /* spi3_miso_m1 */ ++ <3 RK_PD5 10 &pcfg_pull_none>, ++ /* spi3_mosi_m1 */ ++ <3 RK_PD6 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi3m1_csn0: spi3m1-csn0 { ++ rockchip,pins = ++ /* spi3m1_csn0 */ ++ <3 RK_PB6 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi3m1_csn1: spi3m1-csn1 { ++ rockchip,pins = ++ /* spi3m1_csn1 */ ++ <3 RK_PD7 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi3m2_pins: spi3m2-pins { ++ rockchip,pins = ++ /* spi3_clk_m2 */ ++ <4 RK_PA7 9 &pcfg_pull_none>, ++ /* spi3_miso_m2 */ ++ <4 RK_PA6 9 &pcfg_pull_none>, ++ /* spi3_mosi_m2 */ ++ <4 RK_PA4 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi3m2_csn0: spi3m2-csn0 { ++ rockchip,pins = ++ /* spi3m2_csn0 */ ++ <4 RK_PA3 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi3m2_csn1: spi3m2-csn1 { ++ rockchip,pins = ++ /* spi3m2_csn1 */ ++ <4 RK_PB3 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ spi4 { ++ /omit-if-no-ref/ ++ spi4m0_pins: spi4m0-pins { ++ rockchip,pins = ++ /* spi4_clk_m0 */ ++ <4 RK_PC7 12 &pcfg_pull_none>, ++ /* spi4_miso_m0 */ ++ <4 RK_PC6 12 &pcfg_pull_none>, ++ /* spi4_mosi_m0 */ ++ <4 RK_PC5 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m0_csn0: spi4m0-csn0 { ++ rockchip,pins = ++ /* spi4m0_csn0 */ ++ <4 RK_PC4 12 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi4m0_csn1: spi4m0-csn1 { ++ rockchip,pins = ++ /* spi4m0_csn1 */ ++ <4 RK_PC0 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m1_pins: spi4m1-pins { ++ rockchip,pins = ++ /* spi4_clk_m1 */ ++ <3 RK_PD1 10 &pcfg_pull_none>, ++ /* spi4_miso_m1 */ ++ <3 RK_PC2 10 &pcfg_pull_none>, ++ /* spi4_mosi_m1 */ ++ <3 RK_PC3 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m1_csn0: spi4m1-csn0 { ++ rockchip,pins = ++ /* spi4m1_csn0 */ ++ <3 RK_PB1 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi4m1_csn1: spi4m1-csn1 { ++ rockchip,pins = ++ /* spi4m1_csn1 */ ++ <3 RK_PD2 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m2_pins: spi4m2-pins { ++ rockchip,pins = ++ /* spi4_clk_m2 */ ++ <4 RK_PB0 9 &pcfg_pull_none>, ++ /* spi4_miso_m2 */ ++ <4 RK_PB2 9 &pcfg_pull_none>, ++ /* spi4_mosi_m2 */ ++ <4 RK_PB1 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m2_csn0: spi4m2-csn0 { ++ rockchip,pins = ++ /* spi4m2_csn0 */ ++ <4 RK_PB3 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi4m2_csn1: spi4m2-csn1 { ++ rockchip,pins = ++ /* spi4m2_csn1 */ ++ <4 RK_PA5 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m3_pins: spi4m3-pins { ++ rockchip,pins = ++ /* spi4_clk_m3 */ ++ <2 RK_PB3 10 &pcfg_pull_none>, ++ /* spi4_miso_m3 */ ++ <2 RK_PB5 10 &pcfg_pull_none>, ++ /* spi4_mosi_m3 */ ++ <2 RK_PB4 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ spi4m3_csn0: spi4m3-csn0 { ++ rockchip,pins = ++ /* spi4m3_csn0 */ ++ <2 RK_PB2 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ spi4m3_csn1: spi4m3-csn1 { ++ rockchip,pins = ++ /* spi4m3_csn1 */ ++ <2 RK_PA6 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ test_clk { ++ /omit-if-no-ref/ ++ test_clk_pins: test_clk-pins { ++ rockchip,pins = ++ /* test_clk_out */ ++ <2 RK_PA5 5 &pcfg_pull_none>; ++ }; ++ }; ++ ++ tsadc { ++ /omit-if-no-ref/ ++ tsadcm0_pins: tsadcm0-pins { ++ rockchip,pins = ++ /* tsadc_ctrl_m0 */ ++ <0 RK_PA1 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ tsadcm1_pins: tsadcm1-pins { ++ rockchip,pins = ++ /* tsadc_ctrl_m1 */ ++ <0 RK_PA3 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ tsadc_ctrl { ++ /omit-if-no-ref/ ++ tsadc_ctrl_pins: tsadc_ctrl-pins { ++ rockchip,pins = ++ /* tsadc_ctrl_org */ ++ <0 RK_PA1 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ uart0 { ++ /omit-if-no-ref/ ++ uart0m0_xfer: uart0m0-xfer { ++ rockchip,pins = ++ /* uart0_rx_m0 */ ++ <0 RK_PD5 9 &pcfg_pull_up>, ++ /* uart0_tx_m0 */ ++ <0 RK_PD4 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart0m1_xfer: uart0m1-xfer { ++ rockchip,pins = ++ /* uart0_rx_m1 */ ++ <2 RK_PA0 9 &pcfg_pull_up>, ++ /* uart0_tx_m1 */ ++ <2 RK_PA1 9 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart1 { ++ /omit-if-no-ref/ ++ uart1m0_xfer: uart1m0-xfer { ++ rockchip,pins = ++ /* uart1_rx_m0 */ ++ <0 RK_PC0 10 &pcfg_pull_up>, ++ /* uart1_tx_m0 */ ++ <0 RK_PB7 10 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1m0_ctsn: uart1m0-ctsn { ++ rockchip,pins = ++ /* uart1m0_ctsn */ ++ <0 RK_PD2 13 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart1m0_rtsn: uart1m0-rtsn { ++ rockchip,pins = ++ /* uart1m0_rtsn */ ++ <0 RK_PD3 13 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1m1_xfer: uart1m1-xfer { ++ rockchip,pins = ++ /* uart1_rx_m1 */ ++ <2 RK_PB1 9 &pcfg_pull_up>, ++ /* uart1_tx_m1 */ ++ <2 RK_PB0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1m1_ctsn: uart1m1-ctsn { ++ rockchip,pins = ++ /* uart1m1_ctsn */ ++ <2 RK_PB2 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart1m1_rtsn: uart1m1-rtsn { ++ rockchip,pins = ++ /* uart1m1_rtsn */ ++ <2 RK_PB3 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1m2_xfer: uart1m2-xfer { ++ rockchip,pins = ++ /* uart1_rx_m2 */ ++ <3 RK_PA6 9 &pcfg_pull_up>, ++ /* uart1_tx_m2 */ ++ <3 RK_PA7 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1m2_ctsn: uart1m2-ctsn { ++ rockchip,pins = ++ /* uart1m2_ctsn */ ++ <3 RK_PA4 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart1m2_rtsn: uart1m2-rtsn { ++ rockchip,pins = ++ /* uart1m2_rtsn */ ++ <3 RK_PA5 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ uart2 { ++ /omit-if-no-ref/ ++ uart2m0_xfer: uart2m0-xfer { ++ rockchip,pins = ++ /* uart2_rx_m0 */ ++ <1 RK_PC7 9 &pcfg_pull_up>, ++ /* uart2_tx_m0 */ ++ <1 RK_PC6 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart2m0_ctsn: uart2m0-ctsn { ++ rockchip,pins = ++ /* uart2m0_ctsn */ ++ <1 RK_PC5 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart2m0_rtsn: uart2m0-rtsn { ++ rockchip,pins = ++ /* uart2m0_rtsn */ ++ <1 RK_PC4 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart2m1_xfer: uart2m1-xfer { ++ rockchip,pins = ++ /* uart2_rx_m1 */ ++ <4 RK_PB4 10 &pcfg_pull_up>, ++ /* uart2_tx_m1 */ ++ <4 RK_PB5 10 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart2m1_ctsn: uart2m1-ctsn { ++ rockchip,pins = ++ /* uart2m1_ctsn */ ++ <4 RK_PB1 12 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart2m1_rtsn: uart2m1-rtsn { ++ rockchip,pins = ++ /* uart2m1_rtsn */ ++ <4 RK_PB0 12 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart2m2_xfer: uart2m2-xfer { ++ rockchip,pins = ++ /* uart2_rx_m2 */ ++ <3 RK_PB7 9 &pcfg_pull_up>, ++ /* uart2_tx_m2 */ ++ <3 RK_PC0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart2m2_ctsn: uart2m2-ctsn { ++ rockchip,pins = ++ /* uart2m2_ctsn */ ++ <3 RK_PD3 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart2m2_rtsn: uart2m2-rtsn { ++ rockchip,pins = ++ /* uart2m2_rtsn */ ++ <3 RK_PD2 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ uart3 { ++ /omit-if-no-ref/ ++ uart3m0_xfer: uart3m0-xfer { ++ rockchip,pins = ++ /* uart3_rx_m0 */ ++ <3 RK_PA1 9 &pcfg_pull_up>, ++ /* uart3_tx_m0 */ ++ <3 RK_PA0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart3m0_ctsn: uart3m0-ctsn { ++ rockchip,pins = ++ /* uart3m0_ctsn */ ++ <3 RK_PA2 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart3m0_rtsn: uart3m0-rtsn { ++ rockchip,pins = ++ /* uart3m0_rtsn */ ++ <3 RK_PA3 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart3m1_xfer: uart3m1-xfer { ++ rockchip,pins = ++ /* uart3_rx_m1 */ ++ <4 RK_PA1 9 &pcfg_pull_up>, ++ /* uart3_tx_m1 */ ++ <4 RK_PA0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart3m1_ctsn: uart3m1-ctsn { ++ rockchip,pins = ++ /* uart3m1_ctsn */ ++ <3 RK_PB7 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart3m1_rtsn: uart3m1-rtsn { ++ rockchip,pins = ++ /* uart3m1_rtsn */ ++ <3 RK_PC0 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart3m2_xfer: uart3m2-xfer { ++ rockchip,pins = ++ /* uart3_rx_m2 */ ++ <1 RK_PC1 9 &pcfg_pull_up>, ++ /* uart3_tx_m2 */ ++ <1 RK_PC0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart3m2_ctsn: uart3m2-ctsn { ++ rockchip,pins = ++ /* uart3m2_ctsn */ ++ <1 RK_PB6 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart3m2_rtsn: uart3m2-rtsn { ++ rockchip,pins = ++ /* uart3m2_rtsn */ ++ <1 RK_PB7 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ uart4 { ++ /omit-if-no-ref/ ++ uart4m0_xfer: uart4m0-xfer { ++ rockchip,pins = ++ /* uart4_rx_m0 */ ++ <2 RK_PD1 9 &pcfg_pull_up>, ++ /* uart4_tx_m0 */ ++ <2 RK_PD0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart4m0_ctsn: uart4m0-ctsn { ++ rockchip,pins = ++ /* uart4m0_ctsn */ ++ <2 RK_PC6 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart4m0_rtsn: uart4m0-rtsn { ++ rockchip,pins = ++ /* uart4m0_rtsn */ ++ <2 RK_PC7 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart4m1_xfer: uart4m1-xfer { ++ rockchip,pins = ++ /* uart4_rx_m1 */ ++ <1 RK_PC5 9 &pcfg_pull_up>, ++ /* uart4_tx_m1 */ ++ <1 RK_PC4 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart4m1_ctsn: uart4m1-ctsn { ++ rockchip,pins = ++ /* uart4m1_ctsn */ ++ <1 RK_PC3 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart4m1_rtsn: uart4m1-rtsn { ++ rockchip,pins = ++ /* uart4m1_rtsn */ ++ <1 RK_PC2 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart4m2_xfer: uart4m2-xfer { ++ rockchip,pins = ++ /* uart4_rx_m2 */ ++ <0 RK_PB5 10 &pcfg_pull_up>, ++ /* uart4_tx_m2 */ ++ <0 RK_PB4 10 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart5 { ++ /omit-if-no-ref/ ++ uart5m0_xfer: uart5m0-xfer { ++ rockchip,pins = ++ /* uart5_rx_m0 */ ++ <3 RK_PD4 9 &pcfg_pull_up>, ++ /* uart5_tx_m0 */ ++ <3 RK_PD5 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart5m0_ctsn: uart5m0-ctsn { ++ rockchip,pins = ++ /* uart5m0_ctsn */ ++ <3 RK_PD6 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart5m0_rtsn: uart5m0-rtsn { ++ rockchip,pins = ++ /* uart5m0_rtsn */ ++ <3 RK_PD7 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart5m1_xfer: uart5m1-xfer { ++ rockchip,pins = ++ /* uart5_rx_m1 */ ++ <4 RK_PB1 10 &pcfg_pull_up>, ++ /* uart5_tx_m1 */ ++ <4 RK_PB0 10 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart5m1_ctsn: uart5m1-ctsn { ++ rockchip,pins = ++ /* uart5m1_ctsn */ ++ <4 RK_PA5 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart5m1_rtsn: uart5m1-rtsn { ++ rockchip,pins = ++ /* uart5m1_rtsn */ ++ <4 RK_PA3 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart5m2_xfer: uart5m2-xfer { ++ rockchip,pins = ++ /* uart5_rx_m2 */ ++ <2 RK_PA4 9 &pcfg_pull_up>, ++ /* uart5_tx_m2 */ ++ <2 RK_PA5 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart5m2_ctsn: uart5m2-ctsn { ++ rockchip,pins = ++ /* uart5m2_ctsn */ ++ <2 RK_PA3 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart5m2_rtsn: uart5m2-rtsn { ++ rockchip,pins = ++ /* uart5m2_rtsn */ ++ <2 RK_PA2 10 &pcfg_pull_none>; ++ }; ++ }; ++ ++ uart6 { ++ /omit-if-no-ref/ ++ uart6m0_xfer: uart6m0-xfer { ++ rockchip,pins = ++ /* uart6_rx_m0 */ ++ <4 RK_PA6 10 &pcfg_pull_up>, ++ /* uart6_tx_m0 */ ++ <4 RK_PA4 10 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m0_ctsn: uart6m0-ctsn { ++ rockchip,pins = ++ /* uart6m0_ctsn */ ++ <4 RK_PB1 11 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart6m0_rtsn: uart6m0-rtsn { ++ rockchip,pins = ++ /* uart6m0_rtsn */ ++ <4 RK_PB0 11 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m1_xfer: uart6m1-xfer { ++ rockchip,pins = ++ /* uart6_rx_m1 */ ++ <2 RK_PD3 9 &pcfg_pull_up>, ++ /* uart6_tx_m1 */ ++ <2 RK_PD2 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m1_ctsn: uart6m1-ctsn { ++ rockchip,pins = ++ /* uart6m1_ctsn */ ++ <2 RK_PD5 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart6m1_rtsn: uart6m1-rtsn { ++ rockchip,pins = ++ /* uart6m1_rtsn */ ++ <2 RK_PD4 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m2_xfer: uart6m2-xfer { ++ rockchip,pins = ++ /* uart6_rx_m2 */ ++ <1 RK_PB3 9 &pcfg_pull_up>, ++ /* uart6_tx_m2 */ ++ <1 RK_PB0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m2_ctsn: uart6m2-ctsn { ++ rockchip,pins = ++ /* uart6m2_ctsn */ ++ <1 RK_PA3 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart6m2_rtsn: uart6m2-rtsn { ++ rockchip,pins = ++ /* uart6m2_rtsn */ ++ <1 RK_PA2 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart6m3_xfer: uart6m3-xfer { ++ rockchip,pins = ++ /* uart6_rx_m3 */ ++ <4 RK_PC5 13 &pcfg_pull_up>, ++ /* uart6_tx_m3 */ ++ <4 RK_PC4 13 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart7 { ++ /omit-if-no-ref/ ++ uart7m0_xfer: uart7m0-xfer { ++ rockchip,pins = ++ /* uart7_rx_m0 */ ++ <2 RK_PB7 9 &pcfg_pull_up>, ++ /* uart7_tx_m0 */ ++ <2 RK_PB6 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart7m0_ctsn: uart7m0-ctsn { ++ rockchip,pins = ++ /* uart7m0_ctsn */ ++ <2 RK_PB4 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart7m0_rtsn: uart7m0-rtsn { ++ rockchip,pins = ++ /* uart7m0_rtsn */ ++ <2 RK_PB5 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart7m1_xfer: uart7m1-xfer { ++ rockchip,pins = ++ /* uart7_rx_m1 */ ++ <1 RK_PA3 9 &pcfg_pull_up>, ++ /* uart7_tx_m1 */ ++ <1 RK_PA2 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart7m1_ctsn: uart7m1-ctsn { ++ rockchip,pins = ++ /* uart7m1_ctsn */ ++ <1 RK_PA1 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart7m1_rtsn: uart7m1-rtsn { ++ rockchip,pins = ++ /* uart7m1_rtsn */ ++ <1 RK_PA0 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart7m2_xfer: uart7m2-xfer { ++ rockchip,pins = ++ /* uart7_rx_m2 */ ++ <2 RK_PA0 10 &pcfg_pull_up>, ++ /* uart7_tx_m2 */ ++ <2 RK_PA1 10 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart8 { ++ /omit-if-no-ref/ ++ uart8m0_xfer: uart8m0-xfer { ++ rockchip,pins = ++ /* uart8_rx_m0 */ ++ <3 RK_PC5 9 &pcfg_pull_up>, ++ /* uart8_tx_m0 */ ++ <3 RK_PC6 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart8m0_ctsn: uart8m0-ctsn { ++ rockchip,pins = ++ /* uart8m0_ctsn */ ++ <3 RK_PD0 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart8m0_rtsn: uart8m0-rtsn { ++ rockchip,pins = ++ /* uart8m0_rtsn */ ++ <3 RK_PC7 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart8m1_xfer: uart8m1-xfer { ++ rockchip,pins = ++ /* uart8_rx_m1 */ ++ <2 RK_PA7 9 &pcfg_pull_up>, ++ /* uart8_tx_m1 */ ++ <2 RK_PA6 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart8m1_ctsn: uart8m1-ctsn { ++ rockchip,pins = ++ /* uart8m1_ctsn */ ++ <2 RK_PB7 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart8m1_rtsn: uart8m1-rtsn { ++ rockchip,pins = ++ /* uart8m1_rtsn */ ++ <2 RK_PB6 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart8m2_xfer: uart8m2-xfer { ++ rockchip,pins = ++ /* uart8_rx_m2 */ ++ <0 RK_PC2 10 &pcfg_pull_up>, ++ /* uart8_tx_m2 */ ++ <0 RK_PC1 10 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart9 { ++ /omit-if-no-ref/ ++ uart9m0_xfer: uart9m0-xfer { ++ rockchip,pins = ++ /* uart9_rx_m0 */ ++ <2 RK_PC0 9 &pcfg_pull_up>, ++ /* uart9_tx_m0 */ ++ <2 RK_PC1 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart9m0_ctsn: uart9m0-ctsn { ++ rockchip,pins = ++ /* uart9m0_ctsn */ ++ <2 RK_PD7 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart9m0_rtsn: uart9m0-rtsn { ++ rockchip,pins = ++ /* uart9m0_rtsn */ ++ <2 RK_PD6 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart9m1_xfer: uart9m1-xfer { ++ rockchip,pins = ++ /* uart9_rx_m1 */ ++ <3 RK_PB2 9 &pcfg_pull_up>, ++ /* uart9_tx_m1 */ ++ <3 RK_PB3 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart9m1_ctsn: uart9m1-ctsn { ++ rockchip,pins = ++ /* uart9m1_ctsn */ ++ <3 RK_PB5 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart9m1_rtsn: uart9m1-rtsn { ++ rockchip,pins = ++ /* uart9m1_rtsn */ ++ <3 RK_PB4 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart9m2_xfer: uart9m2-xfer { ++ rockchip,pins = ++ /* uart9_rx_m2 */ ++ <4 RK_PC3 13 &pcfg_pull_up>, ++ /* uart9_tx_m2 */ ++ <4 RK_PC2 13 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart10 { ++ /omit-if-no-ref/ ++ uart10m0_xfer: uart10m0-xfer { ++ rockchip,pins = ++ /* uart10_rx_m0 */ ++ <3 RK_PB0 9 &pcfg_pull_up>, ++ /* uart10_tx_m0 */ ++ <3 RK_PB1 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart10m0_ctsn: uart10m0-ctsn { ++ rockchip,pins = ++ /* uart10m0_ctsn */ ++ <3 RK_PA6 10 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart10m0_rtsn: uart10m0-rtsn { ++ rockchip,pins = ++ /* uart10m0_rtsn */ ++ <3 RK_PA7 10 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart10m1_xfer: uart10m1-xfer { ++ rockchip,pins = ++ /* uart10_rx_m1 */ ++ <1 RK_PD1 9 &pcfg_pull_up>, ++ /* uart10_tx_m1 */ ++ <1 RK_PD0 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart10m1_ctsn: uart10m1-ctsn { ++ rockchip,pins = ++ /* uart10m1_ctsn */ ++ <1 RK_PD5 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart10m1_rtsn: uart10m1-rtsn { ++ rockchip,pins = ++ /* uart10m1_rtsn */ ++ <1 RK_PD4 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart10m2_xfer: uart10m2-xfer { ++ rockchip,pins = ++ /* uart10_rx_m2 */ ++ <0 RK_PC5 10 &pcfg_pull_up>, ++ /* uart10_tx_m2 */ ++ <0 RK_PC4 10 &pcfg_pull_up>; ++ }; ++ }; ++ ++ uart11 { ++ /omit-if-no-ref/ ++ uart11m0_xfer: uart11m0-xfer { ++ rockchip,pins = ++ /* uart11_rx_m0 */ ++ <3 RK_PC1 9 &pcfg_pull_up>, ++ /* uart11_tx_m0 */ ++ <3 RK_PC4 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart11m0_ctsn: uart11m0-ctsn { ++ rockchip,pins = ++ /* uart11m0_ctsn */ ++ <3 RK_PC3 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart11m0_rtsn: uart11m0-rtsn { ++ rockchip,pins = ++ /* uart11m0_rtsn */ ++ <3 RK_PC2 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart11m1_xfer: uart11m1-xfer { ++ rockchip,pins = ++ /* uart11_rx_m1 */ ++ <2 RK_PC5 9 &pcfg_pull_up>, ++ /* uart11_tx_m1 */ ++ <2 RK_PC4 9 &pcfg_pull_up>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart11m1_ctsn: uart11m1-ctsn { ++ rockchip,pins = ++ /* uart11m1_ctsn */ ++ <2 RK_PC2 9 &pcfg_pull_none>; ++ }; ++ /omit-if-no-ref/ ++ uart11m1_rtsn: uart11m1-rtsn { ++ rockchip,pins = ++ /* uart11m1_rtsn */ ++ <2 RK_PC3 9 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ uart11m2_xfer: uart11m2-xfer { ++ rockchip,pins = ++ /* uart11_rx_m2 */ ++ <4 RK_PC1 13 &pcfg_pull_up>, ++ /* uart11_tx_m2 */ ++ <4 RK_PC0 13 &pcfg_pull_up>; ++ }; ++ }; ++ ++ ufs { ++ /omit-if-no-ref/ ++ ufs_refclk: ufs-refclk { ++ rockchip,pins = ++ /* ufs_refclk */ ++ <4 RK_PD1 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ ufs_rst: ufs-rst { ++ rockchip,pins = ++ /* ufs_rstn */ ++ <4 RK_PD0 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ufs_testdata0 { ++ /omit-if-no-ref/ ++ ufs_testdata0_test: ufs_testdata0-test { ++ rockchip,pins = ++ /* ufs_testdata0_out */ ++ <4 RK_PC4 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ufs_testdata1 { ++ /omit-if-no-ref/ ++ ufs_testdata1_test: ufs_testdata1-test { ++ rockchip,pins = ++ /* ufs_testdata1_out */ ++ <4 RK_PC5 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ufs_testdata2 { ++ /omit-if-no-ref/ ++ ufs_testdata2_test: ufs_testdata2-test { ++ rockchip,pins = ++ /* ufs_testdata2_out */ ++ <4 RK_PC6 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ ufs_testdata3 { ++ /omit-if-no-ref/ ++ ufs_testdata3_test: ufs_testdata3-test { ++ rockchip,pins = ++ /* ufs_testdata3_out */ ++ <4 RK_PC7 4 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vi_cif { ++ /omit-if-no-ref/ ++ vi_cif_pins: vi_cif-pins { ++ rockchip,pins = ++ /* vi_cif_clki */ ++ <3 RK_PA3 1 &pcfg_pull_none>, ++ /* vi_cif_clko */ ++ <3 RK_PA2 1 &pcfg_pull_none>, ++ /* vi_cif_d0 */ ++ <2 RK_PC5 1 &pcfg_pull_none>, ++ /* vi_cif_d1 */ ++ <2 RK_PC4 1 &pcfg_pull_none>, ++ /* vi_cif_d2 */ ++ <2 RK_PC3 1 &pcfg_pull_none>, ++ /* vi_cif_d3 */ ++ <2 RK_PC2 1 &pcfg_pull_none>, ++ /* vi_cif_d4 */ ++ <2 RK_PC1 1 &pcfg_pull_none>, ++ /* vi_cif_d5 */ ++ <2 RK_PC0 1 &pcfg_pull_none>, ++ /* vi_cif_d6 */ ++ <2 RK_PB7 1 &pcfg_pull_none>, ++ /* vi_cif_d7 */ ++ <2 RK_PB6 1 &pcfg_pull_none>, ++ /* vi_cif_d8 */ ++ <2 RK_PB5 1 &pcfg_pull_none>, ++ /* vi_cif_d9 */ ++ <2 RK_PB4 1 &pcfg_pull_none>, ++ /* vi_cif_d10 */ ++ <2 RK_PB3 1 &pcfg_pull_none>, ++ /* vi_cif_d11 */ ++ <2 RK_PB2 1 &pcfg_pull_none>, ++ /* vi_cif_d12 */ ++ <2 RK_PB1 1 &pcfg_pull_none>, ++ /* vi_cif_d13 */ ++ <2 RK_PB0 1 &pcfg_pull_none>, ++ /* vi_cif_d14 */ ++ <2 RK_PA7 1 &pcfg_pull_none>, ++ /* vi_cif_d15 */ ++ <2 RK_PA6 1 &pcfg_pull_none>, ++ /* vi_cif_href */ ++ <3 RK_PA0 1 &pcfg_pull_none>, ++ /* vi_cif_vsync */ ++ <3 RK_PA1 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vo_lcdc { ++ /omit-if-no-ref/ ++ vo_lcdc_pins: vo_lcdc-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d0 */ ++ <3 RK_PD3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d1 */ ++ <3 RK_PD2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d2 */ ++ <3 RK_PD1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d8 */ ++ <3 RK_PC3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d9 */ ++ <3 RK_PC2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d16 */ ++ <3 RK_PB3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d17 */ ++ <3 RK_PB2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d18 */ ++ <3 RK_PB1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vo_post { ++ /omit-if-no-ref/ ++ vo_post_pins: vo_post-pins { ++ rockchip,pins = ++ /* vo_post_empty */ ++ <4 RK_PA1 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vp0_sync { ++ /omit-if-no-ref/ ++ vp0_sync_pins: vp0_sync-pins { ++ rockchip,pins = ++ /* vp0_sync_out */ ++ <4 RK_PC5 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vp1_sync { ++ /omit-if-no-ref/ ++ vp1_sync_pins: vp1_sync-pins { ++ rockchip,pins = ++ /* vp1_sync_out */ ++ <4 RK_PC6 3 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vp2_sync { ++ /omit-if-no-ref/ ++ vp2_sync_pins: vp2_sync-pins { ++ rockchip,pins = ++ /* vp2_sync_out */ ++ <4 RK_PC7 3 &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++/* ++ * This part is edited handly. ++ */ ++&pinctrl { ++ pmic { ++ /omit-if-no-ref/ ++ pmic_pins: pmic-pins { ++ rockchip,pins = ++ /* pmic_int */ ++ <0 RK_PA6 9 &pcfg_pull_up>, ++ /* pmic_sleep */ ++ <0 RK_PA4 9 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vo { ++ /omit-if-no-ref/ ++ bt1120_pins: bt1120-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ bt656_pins: bt656-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ rgb3x8_pins_m0: rgb3x8-pins-m0 { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ rgb3x8_pins_m1: rgb3x8-pins-m1 { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ rgb565_pins: rgb565-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ rgb666_pins: rgb666-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d2 */ ++ <3 RK_PD1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d18 */ ++ <3 RK_PB1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ rgb888_pins: rgb888-pins { ++ rockchip,pins = ++ /* vo_lcdc_clk */ ++ <3 RK_PD7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d0 */ ++ <3 RK_PD3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d1 */ ++ <3 RK_PD2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d2 */ ++ <3 RK_PD1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d3 */ ++ <3 RK_PD0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d4 */ ++ <3 RK_PC7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d5 */ ++ <3 RK_PC6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d6 */ ++ <3 RK_PC5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d7 */ ++ <3 RK_PC4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d8 */ ++ <3 RK_PC3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d9 */ ++ <3 RK_PC2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d10 */ ++ <3 RK_PC1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d11 */ ++ <3 RK_PC0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d12 */ ++ <3 RK_PB7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d13 */ ++ <3 RK_PB6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d14 */ ++ <3 RK_PB5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d15 */ ++ <3 RK_PB4 1 &pcfg_pull_none>, ++ /* vo_lcdc_d16 */ ++ <3 RK_PB3 1 &pcfg_pull_none>, ++ /* vo_lcdc_d17 */ ++ <3 RK_PB2 1 &pcfg_pull_none>, ++ /* vo_lcdc_d18 */ ++ <3 RK_PB1 1 &pcfg_pull_none>, ++ /* vo_lcdc_d19 */ ++ <3 RK_PB0 1 &pcfg_pull_none>, ++ /* vo_lcdc_d20 */ ++ <3 RK_PA7 1 &pcfg_pull_none>, ++ /* vo_lcdc_d21 */ ++ <3 RK_PA6 1 &pcfg_pull_none>, ++ /* vo_lcdc_d22 */ ++ <3 RK_PA5 1 &pcfg_pull_none>, ++ /* vo_lcdc_d23 */ ++ <3 RK_PA4 1 &pcfg_pull_none>, ++ /* vo_lcdc_den */ ++ <3 RK_PD4 1 &pcfg_pull_none>, ++ /* vo_lcdc_hsync */ ++ <3 RK_PD5 1 &pcfg_pull_none>, ++ /* vo_lcdc_vsync */ ++ <3 RK_PD6 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ vo_ebc { ++ /omit-if-no-ref/ ++ vo_ebc_pins: vo_ebc-pins { ++ rockchip,pins = ++ /* vo_ebc_gdclk */ ++ <3 RK_PD5 2 &pcfg_pull_none>, ++ /* vo_ebc_gdoe */ ++ <3 RK_PA6 2 &pcfg_pull_none>, ++ /* vo_ebc_gdsp */ ++ <3 RK_PA5 2 &pcfg_pull_none>, ++ /* vo_ebc_sdce0 */ ++ <3 RK_PB3 2 &pcfg_pull_none>, ++ /* vo_ebc_sdclk */ ++ <3 RK_PD6 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo0 */ ++ <3 RK_PD3 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo1 */ ++ <3 RK_PD2 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo2 */ ++ <3 RK_PD1 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo3 */ ++ <3 RK_PD0 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo4 */ ++ <3 RK_PC7 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo5 */ ++ <3 RK_PC6 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo6 */ ++ <3 RK_PC5 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo7 */ ++ <3 RK_PC4 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo8 */ ++ <3 RK_PC3 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo9 */ ++ <3 RK_PC2 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo10 */ ++ <3 RK_PC1 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo11 */ ++ <3 RK_PC0 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo12 */ ++ <3 RK_PB7 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo13 */ ++ <3 RK_PB6 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo14 */ ++ <3 RK_PB5 2 &pcfg_pull_none>, ++ /* vo_ebc_sddo15 */ ++ <3 RK_PB4 2 &pcfg_pull_none>, ++ /* vo_ebc_sdle */ ++ <3 RK_PD4 2 &pcfg_pull_none>, ++ /* vo_ebc_sdoe */ ++ <3 RK_PD7 2 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ vo_ebc_extern: vo_ebc-extern { ++ rockchip,pins = ++ /* vo_ebc_sdce1 */ ++ <3 RK_PB2 2 &pcfg_pull_none>, ++ /* vo_ebc_sdce2 */ ++ <3 RK_PB1 2 &pcfg_pull_none>, ++ /* vo_ebc_sdce3 */ ++ <3 RK_PB0 2 &pcfg_pull_none>, ++ /* vo_ebc_sdshr */ ++ <3 RK_PA4 2 &pcfg_pull_none>, ++ /* vo_ebc_vcom */ ++ <3 RK_PA7 2 &pcfg_pull_none>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3576.dtsi +@@ -0,0 +1,1678 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2023 Rockchip Electronics Co., Ltd. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/ { ++ compatible = "rockchip,rk3576"; ++ ++ interrupt-parent = <&gic>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ++ aliases { ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ i2c3 = &i2c3; ++ i2c4 = &i2c4; ++ i2c5 = &i2c5; ++ i2c6 = &i2c6; ++ i2c7 = &i2c7; ++ i2c8 = &i2c8; ++ i2c9 = &i2c9; ++ serial0 = &uart0; ++ serial1 = &uart1; ++ serial2 = &uart2; ++ serial3 = &uart3; ++ serial4 = &uart4; ++ serial5 = &uart5; ++ serial6 = &uart6; ++ serial7 = &uart7; ++ serial8 = &uart8; ++ serial9 = &uart9; ++ serial10 = &uart10; ++ serial11 = &uart11; ++ spi0 = &spi0; ++ spi1 = &spi1; ++ spi2 = &spi2; ++ spi3 = &spi3; ++ spi4 = &spi4; ++ }; ++ ++ xin32k: clock-xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ xin24m: clock-xin24m { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <24000000>; ++ clock-output-names = "xin24m"; ++ }; ++ ++ spll: clock-spll { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <702000000>; ++ clock-output-names = "spll"; ++ }; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu-map { ++ cluster0 { ++ core0 { ++ cpu = <&cpu_l0>; ++ }; ++ core1 { ++ cpu = <&cpu_l1>; ++ }; ++ core2 { ++ cpu = <&cpu_l2>; ++ }; ++ core3 { ++ cpu = <&cpu_l3>; ++ }; ++ }; ++ cluster1 { ++ core0 { ++ cpu = <&cpu_b0>; ++ }; ++ core1 { ++ cpu = <&cpu_b1>; ++ }; ++ core2 { ++ cpu = <&cpu_b2>; ++ }; ++ core3 { ++ cpu = <&cpu_b3>; ++ }; ++ }; ++ }; ++ ++ cpu_l0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a53"; ++ reg = <0x0>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <485>; ++ clocks = <&scmi_clk ARMCLK_L>; ++ operating-points-v2 = <&cluster0_opp_table>; ++ #cooling-cells = <2>; ++ dynamic-power-coefficient = <120>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_l1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a53"; ++ reg = <0x1>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <485>; ++ clocks = <&scmi_clk ARMCLK_L>; ++ operating-points-v2 = <&cluster0_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_l2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a53"; ++ reg = <0x2>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <485>; ++ clocks = <&scmi_clk ARMCLK_L>; ++ operating-points-v2 = <&cluster0_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_l3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a53"; ++ reg = <0x3>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <485>; ++ clocks = <&scmi_clk ARMCLK_L>; ++ operating-points-v2 = <&cluster0_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_b0: cpu@100 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a72"; ++ reg = <0x100>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <1024>; ++ clocks = <&scmi_clk ARMCLK_B>; ++ operating-points-v2 = <&cluster1_opp_table>; ++ #cooling-cells = <2>; ++ dynamic-power-coefficient = <320>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_b1: cpu@101 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a72"; ++ reg = <0x101>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <1024>; ++ clocks = <&scmi_clk ARMCLK_B>; ++ operating-points-v2 = <&cluster1_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_b2: cpu@102 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a72"; ++ reg = <0x102>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <1024>; ++ clocks = <&scmi_clk ARMCLK_B>; ++ operating-points-v2 = <&cluster1_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ cpu_b3: cpu@103 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a72"; ++ reg = <0x103>; ++ enable-method = "psci"; ++ capacity-dmips-mhz = <1024>; ++ clocks = <&scmi_clk ARMCLK_B>; ++ operating-points-v2 = <&cluster1_opp_table>; ++ cpu-idle-states = <&CPU_SLEEP>; ++ }; ++ ++ idle-states { ++ entry-method = "psci"; ++ ++ CPU_SLEEP: cpu-sleep { ++ compatible = "arm,idle-state"; ++ arm,psci-suspend-param = <0x0010000>; ++ entry-latency-us = <120>; ++ exit-latency-us = <250>; ++ min-residency-us = <900>; ++ local-timer-stop; ++ }; ++ }; ++ }; ++ ++ cluster0_opp_table: opp-table-cluster0 { ++ compatible = "operating-points-v2"; ++ opp-shared; ++ ++ opp-408000000 { ++ opp-hz = /bits/ 64 <408000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-600000000 { ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-816000000 { ++ opp-hz = /bits/ 64 <816000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1008000000 { ++ opp-hz = /bits/ 64 <1008000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1200000000 { ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1416000000 { ++ opp-hz = /bits/ 64 <1416000000>; ++ opp-microvolt = <725000 725000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1608000000 { ++ opp-hz = /bits/ 64 <1608000000>; ++ opp-microvolt = <750000 750000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1800000000 { ++ opp-hz = /bits/ 64 <1800000000>; ++ opp-microvolt = <825000 825000 950000>; ++ clock-latency-ns = <40000>; ++ opp-suspend; ++ }; ++ ++ opp-2016000000 { ++ opp-hz = /bits/ 64 <2016000000>; ++ opp-microvolt = <900000 900000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-2208000000 { ++ opp-hz = /bits/ 64 <2208000000>; ++ opp-microvolt = <950000 950000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ }; ++ ++ cluster1_opp_table: opp-table-cluster1 { ++ compatible = "operating-points-v2"; ++ opp-shared; ++ ++ opp-408000000 { ++ opp-hz = /bits/ 64 <408000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ opp-suspend; ++ }; ++ ++ opp-600000000 { ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-816000000 { ++ opp-hz = /bits/ 64 <816000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1008000000 { ++ opp-hz = /bits/ 64 <1008000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1200000000 { ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <700000 700000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1416000000 { ++ opp-hz = /bits/ 64 <1416000000>; ++ opp-microvolt = <712500 712500 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1608000000 { ++ opp-hz = /bits/ 64 <1608000000>; ++ opp-microvolt = <737500 737500 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-1800000000 { ++ opp-hz = /bits/ 64 <1800000000>; ++ opp-microvolt = <800000 800000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-2016000000 { ++ opp-hz = /bits/ 64 <2016000000>; ++ opp-microvolt = <862500 862500 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-2208000000 { ++ opp-hz = /bits/ 64 <2208000000>; ++ opp-microvolt = <925000 925000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ ++ opp-2304000000 { ++ opp-hz = /bits/ 64 <2304000000>; ++ opp-microvolt = <950000 950000 950000>; ++ clock-latency-ns = <40000>; ++ }; ++ }; ++ ++ gpu_opp_table: opp-table-gpu { ++ compatible = "operating-points-v2"; ++ ++ opp-300000000 { ++ opp-hz = /bits/ 64 <300000000>; ++ opp-microvolt = <700000 700000 850000>; ++ }; ++ ++ opp-400000000 { ++ opp-hz = /bits/ 64 <400000000>; ++ opp-microvolt = <700000 700000 850000>; ++ }; ++ ++ opp-500000000 { ++ opp-hz = /bits/ 64 <500000000>; ++ opp-microvolt = <700000 700000 850000>; ++ }; ++ ++ opp-600000000 { ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <700000 700000 850000>; ++ }; ++ ++ opp-700000000 { ++ opp-hz = /bits/ 64 <700000000>; ++ opp-microvolt = <725000 725000 850000>; ++ }; ++ ++ opp-800000000 { ++ opp-hz = /bits/ 64 <800000000>; ++ opp-microvolt = <775000 775000 850000>; ++ }; ++ ++ opp-900000000 { ++ opp-hz = /bits/ 64 <900000000>; ++ opp-microvolt = <825000 825000 850000>; ++ }; ++ ++ opp-950000000 { ++ opp-hz = /bits/ 64 <950000000>; ++ opp-microvolt = <850000 850000 850000>; ++ }; ++ }; ++ ++ firmware { ++ scmi: scmi { ++ compatible = "arm,scmi-smc"; ++ arm,smc-id = <0x82000010>; ++ shmem = <&scmi_shmem>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ scmi_clk: protocol@14 { ++ reg = <0x14>; ++ #clock-cells = <1>; ++ }; ++ }; ++ }; ++ ++ pmu_a53: pmu-a53 { ++ compatible = "arm,cortex-a53-pmu"; ++ interrupts = , ++ , ++ , ++ ; ++ interrupt-affinity = <&cpu_l0>, <&cpu_l1>, <&cpu_l2>, <&cpu_l3>; ++ }; ++ ++ pmu_a72: pmu-a72 { ++ compatible = "arm,cortex-a72-pmu"; ++ interrupts = , ++ , ++ , ++ ; ++ interrupt-affinity = <&cpu_b0>, <&cpu_b1>, <&cpu_b2>, <&cpu_b3>; ++ }; ++ ++ psci { ++ compatible = "arm,psci-1.0"; ++ method = "smc"; ++ }; ++ ++ timer { ++ compatible = "arm,armv8-timer"; ++ interrupts = , ++ , ++ , ++ ; ++ }; ++ ++ soc { ++ compatible = "simple-bus"; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ sys_grf: syscon@2600a000 { ++ compatible = "rockchip,rk3576-sys-grf", "syscon"; ++ reg = <0x0 0x2600a000 0x0 0x2000>; ++ }; ++ ++ bigcore_grf: syscon@2600c000 { ++ compatible = "rockchip,rk3576-bigcore-grf", "syscon"; ++ reg = <0x0 0x2600c000 0x0 0x2000>; ++ }; ++ ++ litcore_grf: syscon@2600e000 { ++ compatible = "rockchip,rk3576-litcore-grf", "syscon"; ++ reg = <0x0 0x2600e000 0x0 0x2000>; ++ }; ++ ++ cci_grf: syscon@26010000 { ++ compatible = "rockchip,rk3576-cci-grf", "syscon"; ++ reg = <0x0 0x26010000 0x0 0x2000>; ++ }; ++ ++ gpu_grf: syscon@26016000 { ++ compatible = "rockchip,rk3576-gpu-grf", "syscon"; ++ reg = <0x0 0x26016000 0x0 0x2000>; ++ }; ++ ++ npu_grf: syscon@26018000 { ++ compatible = "rockchip,rk3576-npu-grf", "syscon"; ++ reg = <0x0 0x26018000 0x0 0x2000>; ++ }; ++ ++ vo0_grf: syscon@2601a000 { ++ compatible = "rockchip,rk3576-vo0-grf", "syscon"; ++ reg = <0x0 0x2601a000 0x0 0x2000>; ++ }; ++ ++ usb_grf: syscon@2601e000 { ++ compatible = "rockchip,rk3576-usb-grf", "syscon"; ++ reg = <0x0 0x2601e000 0x0 0x1000>; ++ }; ++ ++ php_grf: syscon@26020000 { ++ compatible = "rockchip,rk3576-php-grf", "syscon"; ++ reg = <0x0 0x26020000 0x0 0x2000>; ++ }; ++ ++ pmu0_grf: syscon@26024000 { ++ compatible = "rockchip,rk3576-pmu0-grf", "syscon", "simple-mfd"; ++ reg = <0x0 0x26024000 0x0 0x1000>; ++ }; ++ ++ pmu1_grf: syscon@26026000 { ++ compatible = "rockchip,rk3576-pmu1-grf", "syscon"; ++ reg = <0x0 0x26026000 0x0 0x1000>; ++ }; ++ ++ pipe_phy0_grf: syscon@26028000 { ++ compatible = "rockchip,rk3576-pipe-phy-grf", "syscon"; ++ reg = <0x0 0x26028000 0x0 0x2000>; ++ }; ++ ++ pipe_phy1_grf: syscon@2602a000 { ++ compatible = "rockchip,rk3576-pipe-phy-grf", "syscon"; ++ reg = <0x0 0x2602a000 0x0 0x2000>; ++ }; ++ ++ usbdpphy_grf: syscon@2602c000 { ++ compatible = "rockchip,rk3576-usbdpphy-grf", "syscon"; ++ reg = <0x0 0x2602c000 0x0 0x2000>; ++ }; ++ ++ sdgmac_grf: syscon@26038000 { ++ compatible = "rockchip,rk3576-sdgmac-grf", "syscon"; ++ reg = <0x0 0x26038000 0x0 0x1000>; ++ }; ++ ++ ioc_grf: syscon@26040000 { ++ compatible = "rockchip,rk3576-ioc-grf", "syscon", "simple-mfd"; ++ reg = <0x0 0x26040000 0x0 0xc000>; ++ }; ++ ++ cru: clock-controller@27200000 { ++ compatible = "rockchip,rk3576-cru"; ++ reg = <0x0 0x27200000 0x0 0x50000>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ ++ assigned-clocks = ++ <&cru CLK_AUDIO_FRAC_1_SRC>, ++ <&cru PLL_GPLL>, <&cru PLL_CPLL>, ++ <&cru PLL_AUPLL>, <&cru CLK_UART_FRAC_0>, ++ <&cru CLK_UART_FRAC_1>, <&cru CLK_UART_FRAC_2>, ++ <&cru CLK_AUDIO_FRAC_0>, <&cru CLK_AUDIO_FRAC_1>, ++ <&cru CLK_CPLL_DIV2>, <&cru CLK_CPLL_DIV4>, ++ <&cru CLK_CPLL_DIV10>, <&cru FCLK_DDR_CM0_CORE>, ++ <&cru ACLK_PHP_ROOT>; ++ assigned-clock-parents = <&cru PLL_AUPLL>; ++ assigned-clock-rates = ++ <0>, ++ <1188000000>, <1000000000>, ++ <786432000>, <18432000>, ++ <96000000>, <128000000>, ++ <45158400>, <49152000>, ++ <500000000>, <250000000>, ++ <100000000>, <500000000>, ++ <250000000>; ++ }; ++ ++ i2c0: i2c@27300000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x27300000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C0>, <&cru PCLK_I2C0>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ uart1: serial@27310000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x27310000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac0 8>, <&dmac0 9>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1m0_xfer>; ++ status = "disabled"; ++ }; ++ ++ pmu: power-management@27380000 { ++ compatible = "rockchip,rk3576-pmu", "syscon", "simple-mfd"; ++ reg = <0x0 0x27380000 0x0 0x800>; ++ ++ power: power-controller { ++ compatible = "rockchip,rk3576-power-controller"; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_NPU { ++ reg = ; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_NPUTOP { ++ reg = ; ++ clocks = <&cru ACLK_RKNN0>, ++ <&cru ACLK_RKNN1>, ++ <&cru ACLK_RKNN_CBUF>, ++ <&cru CLK_RKNN_DSU0>, ++ <&cru HCLK_RKNN_CBUF>, ++ <&cru HCLK_RKNN_ROOT>, ++ <&cru HCLK_NPU_CM0_ROOT>, ++ <&cru PCLK_NPUTOP_ROOT>; ++ pm_qos = <&qos_npu_mcu>, ++ <&qos_npu_nsp0>, ++ <&qos_npu_nsp1>, ++ <&qos_npu_m0ro>, ++ <&qos_npu_m1ro>; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_NPU0 { ++ reg = ; ++ clocks = <&cru HCLK_RKNN_ROOT>, ++ <&cru ACLK_RKNN0>; ++ pm_qos = <&qos_npu_m0>; ++ #power-domain-cells = <0>; ++ }; ++ power-domain@RK3576_PD_NPU1 { ++ reg = ; ++ clocks = <&cru HCLK_RKNN_ROOT>, ++ <&cru ACLK_RKNN1>; ++ pm_qos = <&qos_npu_m1>; ++ #power-domain-cells = <0>; ++ }; ++ }; ++ }; ++ ++ power-domain@RK3576_PD_GPU { ++ reg = ; ++ clocks = <&cru CLK_GPU>, <&cru PCLK_GPU_ROOT>; ++ pm_qos = <&qos_gpu>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_NVM { ++ reg = ; ++ clocks = <&cru ACLK_EMMC>, <&cru HCLK_EMMC>; ++ pm_qos = <&qos_emmc>, ++ <&qos_fspi0>; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_SDGMAC { ++ reg = ; ++ clocks = <&cru ACLK_HSGPIO>, ++ <&cru ACLK_GMAC0>, ++ <&cru ACLK_GMAC1>, ++ <&cru CCLK_SRC_SDIO>, ++ <&cru CCLK_SRC_SDMMC0>, ++ <&cru HCLK_HSGPIO>, ++ <&cru HCLK_SDIO>, ++ <&cru HCLK_SDMMC0>, ++ <&cru PCLK_SDGMAC_ROOT>; ++ pm_qos = <&qos_fspi1>, ++ <&qos_gmac0>, ++ <&qos_gmac1>, ++ <&qos_sdio>, ++ <&qos_sdmmc>, ++ <&qos_flexbus>; ++ #power-domain-cells = <0>; ++ }; ++ }; ++ ++ power-domain@RK3576_PD_PHP { ++ reg = ; ++ clocks = <&cru ACLK_PHP_ROOT>, ++ <&cru PCLK_PHP_ROOT>, ++ <&cru ACLK_MMU0>, ++ <&cru ACLK_MMU1>; ++ pm_qos = <&qos_mmu0>, ++ <&qos_mmu1>; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_SUBPHP { ++ reg = ; ++ #power-domain-cells = <0>; ++ }; ++ }; ++ ++ power-domain@RK3576_PD_AUDIO { ++ reg = ; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VEPU1 { ++ reg = ; ++ clocks = <&cru ACLK_VEPU1>, ++ <&cru HCLK_VEPU1>; ++ pm_qos = <&qos_vepu1>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VPU { ++ reg = ; ++ clocks = <&cru ACLK_EBC>, ++ <&cru HCLK_EBC>, ++ <&cru ACLK_JPEG>, ++ <&cru HCLK_JPEG>, ++ <&cru ACLK_RGA2E_0>, ++ <&cru HCLK_RGA2E_0>, ++ <&cru ACLK_RGA2E_1>, ++ <&cru HCLK_RGA2E_1>, ++ <&cru ACLK_VDPP>, ++ <&cru HCLK_VDPP>; ++ pm_qos = <&qos_ebc>, ++ <&qos_jpeg>, ++ <&qos_rga0>, ++ <&qos_rga1>, ++ <&qos_vdpp>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VDEC { ++ reg = ; ++ clocks = <&cru ACLK_RKVDEC_ROOT>, ++ <&cru HCLK_RKVDEC>; ++ pm_qos = <&qos_rkvdec>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VI { ++ reg = ; ++ clocks = <&cru ACLK_VICAP>, ++ <&cru HCLK_VICAP>, ++ <&cru DCLK_VICAP>, ++ <&cru ACLK_VI_ROOT>, ++ <&cru HCLK_VI_ROOT>, ++ <&cru PCLK_VI_ROOT>, ++ <&cru CLK_ISP_CORE>, ++ <&cru ACLK_ISP>, ++ <&cru HCLK_ISP>, ++ <&cru CLK_CORE_VPSS>, ++ <&cru ACLK_VPSS>, ++ <&cru HCLK_VPSS>; ++ pm_qos = <&qos_isp_mro>, ++ <&qos_isp_mwo>, ++ <&qos_vicap_m0>, ++ <&qos_vpss_mro>, ++ <&qos_vpss_mwo>; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_VEPU0 { ++ reg = ; ++ clocks = <&cru ACLK_VEPU0>, ++ <&cru HCLK_VEPU0>; ++ pm_qos = <&qos_vepu0>; ++ #power-domain-cells = <0>; ++ }; ++ }; ++ ++ power-domain@RK3576_PD_VOP { ++ reg = ; ++ clocks = <&cru ACLK_VOP>, ++ <&cru HCLK_VOP>, ++ <&cru HCLK_VOP_ROOT>, ++ <&cru PCLK_VOP_ROOT>; ++ pm_qos = <&qos_vop_m0>, ++ <&qos_vop_m1ro>; ++ #power-domain-cells = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ power-domain@RK3576_PD_USB { ++ reg = ; ++ clocks = <&cru PCLK_PHP_ROOT>, ++ <&cru ACLK_USB_ROOT>, ++ <&cru ACLK_MMU2>, ++ <&cru ACLK_SLV_MMU2>, ++ <&cru ACLK_UFS_SYS>; ++ pm_qos = <&qos_mmu2>, ++ <&qos_ufshc>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VO0 { ++ reg = ; ++ clocks = <&cru ACLK_HDCP0>, ++ <&cru HCLK_HDCP0>, ++ <&cru ACLK_VO0_ROOT>, ++ <&cru PCLK_VO0_ROOT>, ++ <&cru HCLK_VOP_ROOT>; ++ pm_qos = <&qos_hdcp0>; ++ #power-domain-cells = <0>; ++ }; ++ ++ power-domain@RK3576_PD_VO1 { ++ reg = ; ++ clocks = <&cru ACLK_HDCP1>, ++ <&cru HCLK_HDCP1>, ++ <&cru ACLK_VO1_ROOT>, ++ <&cru PCLK_VO1_ROOT>, ++ <&cru HCLK_VOP_ROOT>; ++ pm_qos = <&qos_hdcp1>; ++ #power-domain-cells = <0>; ++ }; ++ }; ++ }; ++ }; ++ ++ gpu: gpu@27800000 { ++ compatible = "rockchip,rk3576-mali", "arm,mali-bifrost"; ++ reg = <0x0 0x27800000 0x0 0x200000>; ++ assigned-clocks = <&scmi_clk CLK_GPU>; ++ assigned-clock-rates = <198000000>; ++ clocks = <&cru CLK_GPU>; ++ clock-names = "core"; ++ dynamic-power-coefficient = <1625>; ++ interrupts = , ++ , ++ ; ++ interrupt-names = "job", "mmu", "gpu"; ++ operating-points-v2 = <&gpu_opp_table>; ++ power-domains = <&power RK3576_PD_GPU>; ++ #cooling-cells = <2>; ++ status = "disabled"; ++ }; ++ ++ qos_hdcp1: qos@27f02000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f02000 0x0 0x20>; ++ }; ++ ++ qos_fspi1: qos@27f04000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04000 0x0 0x20>; ++ }; ++ ++ qos_gmac0: qos@27f04080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04080 0x0 0x20>; ++ }; ++ ++ qos_gmac1: qos@27f04100 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04100 0x0 0x20>; ++ }; ++ ++ qos_sdio: qos@27f04180 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04180 0x0 0x20>; ++ }; ++ ++ qos_sdmmc: qos@27f04200 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04200 0x0 0x20>; ++ }; ++ ++ qos_flexbus: qos@27f04280 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f04280 0x0 0x20>; ++ }; ++ ++ qos_gpu: qos@27f05000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f05000 0x0 0x20>; ++ }; ++ ++ qos_vepu1: qos@27f06000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f06000 0x0 0x20>; ++ }; ++ ++ qos_npu_mcu: qos@27f08000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f08000 0x0 0x20>; ++ }; ++ ++ qos_npu_nsp0: qos@27f08080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f08080 0x0 0x20>; ++ }; ++ ++ qos_npu_nsp1: qos@27f08100 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f08100 0x0 0x20>; ++ }; ++ ++ qos_emmc: qos@27f09000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f09000 0x0 0x20>; ++ }; ++ ++ qos_fspi0: qos@27f09080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f09080 0x0 0x20>; ++ }; ++ ++ qos_mmu0: qos@27f0a000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0a000 0x0 0x20>; ++ }; ++ ++ qos_mmu1: qos@27f0a080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0a080 0x0 0x20>; ++ }; ++ ++ qos_rkvdec: qos@27f0c000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0c000 0x0 0x20>; ++ }; ++ ++ qos_crypto: qos@27f0d000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0d000 0x0 0x20>; ++ }; ++ ++ qos_mmu2: qos@27f0e000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0e000 0x0 0x20>; ++ }; ++ ++ qos_ufshc: qos@27f0e080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0e080 0x0 0x20>; ++ }; ++ ++ qos_vepu0: qos@27f0f000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f0f000 0x0 0x20>; ++ }; ++ ++ qos_isp_mro: qos@27f10000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f10000 0x0 0x20>; ++ }; ++ ++ qos_isp_mwo: qos@27f10080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f10080 0x0 0x20>; ++ }; ++ ++ qos_vicap_m0: qos@27f10100 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f10100 0x0 0x20>; ++ }; ++ ++ qos_vpss_mro: qos@27f10180 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f10180 0x0 0x20>; ++ }; ++ ++ qos_vpss_mwo: qos@27f10200 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f10200 0x0 0x20>; ++ }; ++ ++ qos_hdcp0: qos@27f11000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f11000 0x0 0x20>; ++ }; ++ ++ qos_vop_m0: qos@27f12800 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f12800 0x0 0x20>; ++ }; ++ ++ qos_vop_m1ro: qos@27f12880 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f12880 0x0 0x20>; ++ }; ++ ++ qos_ebc: qos@27f13000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f13000 0x0 0x20>; ++ }; ++ ++ qos_rga0: qos@27f13080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f13080 0x0 0x20>; ++ }; ++ ++ qos_rga1: qos@27f13100 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f13100 0x0 0x20>; ++ }; ++ ++ qos_jpeg: qos@27f13180 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f13180 0x0 0x20>; ++ }; ++ ++ qos_vdpp: qos@27f13200 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f13200 0x0 0x20>; ++ }; ++ ++ qos_npu_m0: qos@27f20000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f20000 0x0 0x20>; ++ }; ++ ++ qos_npu_m1: qos@27f21000 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f21000 0x0 0x20>; ++ }; ++ ++ qos_npu_m0ro: qos@27f22080 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f22080 0x0 0x20>; ++ }; ++ ++ qos_npu_m1ro: qos@27f22100 { ++ compatible = "rockchip,rk3576-qos", "syscon"; ++ reg = <0x0 0x27f22100 0x0 0x20>; ++ }; ++ ++ gmac0: ethernet@2a220000 { ++ compatible = "rockchip,rk3576-gmac", "snps,dwmac-4.20a"; ++ reg = <0x0 0x2a220000 0x0 0x10000>; ++ clocks = <&cru CLK_GMAC0_125M_SRC>, <&cru CLK_GMAC0_RMII_CRU>, ++ <&cru PCLK_GMAC0>, <&cru ACLK_GMAC0>, ++ <&cru CLK_GMAC0_PTP_REF>; ++ clock-names = "stmmaceth", "clk_mac_ref", ++ "pclk_mac", "aclk_mac", ++ "ptp_ref"; ++ interrupts = , ++ ; ++ interrupt-names = "macirq", "eth_wake_irq"; ++ power-domains = <&power RK3576_PD_SDGMAC>; ++ resets = <&cru SRST_A_GMAC0>; ++ reset-names = "stmmaceth"; ++ rockchip,grf = <&sdgmac_grf>; ++ rockchip,php-grf = <&ioc_grf>; ++ snps,axi-config = <&gmac0_stmmac_axi_setup>; ++ snps,mixed-burst; ++ snps,mtl-rx-config = <&gmac0_mtl_rx_setup>; ++ snps,mtl-tx-config = <&gmac0_mtl_tx_setup>; ++ snps,tso; ++ status = "disabled"; ++ ++ mdio0: mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <0x1>; ++ #size-cells = <0x0>; ++ }; ++ ++ gmac0_stmmac_axi_setup: stmmac-axi-config { ++ snps,blen = <0 0 0 0 16 8 4>; ++ snps,rd_osr_lmt = <8>; ++ snps,wr_osr_lmt = <4>; ++ }; ++ ++ gmac0_mtl_rx_setup: rx-queues-config { ++ snps,rx-queues-to-use = <1>; ++ queue0 {}; ++ }; ++ ++ gmac0_mtl_tx_setup: tx-queues-config { ++ snps,tx-queues-to-use = <1>; ++ queue0 {}; ++ }; ++ }; ++ ++ gmac1: ethernet@2a230000 { ++ compatible = "rockchip,rk3576-gmac", "snps,dwmac-4.20a"; ++ reg = <0x0 0x2a230000 0x0 0x10000>; ++ clocks = <&cru CLK_GMAC1_125M_SRC>, <&cru CLK_GMAC1_RMII_CRU>, ++ <&cru PCLK_GMAC1>, <&cru ACLK_GMAC1>, ++ <&cru CLK_GMAC1_PTP_REF>; ++ clock-names = "stmmaceth", "clk_mac_ref", ++ "pclk_mac", "aclk_mac", ++ "ptp_ref"; ++ interrupts = , ++ ; ++ interrupt-names = "macirq", "eth_wake_irq"; ++ power-domains = <&power RK3576_PD_SDGMAC>; ++ resets = <&cru SRST_A_GMAC1>; ++ reset-names = "stmmaceth"; ++ rockchip,grf = <&sdgmac_grf>; ++ rockchip,php-grf = <&ioc_grf>; ++ snps,axi-config = <&gmac1_stmmac_axi_setup>; ++ snps,mixed-burst; ++ snps,mtl-rx-config = <&gmac1_mtl_rx_setup>; ++ snps,mtl-tx-config = <&gmac1_mtl_tx_setup>; ++ snps,tso; ++ status = "disabled"; ++ ++ mdio1: mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <0x1>; ++ #size-cells = <0x0>; ++ }; ++ ++ gmac1_stmmac_axi_setup: stmmac-axi-config { ++ snps,blen = <0 0 0 0 16 8 4>; ++ snps,rd_osr_lmt = <8>; ++ snps,wr_osr_lmt = <4>; ++ }; ++ ++ gmac1_mtl_rx_setup: rx-queues-config { ++ snps,rx-queues-to-use = <1>; ++ queue0 {}; ++ }; ++ ++ gmac1_mtl_tx_setup: tx-queues-config { ++ snps,tx-queues-to-use = <1>; ++ queue0 {}; ++ }; ++ }; ++ ++ sdmmc: mmc@2a310000 { ++ compatible = "rockchip,rk3576-dw-mshc"; ++ reg = <0x0 0x2a310000 0x0 0x4000>; ++ clocks = <&cru HCLK_SDMMC0>, <&cru CCLK_SRC_SDMMC0>; ++ clock-names = "biu", "ciu"; ++ fifo-depth = <0x100>; ++ interrupts = ; ++ max-frequency = <200000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_bus4 &sdmmc0_pwren>; ++ power-domains = <&power RK3576_PD_SDGMAC>; ++ resets = <&cru SRST_H_SDMMC0>; ++ reset-names = "reset"; ++ status = "disabled"; ++ }; ++ ++ sdhci: mmc@2a330000 { ++ compatible = "rockchip,rk3576-dwcmshc", "rockchip,rk3588-dwcmshc"; ++ reg = <0x0 0x2a330000 0x0 0x10000>; ++ assigned-clocks = <&cru BCLK_EMMC>, <&cru TCLK_EMMC>, <&cru CCLK_SRC_EMMC>; ++ assigned-clock-rates = <200000000>, <24000000>, <200000000>; ++ clocks = <&cru CCLK_SRC_EMMC>, <&cru HCLK_EMMC>, ++ <&cru ACLK_EMMC>, <&cru BCLK_EMMC>, ++ <&cru TCLK_EMMC>; ++ clock-names = "core", "bus", "axi", "block", "timer"; ++ interrupts = ; ++ max-frequency = <200000000>; ++ pinctrl-0 = <&emmc_rstnout>, <&emmc_bus8>, <&emmc_clk>, ++ <&emmc_cmd>, <&emmc_strb>; ++ pinctrl-names = "default"; ++ power-domains = <&power RK3576_PD_NVM>; ++ resets = <&cru SRST_C_EMMC>, <&cru SRST_H_EMMC>, ++ <&cru SRST_A_EMMC>, <&cru SRST_B_EMMC>, ++ <&cru SRST_T_EMMC>; ++ reset-names = "core", "bus", "axi", "block", "timer"; ++ supports-cqe; ++ status = "disabled"; ++ }; ++ ++ gic: interrupt-controller@2a701000 { ++ compatible = "arm,gic-400"; ++ reg = <0x0 0x2a701000 0 0x10000>, ++ <0x0 0x2a702000 0 0x10000>, ++ <0x0 0x2a704000 0 0x10000>, ++ <0x0 0x2a706000 0 0x10000>; ++ interrupts = ; ++ interrupt-controller; ++ #interrupt-cells = <3>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ }; ++ ++ dmac0: dma-controller@2ab90000 { ++ compatible = "arm,pl330", "arm,primecell"; ++ reg = <0x0 0x2ab90000 0x0 0x4000>; ++ arm,pl330-periph-burst; ++ clocks = <&cru ACLK_DMAC0>; ++ clock-names = "apb_pclk"; ++ interrupts = , ++ ; ++ #dma-cells = <1>; ++ }; ++ ++ dmac1: dma-controller@2abb0000 { ++ compatible = "arm,pl330", "arm,primecell"; ++ reg = <0x0 0x2abb0000 0x0 0x4000>; ++ arm,pl330-periph-burst; ++ clocks = <&cru ACLK_DMAC1>; ++ clock-names = "apb_pclk"; ++ interrupts = , ++ ; ++ #dma-cells = <1>; ++ }; ++ ++ dmac2: dma-controller@2abd0000 { ++ compatible = "arm,pl330", "arm,primecell"; ++ reg = <0x0 0x2abd0000 0x0 0x4000>; ++ arm,pl330-periph-burst; ++ clocks = <&cru ACLK_DMAC2>; ++ clock-names = "apb_pclk"; ++ interrupts = , ++ ; ++ #dma-cells = <1>; ++ }; ++ ++ i2c1: i2c@2ac40000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac40000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C1>, <&cru PCLK_I2C1>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c2: i2c@2ac50000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac50000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C2>, <&cru PCLK_I2C2>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c2m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c3: i2c@2ac60000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac60000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C3>, <&cru PCLK_I2C3>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c3m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c4: i2c@2ac70000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac70000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C4>, <&cru PCLK_I2C4>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c4m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c5: i2c@2ac80000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac80000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C5>, <&cru PCLK_I2C5>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c5m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ ++ i2c6: i2c@2ac90000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ac90000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C6>, <&cru PCLK_I2C6>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c6m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c7: i2c@2aca0000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2aca0000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C7>, <&cru PCLK_I2C7>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c7m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ i2c8: i2c@2acb0000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2acb0000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C8>, <&cru PCLK_I2C8>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c8m0_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ timer0: timer@2acc0000 { ++ compatible = "rockchip,rk3576-timer", "rockchip,rk3288-timer"; ++ reg = <0x0 0x2acc0000 0x0 0x20>; ++ clocks = <&cru PCLK_BUSTIMER0>, <&cru CLK_TIMER0>; ++ clock-names = "pclk", "timer"; ++ interrupts = ; ++ }; ++ ++ wdt: watchdog@2ace0000 { ++ compatible = "rockchip,rk3576-wdt", "snps,dw-wdt"; ++ reg = <0x0 0x2ace0000 0x0 0x100>; ++ clocks = <&cru TCLK_WDT0>, <&cru PCLK_WDT0>; ++ clock-names = "tclk", "pclk"; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ ++ spi0: spi@2acf0000 { ++ compatible = "rockchip,rk3576-spi", "rockchip,rk3066-spi"; ++ reg = <0x0 0x2acf0000 0x0 0x1000>; ++ clocks = <&cru CLK_SPI0>, <&cru PCLK_SPI0>; ++ clock-names = "spiclk", "apb_pclk"; ++ dmas = <&dmac0 14>, <&dmac0 15>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ num-cs = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0m0_csn0 &spi0m0_csn1 &spi0m0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi1: spi@2ad00000 { ++ compatible = "rockchip,rk3576-spi", "rockchip,rk3066-spi"; ++ reg = <0x0 0x2ad00000 0x0 0x1000>; ++ clocks = <&cru CLK_SPI1>, <&cru PCLK_SPI1>; ++ clock-names = "spiclk", "apb_pclk"; ++ dmas = <&dmac0 16>, <&dmac0 17>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ num-cs = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1m0_csn0 &spi1m0_csn1 &spi1m0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@2ad10000 { ++ compatible = "rockchip,rk3576-spi", "rockchip,rk3066-spi"; ++ reg = <0x0 0x2ad10000 0x0 0x1000>; ++ clocks = <&cru CLK_SPI2>, <&cru PCLK_SPI2>; ++ clock-names = "spiclk", "apb_pclk"; ++ dmas = <&dmac1 15>, <&dmac1 16>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ num-cs = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2m0_csn0 &spi2m0_csn1 &spi2m0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi3: spi@2ad20000 { ++ compatible = "rockchip,rk3576-spi", "rockchip,rk3066-spi"; ++ reg = <0x0 0x2ad20000 0x0 0x1000>; ++ clocks = <&cru CLK_SPI3>, <&cru PCLK_SPI3>; ++ clock-names = "spiclk", "apb_pclk"; ++ dmas = <&dmac1 17>, <&dmac1 18>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ num-cs = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi3m0_csn0 &spi3m0_csn1 &spi3m0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi4: spi@2ad30000 { ++ compatible = "rockchip,rk3576-spi", "rockchip,rk3066-spi"; ++ reg = <0x0 0x2ad30000 0x0 0x1000>; ++ clocks = <&cru CLK_SPI4>, <&cru PCLK_SPI4>; ++ clock-names = "spiclk", "apb_pclk"; ++ dmas = <&dmac2 12>, <&dmac2 13>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ num-cs = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi4m0_csn0 &spi4m0_csn1 &spi4m0_pins>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ uart0: serial@2ad40000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad40000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac0 6>, <&dmac0 7>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart0m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart2: serial@2ad50000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad50000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac0 10>, <&dmac0 11>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2m0_xfer>; ++ status = "disabled"; ++ }; ++ ++ uart3: serial@2ad60000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad60000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac0 12>, <&dmac0 13>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart3m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart4: serial@2ad70000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad70000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac1 9>, <&dmac1 10>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart4m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart5: serial@2ad80000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad80000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART5>, <&cru PCLK_UART5>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac1 11>, <&dmac1 12>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart5m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart6: serial@2ad90000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ad90000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART6>, <&cru PCLK_UART6>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac1 13>, <&dmac1 14>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart6m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart7: serial@2ada0000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2ada0000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART7>, <&cru PCLK_UART7>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac2 6>, <&dmac2 7>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart7m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart8: serial@2adb0000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2adb0000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART8>, <&cru PCLK_UART8>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac2 8>, <&dmac2 9>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart8m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ uart9: serial@2adc0000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2adc0000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART9>, <&cru PCLK_UART9>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac2 10>, <&dmac2 11>; ++ dma-names = "tx", "rx"; ++ interrupts = ; ++ pinctrl-0 = <&uart9m0_xfer>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ saradc: adc@2ae00000 { ++ compatible = "rockchip,rk3576-saradc", "rockchip,rk3588-saradc"; ++ reg = <0x0 0x2ae00000 0x0 0x10000>; ++ clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>; ++ clock-names = "saradc", "apb_pclk"; ++ interrupts = ; ++ resets = <&cru SRST_P_SARADC>; ++ reset-names = "saradc-apb"; ++ #io-channel-cells = <1>; ++ status = "disabled"; ++ }; ++ ++ i2c9: i2c@2ae80000 { ++ compatible = "rockchip,rk3576-i2c", "rockchip,rk3399-i2c"; ++ reg = <0x0 0x2ae80000 0x0 0x1000>; ++ clocks = <&cru CLK_I2C9>, <&cru PCLK_I2C9>; ++ clock-names = "i2c", "pclk"; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c9m0_xfer>; ++ resets = <&cru SRST_I2C9>, <&cru SRST_P_I2C9>; ++ reset-names = "i2c", "apb"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ uart10: serial@2afc0000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2afc0000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART10>, <&cru PCLK_UART10>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac2 21>, <&dmac2 22>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart10m0_xfer>; ++ status = "disabled"; ++ }; ++ ++ uart11: serial@2afd0000 { ++ compatible = "rockchip,rk3576-uart", "snps,dw-apb-uart"; ++ reg = <0x0 0x2afd0000 0x0 0x100>; ++ reg-shift = <2>; ++ reg-io-width = <4>; ++ clocks = <&cru SCLK_UART11>, <&cru PCLK_UART11>; ++ clock-names = "baudclk", "apb_pclk"; ++ dmas = <&dmac2 23>, <&dmac2 24>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart11m0_xfer>; ++ status = "disabled"; ++ }; ++ ++ sram: sram@3ff88000 { ++ compatible = "mmio-sram"; ++ reg = <0x0 0x3ff88000 0x0 0x78000>; ++ ranges = <0x0 0x0 0x3ff88000 0x78000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ /* start address and size should be 4k align */ ++ rkvdec_sram: rkvdec-sram@0 { ++ reg = <0x0 0x78000>; ++ }; ++ }; ++ ++ scmi_shmem: scmi-shmem@4010f000 { ++ compatible = "arm,scmi-shmem"; ++ reg = <0x0 0x4010f000 0x0 0x100>; ++ }; ++ ++ pinctrl: pinctrl { ++ compatible = "rockchip,rk3576-pinctrl"; ++ rockchip,grf = <&ioc_grf>; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ gpio0: gpio@27320000 { ++ compatible = "rockchip,gpio-bank"; ++ reg = <0x0 0x27320000 0x0 0x200>; ++ clocks = <&cru PCLK_GPIO0>, <&cru DBCLK_GPIO0>; ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 32>; ++ interrupts = ; ++ interrupt-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++ ++ gpio1: gpio@2ae10000 { ++ compatible = "rockchip,gpio-bank"; ++ reg = <0x0 0x2ae10000 0x0 0x200>; ++ clocks = <&cru PCLK_GPIO1>, <&cru DBCLK_GPIO1>; ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 32 32>; ++ interrupts = ; ++ interrupt-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++ ++ gpio2: gpio@2ae20000 { ++ compatible = "rockchip,gpio-bank"; ++ reg = <0x0 0x2ae20000 0x0 0x200>; ++ clocks = <&cru PCLK_GPIO2>, <&cru DBCLK_GPIO2>; ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 64 32>; ++ interrupts = ; ++ interrupt-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++ ++ gpio3: gpio@2ae30000 { ++ compatible = "rockchip,gpio-bank"; ++ reg = <0x0 0x2ae30000 0x0 0x200>; ++ clocks = <&cru PCLK_GPIO3>, <&cru DBCLK_GPIO3>; ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 96 32>; ++ interrupts = ; ++ interrupt-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++ ++ gpio4: gpio@2ae40000 { ++ compatible = "rockchip,gpio-bank"; ++ reg = <0x0 0x2ae40000 0x0 0x200>; ++ clocks = <&cru PCLK_GPIO4>, <&cru DBCLK_GPIO4>; ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 128 32>; ++ interrupts = ; ++ interrupt-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++ }; ++ }; ++}; ++ ++#include "rk3576-pinctrl.dtsi" diff --git a/lede/target/linux/rockchip/patches-6.12/011-v6.13-phy-rockchip-inno-usb2-convert-clock-management-to-bulk.patch b/lede/target/linux/rockchip/patches-6.12/011-v6.13-phy-rockchip-inno-usb2-convert-clock-management-to-bulk.patch new file mode 100644 index 0000000000..ede918bbbc --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/011-v6.13-phy-rockchip-inno-usb2-convert-clock-management-to-bulk.patch @@ -0,0 +1,119 @@ +From 86e2ed4e9a9680013ec9ab7c0428c9b8c5108efe Mon Sep 17 00:00:00 2001 +From: Frank Wang +Date: Wed, 16 Oct 2024 15:37:10 +0800 +Subject: [PATCH] phy: rockchip: inno-usb2: convert clock management to bulk + +Since some Rockchip SoCs (e.g RK3576) have more than one clock, +this converts the clock management from single to bulk method to +make the driver more flexible. + +Signed-off-by: Frank Wang +Reviewed-by: Heiko Stuebner +Link: https://lore.kernel.org/r/20241016073713.14133-1-frawang.cn@gmail.com +Signed-off-by: Vinod Koul +--- + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 45 +++++++++++++++---- + 1 file changed, 37 insertions(+), 8 deletions(-) + +--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +@@ -229,9 +229,10 @@ struct rockchip_usb2phy_port { + * @dev: pointer to device. + * @grf: General Register Files regmap. + * @usbgrf: USB General Register Files regmap. +- * @clk: clock struct of phy input clk. ++ * @clks: array of phy input clocks. + * @clk480m: clock struct of phy output clk. + * @clk480m_hw: clock struct of phy output clk management. ++ * @num_clks: number of phy input clocks. + * @phy_reset: phy reset control. + * @chg_state: states involved in USB charger detection. + * @chg_type: USB charger types. +@@ -246,9 +247,10 @@ struct rockchip_usb2phy { + struct device *dev; + struct regmap *grf; + struct regmap *usbgrf; +- struct clk *clk; ++ struct clk_bulk_data *clks; + struct clk *clk480m; + struct clk_hw clk480m_hw; ++ int num_clks; + struct reset_control *phy_reset; + enum usb_chg_state chg_state; + enum power_supply_type chg_type; +@@ -310,6 +312,13 @@ static int rockchip_usb2phy_reset(struct + return 0; + } + ++static void rockchip_usb2phy_clk_bulk_disable(void *data) ++{ ++ struct rockchip_usb2phy *rphy = data; ++ ++ clk_bulk_disable_unprepare(rphy->num_clks, rphy->clks); ++} ++ + static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw) + { + struct rockchip_usb2phy *rphy = +@@ -376,7 +385,9 @@ rockchip_usb2phy_clk480m_register(struct + { + struct device_node *node = rphy->dev->of_node; + struct clk_init_data init; ++ struct clk *refclk = NULL; + const char *clk_name; ++ int i; + int ret = 0; + + init.flags = 0; +@@ -386,8 +397,15 @@ rockchip_usb2phy_clk480m_register(struct + /* optional override of the clockname */ + of_property_read_string(node, "clock-output-names", &init.name); + +- if (rphy->clk) { +- clk_name = __clk_get_name(rphy->clk); ++ for (i = 0; i < rphy->num_clks; i++) { ++ if (!strncmp(rphy->clks[i].id, "phyclk", 6)) { ++ refclk = rphy->clks[i].clk; ++ break; ++ } ++ } ++ ++ if (!IS_ERR(refclk)) { ++ clk_name = __clk_get_name(refclk); + init.parent_names = &clk_name; + init.num_parents = 1; + } else { +@@ -1406,11 +1424,13 @@ static int rockchip_usb2phy_probe(struct + if (IS_ERR(rphy->phy_reset)) + return PTR_ERR(rphy->phy_reset); + +- rphy->clk = devm_clk_get_optional_enabled(dev, "phyclk"); +- if (IS_ERR(rphy->clk)) { +- return dev_err_probe(&pdev->dev, PTR_ERR(rphy->clk), +- "failed to get phyclk\n"); +- } ++ ret = devm_clk_bulk_get_all(dev, &rphy->clks); ++ if (ret == -EPROBE_DEFER) ++ return dev_err_probe(&pdev->dev, -EPROBE_DEFER, ++ "failed to get phy clock\n"); ++ ++ /* Clocks are optional */ ++ rphy->num_clks = ret < 0 ? 0 : ret; + + ret = rockchip_usb2phy_clk480m_register(rphy); + if (ret) { +@@ -1418,6 +1438,14 @@ static int rockchip_usb2phy_probe(struct + return ret; + } + ++ ret = clk_bulk_prepare_enable(rphy->num_clks, rphy->clks); ++ if (ret) ++ return dev_err_probe(dev, ret, "failed to enable phy clock\n"); ++ ++ ret = devm_add_action_or_reset(dev, rockchip_usb2phy_clk_bulk_disable, rphy); ++ if (ret) ++ return ret; ++ + if (rphy->phy_cfg->phy_tuning) { + ret = rphy->phy_cfg->phy_tuning(rphy); + if (ret) diff --git a/lede/target/linux/rockchip/patches-6.12/012-v6.13-phy-rockchip-inno-usb2-Add-usb2-phys-support-for-rk3576.patch b/lede/target/linux/rockchip/patches-6.12/012-v6.13-phy-rockchip-inno-usb2-Add-usb2-phys-support-for-rk3576.patch new file mode 100644 index 0000000000..5984a99f90 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/012-v6.13-phy-rockchip-inno-usb2-Add-usb2-phys-support-for-rk3576.patch @@ -0,0 +1,143 @@ +From 3d7de6e870ece5a32153382df9df6fb87613335e Mon Sep 17 00:00:00 2001 +From: William Wu +Date: Wed, 16 Oct 2024 15:37:13 +0800 +Subject: [PATCH] phy: rockchip: inno-usb2: Add usb2 phys support for rk3576 + +The RK3576 SoC has two independent USB2.0 PHYs, and each PHY has +one port. This adds device specific data for it. + +Signed-off-by: William Wu +Signed-off-by: Frank Wang +Reviewed-by: Heiko Stuebner +Link: https://lore.kernel.org/r/20241016073713.14133-4-frawang.cn@gmail.com +Signed-off-by: Vinod Koul +--- + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 103 ++++++++++++++++++ + 1 file changed, 103 insertions(+) + +--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +@@ -1523,6 +1523,30 @@ static int rk3128_usb2phy_tuning(struct + BIT(2) << BIT_WRITEABLE_SHIFT | 0); + } + ++static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy) ++{ ++ int ret; ++ u32 reg = rphy->phy_cfg->reg; ++ ++ /* Deassert SIDDQ to power on analog block */ ++ ret = regmap_write(rphy->grf, reg + 0x0010, GENMASK(29, 29) | 0x0000); ++ if (ret) ++ return ret; ++ ++ /* Do reset after exit IDDQ mode */ ++ ret = rockchip_usb2phy_reset(rphy); ++ if (ret) ++ return ret; ++ ++ /* HS DC Voltage Level Adjustment 4'b1001 : +5.89% */ ++ ret |= regmap_write(rphy->grf, reg + 0x000c, GENMASK(27, 24) | 0x0900); ++ ++ /* HS Transmitter Pre-Emphasis Current Control 2'b10 : 2x */ ++ ret |= regmap_write(rphy->grf, reg + 0x0010, GENMASK(20, 19) | 0x0010); ++ ++ return ret; ++} ++ + static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy) + { + int ret; +@@ -1951,6 +1975,84 @@ static const struct rockchip_usb2phy_cfg + { /* sentinel */ } + }; + ++static const struct rockchip_usb2phy_cfg rk3576_phy_cfgs[] = { ++ { ++ .reg = 0x0, ++ .num_ports = 1, ++ .phy_tuning = rk3576_usb2phy_tuning, ++ .clkout_ctl = { 0x0008, 0, 0, 1, 0 }, ++ .port_cfgs = { ++ [USB2PHY_PORT_OTG] = { ++ .phy_sus = { 0x0000, 8, 0, 0, 0x1d1 }, ++ .bvalid_det_en = { 0x00c0, 1, 1, 0, 1 }, ++ .bvalid_det_st = { 0x00c4, 1, 1, 0, 1 }, ++ .bvalid_det_clr = { 0x00c8, 1, 1, 0, 1 }, ++ .ls_det_en = { 0x00c0, 0, 0, 0, 1 }, ++ .ls_det_st = { 0x00c4, 0, 0, 0, 1 }, ++ .ls_det_clr = { 0x00c8, 0, 0, 0, 1 }, ++ .disfall_en = { 0x00c0, 6, 6, 0, 1 }, ++ .disfall_st = { 0x00c4, 6, 6, 0, 1 }, ++ .disfall_clr = { 0x00c8, 6, 6, 0, 1 }, ++ .disrise_en = { 0x00c0, 5, 5, 0, 1 }, ++ .disrise_st = { 0x00c4, 5, 5, 0, 1 }, ++ .disrise_clr = { 0x00c8, 5, 5, 0, 1 }, ++ .utmi_avalid = { 0x0080, 1, 1, 0, 1 }, ++ .utmi_bvalid = { 0x0080, 0, 0, 0, 1 }, ++ .utmi_ls = { 0x0080, 5, 4, 0, 1 }, ++ } ++ }, ++ .chg_det = { ++ .cp_det = { 0x0080, 8, 8, 0, 1 }, ++ .dcp_det = { 0x0080, 8, 8, 0, 1 }, ++ .dp_det = { 0x0080, 9, 9, 1, 0 }, ++ .idm_sink_en = { 0x0010, 5, 5, 1, 0 }, ++ .idp_sink_en = { 0x0010, 5, 5, 0, 1 }, ++ .idp_src_en = { 0x0010, 14, 14, 0, 1 }, ++ .rdm_pdwn_en = { 0x0010, 14, 14, 0, 1 }, ++ .vdm_src_en = { 0x0010, 7, 6, 0, 3 }, ++ .vdp_src_en = { 0x0010, 7, 6, 0, 3 }, ++ }, ++ }, ++ { ++ .reg = 0x2000, ++ .num_ports = 1, ++ .phy_tuning = rk3576_usb2phy_tuning, ++ .clkout_ctl = { 0x2008, 0, 0, 1, 0 }, ++ .port_cfgs = { ++ [USB2PHY_PORT_OTG] = { ++ .phy_sus = { 0x2000, 8, 0, 0, 0x1d1 }, ++ .bvalid_det_en = { 0x20c0, 1, 1, 0, 1 }, ++ .bvalid_det_st = { 0x20c4, 1, 1, 0, 1 }, ++ .bvalid_det_clr = { 0x20c8, 1, 1, 0, 1 }, ++ .ls_det_en = { 0x20c0, 0, 0, 0, 1 }, ++ .ls_det_st = { 0x20c4, 0, 0, 0, 1 }, ++ .ls_det_clr = { 0x20c8, 0, 0, 0, 1 }, ++ .disfall_en = { 0x20c0, 6, 6, 0, 1 }, ++ .disfall_st = { 0x20c4, 6, 6, 0, 1 }, ++ .disfall_clr = { 0x20c8, 6, 6, 0, 1 }, ++ .disrise_en = { 0x20c0, 5, 5, 0, 1 }, ++ .disrise_st = { 0x20c4, 5, 5, 0, 1 }, ++ .disrise_clr = { 0x20c8, 5, 5, 0, 1 }, ++ .utmi_avalid = { 0x2080, 1, 1, 0, 1 }, ++ .utmi_bvalid = { 0x2080, 0, 0, 0, 1 }, ++ .utmi_ls = { 0x2080, 5, 4, 0, 1 }, ++ } ++ }, ++ .chg_det = { ++ .cp_det = { 0x2080, 8, 8, 0, 1 }, ++ .dcp_det = { 0x2080, 8, 8, 0, 1 }, ++ .dp_det = { 0x2080, 9, 9, 1, 0 }, ++ .idm_sink_en = { 0x2010, 5, 5, 1, 0 }, ++ .idp_sink_en = { 0x2010, 5, 5, 0, 1 }, ++ .idp_src_en = { 0x2010, 14, 14, 0, 1 }, ++ .rdm_pdwn_en = { 0x2010, 14, 14, 0, 1 }, ++ .vdm_src_en = { 0x2010, 7, 6, 0, 3 }, ++ .vdp_src_en = { 0x2010, 7, 6, 0, 3 }, ++ }, ++ }, ++ { /* sentinel */ } ++}; ++ + static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { + { + .reg = 0x0000, +@@ -2122,6 +2224,7 @@ static const struct of_device_id rockchi + { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, + { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, + { .compatible = "rockchip,rk3568-usb2phy", .data = &rk3568_phy_cfgs }, ++ { .compatible = "rockchip,rk3576-usb2phy", .data = &rk3576_phy_cfgs }, + { .compatible = "rockchip,rk3588-usb2phy", .data = &rk3588_phy_cfgs }, + { .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs }, + {} diff --git a/lede/target/linux/rockchip/patches-6.12/013-v6.13-phy-rockchip-usbdp-add-rk3576-device-match-data.patch b/lede/target/linux/rockchip/patches-6.12/013-v6.13-phy-rockchip-usbdp-add-rk3576-device-match-data.patch new file mode 100644 index 0000000000..36bb986793 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/013-v6.13-phy-rockchip-usbdp-add-rk3576-device-match-data.patch @@ -0,0 +1,73 @@ +From a76de028c619dd18f89786805bcc7bb4d379ea9f Mon Sep 17 00:00:00 2001 +From: Frank Wang +Date: Mon, 14 Oct 2024 10:03:42 +0800 +Subject: [PATCH] phy: rockchip: usbdp: add rk3576 device match data + +This adds RK3576 device match data support. + +Signed-off-by: Frank Wang +Acked-by: Dragan Simic +Reviewed-by: Heiko Stuebner +Link: https://lore.kernel.org/r/20241014020342.15974-2-frawang.cn@gmail.com +Signed-off-by: Vinod Koul +--- + drivers/phy/rockchip/phy-rockchip-usbdp.c | 41 +++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c ++++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c +@@ -1538,6 +1538,43 @@ static const char * const rk_udphy_rst_l + "init", "cmn", "lane", "pcs_apb", "pma_apb" + }; + ++static const struct rk_udphy_cfg rk3576_udphy_cfgs = { ++ .num_phys = 1, ++ .phy_ids = { 0x2b010000 }, ++ .num_rsts = ARRAY_SIZE(rk_udphy_rst_list), ++ .rst_list = rk_udphy_rst_list, ++ .grfcfg = { ++ /* u2phy-grf */ ++ .bvalid_phy_con = RK_UDPHY_GEN_GRF_REG(0x0010, 1, 0, 0x2, 0x3), ++ .bvalid_grf_con = RK_UDPHY_GEN_GRF_REG(0x0000, 15, 14, 0x1, 0x3), ++ ++ /* usb-grf */ ++ .usb3otg0_cfg = RK_UDPHY_GEN_GRF_REG(0x0030, 15, 0, 0x1100, 0x0188), ++ ++ /* usbdpphy-grf */ ++ .low_pwrn = RK_UDPHY_GEN_GRF_REG(0x0004, 13, 13, 0, 1), ++ .rx_lfps = RK_UDPHY_GEN_GRF_REG(0x0004, 14, 14, 0, 1), ++ }, ++ .vogrfcfg = { ++ { ++ .hpd_trigger = RK_UDPHY_GEN_GRF_REG(0x0000, 11, 10, 1, 3), ++ .dp_lane_reg = 0x0000, ++ }, ++ }, ++ .dp_tx_ctrl_cfg = { ++ rk3588_dp_tx_drv_ctrl_rbr_hbr_typec, ++ rk3588_dp_tx_drv_ctrl_rbr_hbr_typec, ++ rk3588_dp_tx_drv_ctrl_hbr2, ++ rk3588_dp_tx_drv_ctrl_hbr3, ++ }, ++ .dp_tx_ctrl_cfg_typec = { ++ rk3588_dp_tx_drv_ctrl_rbr_hbr_typec, ++ rk3588_dp_tx_drv_ctrl_rbr_hbr_typec, ++ rk3588_dp_tx_drv_ctrl_hbr2, ++ rk3588_dp_tx_drv_ctrl_hbr3, ++ }, ++}; ++ + static const struct rk_udphy_cfg rk3588_udphy_cfgs = { + .num_phys = 2, + .phy_ids = { +@@ -1585,6 +1622,10 @@ static const struct rk_udphy_cfg rk3588_ + + static const struct of_device_id rk_udphy_dt_match[] = { + { ++ .compatible = "rockchip,rk3576-usbdp-phy", ++ .data = &rk3576_udphy_cfgs ++ }, ++ { + .compatible = "rockchip,rk3588-usbdp-phy", + .data = &rk3588_udphy_cfgs + }, diff --git a/lede/target/linux/rockchip/patches-6.12/014-v6.13-gpio-rockchip-explan-the-format-of-the-GPIO-version-ID.patch b/lede/target/linux/rockchip/patches-6.12/014-v6.13-gpio-rockchip-explan-the-format-of-the-GPIO-version-ID.patch new file mode 100644 index 0000000000..38a171acff --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/014-v6.13-gpio-rockchip-explan-the-format-of-the-GPIO-version-ID.patch @@ -0,0 +1,37 @@ +From 591ae6bed250e4067db926313ff7279d23a1c7d1 Mon Sep 17 00:00:00 2001 +From: Ye Zhang +Date: Tue, 12 Nov 2024 09:54:05 +0800 +Subject: [PATCH] gpio: rockchip: explan the format of the GPIO version ID + +Remove redundant comments and provide a detailed explanation of the +GPIO version ID. + +Signed-off-by: Ye Zhang +Reviewed-by: Andy Shevchenko +Reviewed-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241112015408.3139996-2-ye.zhang@rock-chips.com +Signed-off-by: Bartosz Golaszewski +--- + drivers/gpio/gpio-rockchip.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/gpio/gpio-rockchip.c ++++ b/drivers/gpio/gpio-rockchip.c +@@ -26,9 +26,15 @@ + #include "../pinctrl/core.h" + #include "../pinctrl/pinctrl-rockchip.h" + ++/* ++ * Version ID Register ++ * Bits [31:24] - Major Version ++ * Bits [23:16] - Minor Version ++ * Bits [15:0] - Revision Number ++ */ + #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */ +-#define GPIO_TYPE_V2 (0x01000C2B) /* GPIO Version ID 0x01000C2B */ +-#define GPIO_TYPE_V2_1 (0x0101157C) /* GPIO Version ID 0x0101157C */ ++#define GPIO_TYPE_V2 (0x01000C2B) ++#define GPIO_TYPE_V2_1 (0x0101157C) + + static const struct rockchip_gpio_regs gpio_regs_v1 = { + .port_dr = 0x00, diff --git a/lede/target/linux/rockchip/patches-6.12/015-v6.13-gpio-rockchip-change-the-GPIO-version-judgment-logic.patch b/lede/target/linux/rockchip/patches-6.12/015-v6.13-gpio-rockchip-change-the-GPIO-version-judgment-logic.patch new file mode 100644 index 0000000000..13bfa981e9 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/015-v6.13-gpio-rockchip-change-the-GPIO-version-judgment-logic.patch @@ -0,0 +1,46 @@ +From 41209307cad7f14c387c68375a93b50e54261a53 Mon Sep 17 00:00:00 2001 +From: Ye Zhang +Date: Tue, 12 Nov 2024 09:54:06 +0800 +Subject: [PATCH] gpio: rockchip: change the GPIO version judgment logic + +Have a list of valid IDs and default to -ENODEV. + +Signed-off-by: Ye Zhang +Reviewed-by: Sebastian Reichel +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20241112015408.3139996-3-ye.zhang@rock-chips.com +Signed-off-by: Bartosz Golaszewski +--- + drivers/gpio/gpio-rockchip.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/gpio/gpio-rockchip.c ++++ b/drivers/gpio/gpio-rockchip.c +@@ -667,8 +667,9 @@ static int rockchip_get_bank_data(struct + clk_prepare_enable(bank->clk); + id = readl(bank->reg_base + gpio_regs_v2.version_id); + +- /* If not gpio v2, that is default to v1. */ +- if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) { ++ switch (id) { ++ case GPIO_TYPE_V2: ++ case GPIO_TYPE_V2_1: + bank->gpio_regs = &gpio_regs_v2; + bank->gpio_type = GPIO_TYPE_V2; + bank->db_clk = of_clk_get(bank->of_node, 1); +@@ -677,9 +678,14 @@ static int rockchip_get_bank_data(struct + clk_disable_unprepare(bank->clk); + return -EINVAL; + } +- } else { ++ break; ++ case GPIO_TYPE_V1: + bank->gpio_regs = &gpio_regs_v1; + bank->gpio_type = GPIO_TYPE_V1; ++ break; ++ default: ++ dev_err(bank->dev, "unsupported version ID: 0x%08x\n", id); ++ return -ENODEV; + } + + return 0; diff --git a/lede/target/linux/rockchip/patches-6.12/016-v6.13-gpio-rockchip-support-new-version-GPIO.patch b/lede/target/linux/rockchip/patches-6.12/016-v6.13-gpio-rockchip-support-new-version-GPIO.patch new file mode 100644 index 0000000000..4c10f80e68 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/016-v6.13-gpio-rockchip-support-new-version-GPIO.patch @@ -0,0 +1,34 @@ +From 8bcbd0379c05c66ce2e842c7e8901aa317cdf04e Mon Sep 17 00:00:00 2001 +From: Ye Zhang +Date: Tue, 12 Nov 2024 09:54:07 +0800 +Subject: [PATCH] gpio: rockchip: support new version GPIO + +Support the next version GPIO controller on SoCs like rk3576. + +Signed-off-by: Ye Zhang +Reviewed-by: Andy Shevchenko +Reviewed-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20241112015408.3139996-4-ye.zhang@rock-chips.com +Signed-off-by: Bartosz Golaszewski +--- + drivers/gpio/gpio-rockchip.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpio/gpio-rockchip.c ++++ b/drivers/gpio/gpio-rockchip.c +@@ -35,6 +35,7 @@ + #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */ + #define GPIO_TYPE_V2 (0x01000C2B) + #define GPIO_TYPE_V2_1 (0x0101157C) ++#define GPIO_TYPE_V2_2 (0x010219C8) + + static const struct rockchip_gpio_regs gpio_regs_v1 = { + .port_dr = 0x00, +@@ -670,6 +671,7 @@ static int rockchip_get_bank_data(struct + switch (id) { + case GPIO_TYPE_V2: + case GPIO_TYPE_V2_1: ++ case GPIO_TYPE_V2_2: + bank->gpio_regs = &gpio_regs_v2; + bank->gpio_type = GPIO_TYPE_V2; + bank->db_clk = of_clk_get(bank->of_node, 1); diff --git a/lede/target/linux/rockchip/patches-6.12/114-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch b/lede/target/linux/rockchip/patches-6.12/114-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch new file mode 100644 index 0000000000..1c9b3280a0 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/114-arm64-dts-rockchip-Update-LED-properties-for-Orange-.patch @@ -0,0 +1,40 @@ +From d2166e3b3680bd2b206aebf1e1ce4c0d346f3c50 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Fri, 19 May 2023 12:10:52 +0800 +Subject: [PATCH] arm64: dts: rockchip: Update LED properties for Orange Pi R1 + Plus + +Add OpenWrt's LED aliases for showing system status. + +Signed-off-by: Tianling Shen +--- + .../dts/rockchip/rk3328-orangepi-r1-plus.dts | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -18,6 +18,11 @@ + ethernet0 = &gmac2io; + ethernet1 = &rtl8153; + mmc0 = &sdmmc; ++ ++ led-boot = &status_led; ++ led-failsafe = &status_led; ++ led-running = &status_led; ++ led-upgrade = &status_led; + }; + + chosen { +@@ -42,11 +47,10 @@ + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + }; + +- led-1 { ++ status_led: led-1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "heartbeat"; + }; + + led-2 { diff --git a/lede/target/linux/rockchip/patches-6.12/115-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch b/lede/target/linux/rockchip/patches-6.12/115-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch new file mode 100644 index 0000000000..a7a384d534 --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/115-arm64-dts-rockchip-add-LED-configuration-to-Orange-P.patch @@ -0,0 +1,24 @@ +From b46a530d12ada422b9d5b2b97059e0d3ed950b40 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Fri, 19 May 2023 12:38:04 +0800 +Subject: [PATCH] arm64: dts: rockchip: add LED configuration to Orange Pi R1 + Plus + +Add the correct value for the RTL8153 LED configuration register to +match the blink behavior of the other port on the device. + +Signed-off-by: Tianling Shen +--- + arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -366,6 +366,7 @@ + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; + }; + }; + diff --git a/lede/target/linux/rockchip/patches-6.12/992-rockchip-rk3399-overclock-to-2.2-1.8-GHz.patch b/lede/target/linux/rockchip/patches-6.12/992-rockchip-rk3399-overclock-to-2.2-1.8-GHz.patch new file mode 100644 index 0000000000..79639c701f --- /dev/null +++ b/lede/target/linux/rockchip/patches-6.12/992-rockchip-rk3399-overclock-to-2.2-1.8-GHz.patch @@ -0,0 +1,43 @@ +From 04202df5cb497b1934c95211cf43784ef62245a4 Mon Sep 17 00:00:00 2001 +From: Tianling Shen +Date: Mon, 18 Oct 2021 12:47:30 +0800 +Subject: [PATCH] rockchip: rk3399: overclock to 2.2/1.8 GHz + +It's stable enough to overclock cpu frequency to 2.2/1.8 GHz, +and for better performance. + +Co-development-by: gzelvis +Signed-off-by: Tianling Shen +--- + arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi +@@ -0,0 +1,26 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd ++ */ ++ ++#include "rk3399-op1.dtsi" ++ ++/ { ++ cluster0_opp: opp-table-0 { ++ opp07 { ++ opp-hz = /bits/ 64 <1608000000>; ++ opp-microvolt = <1225000 1225000 1225000>; ++ }; ++ opp08 { ++ opp-hz = /bits/ 64 <1800000000>; ++ opp-microvolt = <1275000 1275000 1275000>; ++ }; ++ }; ++ ++ cluster1_opp: opp-table-1 { ++ opp09 { ++ opp-hz = /bits/ 64 <2208000000>; ++ opp-microvolt = <1325000 1325000 1325000>; ++ }; ++ }; ++}; diff --git a/mihomo/constant/provider/interface.go b/mihomo/constant/provider/interface.go index 925c173469..4309adacbf 100644 --- a/mihomo/constant/provider/interface.go +++ b/mihomo/constant/provider/interface.go @@ -13,6 +13,7 @@ const ( File VehicleType = iota HTTP Compatible + Inline ) // VehicleType defined @@ -26,6 +27,8 @@ func (v VehicleType) String() string { return "HTTP" case Compatible: return "Compatible" + case Inline: + return "Inline" default: return "Unknown" } diff --git a/mihomo/docs/config.yaml b/mihomo/docs/config.yaml index fda14820bb..ca48f0e231 100644 --- a/mihomo/docs/config.yaml +++ b/mihomo/docs/config.yaml @@ -1014,6 +1014,14 @@ rule-providers: format: mrs behavior: domain path: /path/to/save/file.mrs + rule4: + type: inline + behavior: domain # classical / ipcidr + payload: + - '.blogger.com' + - '*.*.microsoft.com' + - 'books.itunes.apple.com' + rules: - RULE-SET,rule1,REJECT - IP-ASN,1,PROXY diff --git a/mihomo/log/log.go b/mihomo/log/log.go index 6f565e7cbb..f1c68b4270 100644 --- a/mihomo/log/log.go +++ b/mihomo/log/log.go @@ -20,7 +20,7 @@ func init() { log.SetLevel(log.DebugLevel) log.SetFormatter(&log.TextFormatter{ FullTimestamp: true, - TimestampFormat: "2006-01-02T15:04:05.999999999Z07:00", + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", EnvironmentOverrideColors: true, }) } diff --git a/mihomo/rules/common/base.go b/mihomo/rules/common/base.go index 496bcaeecd..1abbe72cf3 100644 --- a/mihomo/rules/common/base.go +++ b/mihomo/rules/common/base.go @@ -3,6 +3,8 @@ package common import ( "errors" + C "github.com/metacubex/mihomo/constant" + "golang.org/x/exp/slices" ) @@ -38,3 +40,5 @@ func ParseParams(params []string) (isSrc bool, noResolve bool) { } return } + +type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) diff --git a/mihomo/rules/logic/logic.go b/mihomo/rules/logic/logic.go index 6e67285268..f7b5a987ef 100644 --- a/mihomo/rules/logic/logic.go +++ b/mihomo/rules/logic/logic.go @@ -23,9 +23,7 @@ type Logic struct { payloadOnce sync.Once } -type ParseRuleFunc func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (C.Rule, error) - -func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule ParseRuleFunc) (*Logic, error) { +func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.SubRules, subRules: subRules} err := logic.parsePayload(fmt.Sprintf("(%s)", payload), parseRule) if err != nil { @@ -38,7 +36,7 @@ func NewSubRule(payload, adapter string, subRules map[string][]C.Rule, parseRule return logic, nil } -func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewNOT(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.NOT} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -51,7 +49,7 @@ func NewNOT(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, er return logic, nil } -func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewOR(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.OR} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -60,7 +58,7 @@ func NewOR(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, err return logic, nil } -func NewAND(payload string, adapter string, parseRule ParseRuleFunc) (*Logic, error) { +func NewAND(payload string, adapter string, parseRule common.ParseRuleFunc) (*Logic, error) { logic := &Logic{Base: &common.Base{}, payload: payload, adapter: adapter, ruleType: C.AND} err := logic.parsePayload(payload, parseRule) if err != nil { @@ -79,7 +77,7 @@ func (r Range) containRange(preStart, preEnd int) bool { return preStart < r.start && preEnd > r.end } -func (logic *Logic) payloadToRule(subPayload string, parseRule ParseRuleFunc) (C.Rule, error) { +func (logic *Logic) payloadToRule(subPayload string, parseRule common.ParseRuleFunc) (C.Rule, error) { splitStr := strings.SplitN(subPayload, ",", 2) if len(splitStr) < 2 { return nil, fmt.Errorf("[%s] format is error", subPayload) @@ -160,7 +158,7 @@ func (logic *Logic) findSubRuleRange(payload string, ruleRanges []Range) []Range return subRuleRange } -func (logic *Logic) parsePayload(payload string, parseRule ParseRuleFunc) error { +func (logic *Logic) parsePayload(payload string, parseRule common.ParseRuleFunc) error { regex, err := regexp.Compile("\\(.*\\)") if err != nil { return err diff --git a/mihomo/rules/parser.go b/mihomo/rules/parser.go index 4f7ddbe14f..83325433d4 100644 --- a/mihomo/rules/parser.go +++ b/mihomo/rules/parser.go @@ -91,3 +91,5 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string] return } + +var _ RC.ParseRuleFunc = ParseRule diff --git a/mihomo/rules/provider/parse.go b/mihomo/rules/provider/parse.go index b04096fb3c..4589317d36 100644 --- a/mihomo/rules/provider/parse.go +++ b/mihomo/rules/provider/parse.go @@ -9,6 +9,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" ) var ( @@ -16,17 +17,18 @@ var ( ) type ruleProviderSchema struct { - Type string `provider:"type"` - Behavior string `provider:"behavior"` - Path string `provider:"path,omitempty"` - URL string `provider:"url,omitempty"` - Proxy string `provider:"proxy,omitempty"` - Format string `provider:"format,omitempty"` - Interval int `provider:"interval,omitempty"` - SizeLimit int64 `provider:"size-limit,omitempty"` + Type string `provider:"type"` + Behavior string `provider:"behavior"` + Path string `provider:"path,omitempty"` + URL string `provider:"url,omitempty"` + Proxy string `provider:"proxy,omitempty"` + Format string `provider:"format,omitempty"` + Interval int `provider:"interval,omitempty"` + SizeLimit int64 `provider:"size-limit,omitempty"` + Payload []string `provider:"payload,omitempty"` } -func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) (P.RuleProvider, error) { +func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc) (P.RuleProvider, error) { schema := &ruleProviderSchema{} decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true}) if err := decoder.Decode(mapping, schema); err != nil { @@ -55,6 +57,8 @@ func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(t } } vehicle = resource.NewHTTPVehicle(schema.URL, path, schema.Proxy, nil, resource.DefaultHttpTimeout, schema.SizeLimit) + case "inline": + return newInlineProvider(name, behavior, schema.Payload, parse), nil default: return nil, fmt.Errorf("unsupported vehicle type: %s", schema.Type) } diff --git a/mihomo/rules/provider/provider.go b/mihomo/rules/provider/provider.go index 0cbf83bacd..13c713c8c2 100644 --- a/mihomo/rules/provider/provider.go +++ b/mihomo/rules/provider/provider.go @@ -13,6 +13,7 @@ import ( "github.com/metacubex/mihomo/component/resource" C "github.com/metacubex/mihomo/constant" P "github.com/metacubex/mihomo/constant/provider" + "github.com/metacubex/mihomo/rules/common" "gopkg.in/yaml.v3" ) @@ -24,9 +25,13 @@ func SetTunnel(t P.Tunnel) { } type ruleSetProvider struct { + ruleSetProviderBase *resource.Fetcher[ruleStrategy] + format P.RuleFormat +} + +type ruleSetProviderBase struct { behavior P.RuleBehavior - format P.RuleFormat strategy ruleStrategy } @@ -61,7 +66,7 @@ type mrsRuleStrategy interface { DumpMrs(f func(key string) bool) } -func (rp *ruleSetProvider) Type() P.ProviderType { +func (rp *ruleSetProviderBase) Type() P.ProviderType { return P.Rule } @@ -75,40 +80,51 @@ func (rp *ruleSetProvider) Update() error { return err } -func (rp *ruleSetProvider) Behavior() P.RuleBehavior { +func (rp *ruleSetProviderBase) Behavior() P.RuleBehavior { return rp.behavior } -func (rp *ruleSetProvider) Count() int { +func (rp *ruleSetProviderBase) Count() int { return rp.strategy.Count() } -func (rp *ruleSetProvider) Match(metadata *C.Metadata) bool { +func (rp *ruleSetProviderBase) Match(metadata *C.Metadata) bool { return rp.strategy != nil && rp.strategy.Match(metadata) } -func (rp *ruleSetProvider) ShouldResolveIP() bool { +func (rp *ruleSetProviderBase) ShouldResolveIP() bool { return rp.strategy.ShouldResolveIP() } -func (rp *ruleSetProvider) ShouldFindProcess() bool { +func (rp *ruleSetProviderBase) ShouldFindProcess() bool { return rp.strategy.ShouldFindProcess() } -func (rp *ruleSetProvider) Strategy() any { +func (rp *ruleSetProviderBase) Strategy() any { return rp.strategy } +type providerForApi struct { + Behavior string `json:"behavior"` + Format string `json:"format"` + Name string `json:"name"` + RuleCount int `json:"ruleCount"` + Type string `json:"type"` + VehicleType string `json:"vehicleType"` + UpdatedAt time.Time `json:"updatedAt"` + Payload []string `json:"payload,omitempty"` +} + func (rp *ruleSetProvider) MarshalJSON() ([]byte, error) { return json.Marshal( - map[string]interface{}{ - "behavior": rp.behavior.String(), - "format": rp.format.String(), - "name": rp.Name(), - "ruleCount": rp.strategy.Count(), - "type": rp.Type().String(), - "updatedAt": rp.UpdatedAt(), - "vehicleType": rp.VehicleType().String(), + providerForApi{ + Behavior: rp.behavior.String(), + Format: rp.format.String(), + Name: rp.Fetcher.Name(), + RuleCount: rp.strategy.Count(), + Type: rp.Type().String(), + UpdatedAt: rp.UpdatedAt(), + VehicleType: rp.VehicleType().String(), }) } @@ -117,11 +133,12 @@ func (rp *RuleSetProvider) Close() error { return rp.ruleSetProvider.Close() } -func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, - parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) P.RuleProvider { +func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, parse common.ParseRuleFunc) P.RuleProvider { rp := &ruleSetProvider{ - behavior: behavior, - format: format, + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + }, + format: format, } onUpdate := func(strategy ruleStrategy) { @@ -142,7 +159,7 @@ func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleForma return wrapper } -func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) ruleStrategy { +func newStrategy(behavior P.RuleBehavior, parse common.ParseRuleFunc) ruleStrategy { switch behavior { case P.Domain: strategy := NewDomainStrategy() @@ -158,8 +175,10 @@ func newStrategy(behavior P.RuleBehavior, parse func(tp, payload, target string, } } -var ErrNoPayload = errors.New("file must have a `payload` field") -var ErrInvalidFormat = errors.New("invalid format") +var ( + ErrNoPayload = errors.New("file must have a `payload` field") + ErrInvalidFormat = errors.New("invalid format") +) func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStrategy, error) { strategy.Reset() @@ -254,3 +273,66 @@ func rulesParse(buf []byte, strategy ruleStrategy, format P.RuleFormat) (ruleStr return strategy, nil } + +func rulesParseInline(rs []string, strategy ruleStrategy) ruleStrategy { + strategy.Reset() + for _, r := range rs { + if r != "" { + strategy.Insert(r) + } + } + strategy.FinishInsert() + return strategy +} + +type inlineProvider struct { + ruleSetProviderBase + name string + updateTime time.Time + payload []string +} + +func (i *inlineProvider) Name() string { + return i.name +} + +func (i *inlineProvider) Initial() error { + return nil +} + +func (i *inlineProvider) Update() error { + // make api update happy + i.updateTime = time.Now() + return nil +} + +func (i *inlineProvider) VehicleType() P.VehicleType { + return P.Inline +} + +func (i *inlineProvider) MarshalJSON() ([]byte, error) { + return json.Marshal( + providerForApi{ + Behavior: i.behavior.String(), + Name: i.Name(), + RuleCount: i.strategy.Count(), + Type: i.Type().String(), + VehicleType: i.VehicleType().String(), + UpdatedAt: i.updateTime, + Payload: i.payload, + }) +} + +func newInlineProvider(name string, behavior P.RuleBehavior, payload []string, parse common.ParseRuleFunc) P.RuleProvider { + rp := &inlineProvider{ + ruleSetProviderBase: ruleSetProviderBase{ + behavior: behavior, + strategy: newStrategy(behavior, parse), + }, + payload: payload, + name: name, + updateTime: time.Now(), + } + rp.strategy = rulesParseInline(payload, rp.strategy) + return rp +} diff --git a/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua b/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua index 33c5319d14..6851861399 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/controller/passwall.lua @@ -166,11 +166,11 @@ end function get_now_use_node() local path = "/tmp/etc/passwall/acl/default" local e = {} - local tcp_node = api.get_cache_var("GLOBAL_TCP_node") + local tcp_node = api.get_cache_var("ACL_GLOBAL_TCP_node") if tcp_node then e["TCP"] = tcp_node end - local udp_node = api.get_cache_var("GLOBAL_UDP_node") + local udp_node = api.get_cache_var("ACL_GLOBAL_UDP_node") if udp_node then e["UDP"] = udp_node end @@ -364,8 +364,8 @@ end function clear_all_nodes() uci:set(appname, '@global[0]', "enabled", "0") - uci:set(appname, '@global[0]', "tcp_node", "nil") - uci:set(appname, '@global[0]', "udp_node", "nil") + uci:delete(appname, '@global[0]', "tcp_node") + uci:delete(appname, '@global[0]', "udp_node") uci:foreach(appname, "socks", function(t) uci:delete(appname, t[".name"]) uci:set_list(appname, t[".name"], "autoswitch_backup_node", {}) @@ -374,8 +374,8 @@ function clear_all_nodes() uci:delete(appname, t[".name"]) end) uci:foreach(appname, "acl_rule", function(t) - uci:set(appname, t[".name"], "tcp_node", "nil") - uci:set(appname, t[".name"], "udp_node", "nil") + uci:delete(appname, t[".name"], "tcp_node") + uci:delete(appname, t[".name"], "udp_node") end) uci:foreach(appname, "nodes", function(node) uci:delete(appname, node['.name']) @@ -388,11 +388,11 @@ end function delete_select_nodes() local ids = luci.http.formvalue("ids") string.gsub(ids, '[^' .. "," .. ']+', function(w) - if (uci:get(appname, "@global[0]", "tcp_node") or "nil") == w then - uci:set(appname, '@global[0]', "tcp_node", "nil") + if (uci:get(appname, "@global[0]", "tcp_node") or "") == w then + uci:delete(appname, '@global[0]', "tcp_node") end - if (uci:get(appname, "@global[0]", "udp_node") or "nil") == w then - uci:set(appname, '@global[0]', "udp_node", "nil") + if (uci:get(appname, "@global[0]", "udp_node") or "") == w then + uci:delete(appname, '@global[0]', "udp_node") end uci:foreach(appname, "socks", function(t) if t["node"] == w then @@ -413,10 +413,10 @@ function delete_select_nodes() end) uci:foreach(appname, "acl_rule", function(t) if t["tcp_node"] == w then - uci:set(appname, t[".name"], "tcp_node", "nil") + uci:delete(appname, t[".name"], "tcp_node") end if t["udp_node"] == w then - uci:set(appname, t[".name"], "udp_node", "nil") + uci:delete(appname, t[".name"], "udp_node") end end) uci:foreach(appname, "nodes", function(t) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua index e4b13e1072..82a354bef7 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua @@ -52,7 +52,7 @@ o.rmempty = false ---- Remarks o = s:option(Value, "remarks", translate("Remarks")) o.default = arg[1] -o.rmempty = true +o.rmempty = false o = s:option(ListValue, "interface", translate("Source Interface")) o:value("", translate("All")) @@ -148,97 +148,117 @@ sources.write = dynamicList_write ---- TCP No Redir Ports local TCP_NO_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_no_redir_ports") o = s:option(Value, "tcp_no_redir_ports", translate("TCP No Redir Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o.validate = port_validate ---- UDP No Redir Ports local UDP_NO_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_no_redir_ports") o = s:option(Value, "udp_no_redir_ports", translate("UDP No Redir Ports"), - "" .. translate( - "Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") .. - "") -o.default = "default" + "" .. + translate("Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") .. + "") +o:value("", translate("Use global config") .. "(" .. UDP_NO_REDIR_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. UDP_NO_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o.validate = port_validate +o = s:option(DummyValue, "_hide_node_option", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ tcp_no_redir_ports = "1:65535", udp_no_redir_ports = "1:65535" }) +if TCP_NO_REDIR_PORTS == "1:65535" and UDP_NO_REDIR_PORTS == "1:65535" then + o:depends({ tcp_no_redir_ports = "", udp_no_redir_ports = "" }) +end + o = s:option(Flag, "use_global_config", translatef("Use global config")) o.default = "0" o.rmempty = false +o:depends({ _hide_node_option = "1", ['!reverse'] = true }) -tcp_node = s:option(ListValue, "tcp_node", "" .. translate("TCP Node") .. "") -tcp_node.default = "" -tcp_node:value("", translate("Close")) -tcp_node:depends("use_global_config", false) +o = s:option(ListValue, "tcp_node", "" .. translate("TCP Node") .. "") +o.default = "" +o:depends({ _hide_node_option = false, use_global_config = false }) -udp_node = s:option(ListValue, "udp_node", "" .. translate("UDP Node") .. "") -udp_node.default = "" -udp_node:value("", translate("Close")) -udp_node:value("tcp", translate("Same as the tcp node")) -udp_node:depends({ tcp_node = "", ['!reverse'] = true }) +o = s:option(DummyValue, "_tcp_node_bool", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ tcp_node = "", ['!reverse'] = true }) + +o = s:option(ListValue, "udp_node", "" .. translate("UDP Node") .. "") +o.default = "" +o:value("", translate("Close")) +o:value("tcp", translate("Same as the tcp node")) +o:depends({ _tcp_node_bool = "1" }) for k, v in pairs(nodes_table) do - tcp_node:value(v.id, v["remark"]) - udp_node:value(v.id, v["remark"]) + s.fields["tcp_node"]:value(v.id, v["remark"]) + s.fields["udp_node"]:value(v.id, v["remark"]) end +o = s:option(DummyValue, "_udp_node_bool", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ udp_node = "", ['!reverse'] = true }) + ---- TCP Proxy Drop Ports local TCP_PROXY_DROP_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_proxy_drop_ports") o = s:option(Value, "tcp_proxy_drop_ports", translate("TCP Proxy Drop Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")") o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- UDP Proxy Drop Ports local UDP_PROXY_DROP_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_proxy_drop_ports") o = s:option(Value, "udp_proxy_drop_ports", translate("UDP Proxy Drop Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")") o:value("443", translate("QUIC")) o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- TCP Redir Ports local TCP_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_redir_ports") o = s:option(Value, "tcp_redir_ports", translate("TCP Redir Ports"), translatef("Only work with using the %s node.", "TCP")) -o.default = "default" -o:value("default", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")") +o:value("", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o:value("80,443", "80,443") o:value("80:65535", "80 " .. translate("or more")) o:value("1:443", "443 " .. translate("or less")) o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- UDP Redir Ports local UDP_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_redir_ports") o = s:option(Value, "udp_redir_ports", translate("UDP Redir Ports"), translatef("Only work with using the %s node.", "UDP")) -o.default = "default" -o:value("default", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")") +o:value("", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o:value("53", "53") o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _udp_node_bool = "1" }) o = s:option(Flag, "use_direct_list", translatef("Use %s", translate("Direct List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(Flag, "use_proxy_list", translatef("Use %s", translate("Proxy List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(Flag, "use_block_list", translatef("Use %s", translate("Block List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) if has_gfwlist then o = s:option(Flag, "use_gfw_list", translatef("Use %s", translate("GFW List"))) o.default = "1" - o:depends({ tcp_node = "", ['!reverse'] = true }) + o:depends({ _tcp_node_bool = "1" }) end if has_chnlist or has_chnroute then @@ -247,36 +267,36 @@ if has_chnlist or has_chnroute then o:value("direct", translate("Direct Connection")) o:value("proxy", translate("Proxy")) o.default = "direct" - o:depends({ tcp_node = "", ['!reverse'] = true }) + o:depends({ _tcp_node_bool = "1" }) end o = s:option(ListValue, "tcp_proxy_mode", "TCP " .. translate("Proxy Mode")) o:value("disable", translate("No Proxy")) o:value("proxy", translate("Proxy")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(ListValue, "udp_proxy_mode", "UDP " .. translate("Proxy Mode")) o:value("disable", translate("No Proxy")) o:value("proxy", translate("Proxy")) -o:depends({ udp_node = "", ['!reverse'] = true }) +o:depends({ _udp_node_bool = "1" }) o = s:option(DummyValue, "switch_mode", " ") o.template = appname .. "/global/proxy" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) ---- DNS o = s:option(ListValue, "dns_shunt", "DNS " .. translate("Shunt")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o:value("dnsmasq", "Dnsmasq") o:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) o = s:option(Flag, "filter_proxy_ipv6", translate("Filter Proxy Host IPv6"), translate("Experimental feature.")) o.default = "0" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) ---- DNS Forward Mode o = s:option(ListValue, "dns_mode", translate("Filter Mode")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) if api.is_finded("dns2socks") then o:value("dns2socks", "dns2socks") end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 488cd50ace..958ff0aa6f 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -126,19 +126,19 @@ o = s:taboption("Main", Flag, "enabled", translate("Main switch")) o.rmempty = false ---- TCP Node -tcp_node = s:taboption("Main", ListValue, "tcp_node", "" .. translate("TCP Node") .. "") -tcp_node:value("nil", translate("Close")) +o = s:taboption("Main", ListValue, "tcp_node", "" .. translate("TCP Node") .. "") +o:value("", translate("Close")) ---- UDP Node -udp_node = s:taboption("Main", ListValue, "udp_node", "" .. translate("UDP Node") .. "") -udp_node:value("nil", translate("Close")) -udp_node:value("tcp", translate("Same as the tcp node")) +o = s:taboption("Main", ListValue, "udp_node", "" .. translate("UDP Node") .. "") +o:value("", translate("Close")) +o:value("tcp", translate("Same as the tcp node")) -- 分流 if (has_singbox or has_xray) and #nodes_table > 0 then local function get_cfgvalue(shunt_node_id, option) return function(self, section) - return m:get(shunt_node_id, option) or "nil" + return m:get(shunt_node_id, option) end end local function get_write(shunt_node_id, option) @@ -146,6 +146,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then m:set(shunt_node_id, option, value) end end + local function get_remove(shunt_node_id, option) + return function(self, section) + m:del(shunt_node_id, option) + end + end if #normal_list > 0 then for k, v in pairs(shunt_list) do local vid = v.id @@ -187,7 +192,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then if (has_singbox and has_xray) or (v.type == "sing-box" and not has_singbox) or (v.type == "Xray" and not has_xray) then type:depends("tcp_node", v.id) else - type:depends("tcp_node", "hide") --不存在的依赖,即始终隐藏 + type:depends("tcp_node", "__hide") --不存在的依赖,即始终隐藏 end uci:foreach(appname, "shunt_rules", function(e) @@ -197,8 +202,9 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, node_option, string.format('* %s', api.url("shunt_rules", id), e.remarks)) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("tcp_node", v.id) - o:value("nil", translate("Close")) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -206,9 +212,9 @@ if (has_singbox or has_xray) and #nodes_table > 0 then local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag") pt.write = get_write(v.id, id .. "_proxy_tag") - pt:value("nil", translate("Close")) + pt.remove = get_remove(v.id, id .. "_proxy_tag") + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k1, v1 in pairs(socks_list) do o:value(v1.id, v1.remark) end @@ -229,6 +235,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default"))) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("tcp_node", v.id) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -249,7 +256,8 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) - o:value("nil", translate("Close")) + o.remove = get_remove(v.id, id) + o:value("", translate("Close")) o:value("main", translate("Preproxy Node")) for k1, v1 in pairs(normal_list) do if v1.protocol ~= "_balancing" then @@ -263,7 +271,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then tips.cfgvalue = function(t, n) return string.format('%s', translate("There are no available nodes, please add or subscribe nodes first.")) end - tips:depends({ tcp_node = "nil", ["!reverse"] = true }) + tips:depends({ tcp_node = "", ["!reverse"] = true }) for k, v in pairs(shunt_list) do tips:depends("udp_node", v.id) end @@ -273,36 +281,35 @@ if (has_singbox or has_xray) and #nodes_table > 0 then end end -tcp_node_socks_port = s:taboption("Main", Value, "tcp_node_socks_port", translate("TCP Node") .. " Socks " .. translate("Listen Port")) -tcp_node_socks_port.default = 1070 -tcp_node_socks_port.datatype = "port" -tcp_node_socks_port:depends({ tcp_node = "nil", ["!reverse"] = true }) +o = s:taboption("Main", Value, "tcp_node_socks_port", translate("TCP Node") .. " Socks " .. translate("Listen Port")) +o.default = 1070 +o.datatype = "port" +o:depends({ tcp_node = "", ["!reverse"] = true }) --[[ if has_singbox or has_xray then - tcp_node_http_port = s:taboption("Main", Value, "tcp_node_http_port", translate("TCP Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) - tcp_node_http_port.default = 0 - tcp_node_http_port.datatype = "port" + o = s:taboption("Main", Value, "tcp_node_http_port", translate("TCP Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) + o.default = 0 + o.datatype = "port" end ]]-- -tcp_node_socks_bind_local = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) -tcp_node_socks_bind_local.default = "1" -tcp_node_socks_bind_local:depends({ tcp_node = "nil", ["!reverse"] = true }) +o = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o.default = "1" +o:depends({ tcp_node = "", ["!reverse"] = true }) s:tab("DNS", translate("DNS")) -dns_shunt = s:taboption("DNS", ListValue, "dns_shunt", "DNS " .. translate("Shunt")) -dns_shunt:value("dnsmasq", "Dnsmasq") -dns_shunt:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) +o = s:taboption("DNS", ListValue, "dns_shunt", "DNS " .. translate("Shunt")) +o:value("dnsmasq", "Dnsmasq") +o:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) if api.is_finded("smartdns") then - dns_shunt:value("smartdns", "SmartDNS") - group_domestic = s:taboption("DNS", Value, "group_domestic", translate("Domestic group name")) - group_domestic.placeholder = "local" - group_domestic:depends("dns_shunt", "smartdns") - group_domestic.description = translate("You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here.") + o:value("smartdns", "SmartDNS") + o = s:taboption("DNS", Value, "group_domestic", translate("Domestic group name")) + o.placeholder = "local" + o:depends("dns_shunt", "smartdns") + o.description = translate("You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here.") end o = s:taboption("DNS", ListValue, "direct_dns_mode", translate("Direct DNS") .. " " .. translate("Request protocol")) -o.default = "" o:value("", translate("Auto")) o:value("udp", translatef("Requery DNS By %s", "UDP")) o:value("tcp", translatef("Requery DNS By %s", "TCP")) @@ -399,23 +406,23 @@ if api.is_finded("smartdns") then end ---- DNS Forward Mode -dns_mode = s:taboption("DNS", ListValue, "dns_mode", translate("Filter Mode")) -dns_mode:value("udp", translatef("Requery DNS By %s", "UDP")) -dns_mode:value("tcp", translatef("Requery DNS By %s", "TCP")) +o = s:taboption("DNS", ListValue, "dns_mode", translate("Filter Mode")) +o:value("udp", translatef("Requery DNS By %s", "UDP")) +o:value("tcp", translatef("Requery DNS By %s", "TCP")) if chinadns_tls == 0 then - dns_mode:value("dot", translatef("Requery DNS By %s", "DoT")) + o:value("dot", translatef("Requery DNS By %s", "DoT")) end if api.is_finded("dns2socks") then - dns_mode:value("dns2socks", "dns2socks") + o:value("dns2socks", "dns2socks") end if has_singbox then - dns_mode:value("sing-box", "Sing-Box") + o:value("sing-box", "Sing-Box") end if has_xray then - dns_mode:value("xray", "Xray") + o:value("xray", "Xray") end if api.is_finded("smartdns") then - dns_mode:depends({ dns_shunt = "smartdns", ['!reverse'] = true }) + o:depends({ dns_shunt = "smartdns", ['!reverse'] = true }) end o = s:taboption("DNS", ListValue, "xray_dns_mode", translate("Request protocol")) @@ -426,7 +433,7 @@ o.cfgvalue = function(self, section) return m:get(section, "v2ray_dns_mode") end o.write = function(self, section, value) - if dns_mode:formvalue(section) == "xray" then + if s.fields["dns_mode"]:formvalue(section) == "xray" then return m:set(section, "v2ray_dns_mode", value) end end @@ -439,7 +446,7 @@ o.cfgvalue = function(self, section) return m:get(section, "v2ray_dns_mode") end o.write = function(self, section, value) - if dns_mode:formvalue(section) == "sing-box" then + if s.fields["dns_mode"]:formvalue(section) == "sing-box" then return m:set(section, "v2ray_dns_mode", value) end end @@ -518,9 +525,9 @@ o.default = "0" o:depends({dns_mode = "sing-box", dns_shunt = "dnsmasq"}) o.validate = function(self, value, t) if value and value == "1" then - local _dns_mode = dns_mode:formvalue(t) - local _tcp_node = tcp_node:formvalue(t) - if _dns_mode and _tcp_node and _tcp_node ~= "nil" then + local _dns_mode = s.fields["dns_mode"]:formvalue(t) + local _tcp_node = s.fields["tcp_node"]:formvalue(t) + if _dns_mode and _tcp_node then if m:get(_tcp_node, "type"):lower() ~= _dns_mode then return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode) end @@ -597,16 +604,16 @@ if has_chnlist or has_chnroute then end ---- TCP Default Proxy Mode -tcp_proxy_mode = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP " .. translate("Default Proxy Mode")) -tcp_proxy_mode:value("disable", translate("No Proxy")) -tcp_proxy_mode:value("proxy", translate("Proxy")) -tcp_proxy_mode.default = "proxy" +o = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP " .. translate("Default Proxy Mode")) +o:value("disable", translate("No Proxy")) +o:value("proxy", translate("Proxy")) +o.default = "proxy" ---- UDP Default Proxy Mode -udp_proxy_mode = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP " .. translate("Default Proxy Mode")) -udp_proxy_mode:value("disable", translate("No Proxy")) -udp_proxy_mode:value("proxy", translate("Proxy")) -udp_proxy_mode.default = "proxy" +o = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP " .. translate("Default Proxy Mode")) +o:value("disable", translate("No Proxy")) +o:value("proxy", translate("Proxy")) +o.default = "proxy" o = s:taboption("Proxy", DummyValue, "switch_mode", " ") o.template = appname .. "/global/proxy" @@ -634,20 +641,20 @@ o = s:taboption("log", Flag, "log_udp", translate("Enable") .. " " .. translatef o.default = "1" o.rmempty = false -loglevel = s:taboption("log", ListValue, "loglevel", "Sing-Box/Xray " .. translate("Log Level")) -loglevel.default = "warning" -loglevel:value("debug") -loglevel:value("info") -loglevel:value("warning") -loglevel:value("error") +o = s:taboption("log", ListValue, "loglevel", "Sing-Box/Xray " .. translate("Log Level")) +o.default = "warning" +o:value("debug") +o:value("info") +o:value("warning") +o:value("error") -trojan_loglevel = s:taboption("log", ListValue, "trojan_loglevel", "Trojan " .. translate("Log Level")) -trojan_loglevel.default = "2" -trojan_loglevel:value("0", "all") -trojan_loglevel:value("1", "info") -trojan_loglevel:value("2", "warn") -trojan_loglevel:value("3", "error") -trojan_loglevel:value("4", "fatal") +o = s:taboption("log", ListValue, "trojan_loglevel", "Trojan " .. translate("Log Level")) +o.default = "2" +o:value("0", "all") +o:value("1", "info") +o:value("2", "warn") +o:value("3", "error") +o:value("4", "fatal") o = s:taboption("log", Flag, "advanced_log_feature", translate("Advanced log feature"), translate("For professionals only.")) o.default = "0" @@ -670,30 +677,30 @@ o.template = appname .. "/global/faq" o = s:taboption("Main", Flag, "socks_enabled", "Socks " .. translate("Main switch")) o.rmempty = false -s = m:section(TypedSection, "socks", translate("Socks Config")) -s.template = "cbi/tblsection" -s.anonymous = true -s.addremove = true -s.extedit = api.url("socks_config", "%s") -function s.create(e, t) +s2 = m:section(TypedSection, "socks", translate("Socks Config")) +s2.template = "cbi/tblsection" +s2.anonymous = true +s2.addremove = true +s2.extedit = api.url("socks_config", "%s") +function s2.create(e, t) local uuid = api.gen_short_uuid() t = uuid TypedSection.create(e, t) luci.http.redirect(e.extedit:format(t)) end -o = s:option(DummyValue, "status", translate("Status")) +o = s2:option(DummyValue, "status", translate("Status")) o.rawhtml = true o.cfgvalue = function(t, n) return string.format('
', n) end ---- Enable -o = s:option(Flag, "enabled", translate("Enable")) +o = s2:option(Flag, "enabled", translate("Enable")) o.default = 1 o.rmempty = false -socks_node = s:option(ListValue, "node", translate("Socks Node")) +o = s2:option(ListValue, "node", translate("Socks Node")) local n = 1 uci:foreach(appname, "socks", function(s) @@ -703,26 +710,26 @@ uci:foreach(appname, "socks", function(s) n = n + 1 end) -o = s:option(Value, "port", "Socks " .. translate("Listen Port")) +o = s2:option(Value, "port", "Socks " .. translate("Listen Port")) o.default = n + 1080 o.datatype = "port" o.rmempty = false if has_singbox or has_xray then - o = s:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) + o = s2:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) o.default = 0 o.datatype = "port" end for k, v in pairs(nodes_table) do - tcp_node:value(v.id, v["remark"]) - udp_node:value(v.id, v["remark"]) + s.fields["tcp_node"]:value(v.id, v["remark"]) + s.fields["udp_node"]:value(v.id, v["remark"]) if v.type == "Socks" then if has_singbox or has_xray then - socks_node:value(v.id, v["remark"]) + s2.fields["node"]:value(v.id, v["remark"]) end else - socks_node:value(v.id, v["remark"]) + s2.fields["node"]:value(v.id, v["remark"]) end end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua index 5fedaa2ed8..7f4bc9152b 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua @@ -61,15 +61,15 @@ function s.remove(e, t) end end) TypedSection.remove(e, t) - local new_node = "nil" + local new_node = "" local node0 = m:get("@nodes[0]") or nil if node0 then new_node = node0[".name"] end - if (m:get("@global[0]", "tcp_node") or "nil") == t then + if (m:get("@global[0]", "tcp_node") or "") == t then m:set('@global[0]', "tcp_node", new_node) end - if (m:get("@global[0]", "udp_node") or "nil") == t then + if (m:get("@global[0]", "udp_node") or "") == t then m:set('@global[0]', "udp_node", new_node) end end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 0bc15c66d7..dbbdbbf92e 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -17,44 +17,44 @@ s = m:section(TypedSection, "global_delay", translate("Delay Settings")) s.anonymous = true s.addremove = false ----- Delay Start -o = s:option(Value, "start_delay", translate("Delay Start"), - translate("Units:seconds")) -o.default = "1" -o.rmempty = true - ---- Open and close Daemon o = s:option(Flag, "start_daemon", translate("Open and close Daemon")) o.default = 1 o.rmempty = false ---[[ ----- Open and close automatically -o = s:option(Flag, "auto_on", translate("Open and close automatically")) -o.default = 0 -o.rmempty = false +---- Delay Start +o = s:option(Value, "start_delay", translate("Delay Start"), translate("Units:seconds")) +o.default = "1" +o.rmempty = true ----- Automatically turn off time -o = s:option(ListValue, "time_off", translate("Automatically turn off time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end - ----- Automatically turn on time -o = s:option(ListValue, "time_on", translate("Automatically turn on time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end - ----- Automatically restart time -o = s:option(ListValue, "time_restart", translate("Automatically restart time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end ---]] +for index, value in ipairs({"stop", "start", "restart"}) do + o = s:option(ListValue, value .. "_week_mode", translate(value .. " automatically mode")) + o:value("", translate("Disable")) + o:value(8, translate("Loop Mode")) + o:value(7, translate("Every day")) + o:value(1, translate("Every Monday")) + o:value(2, translate("Every Tuesday")) + o:value(3, translate("Every Wednesday")) + o:value(4, translate("Every Thursday")) + o:value(5, translate("Every Friday")) + o:value(6, translate("Every Saturday")) + o:value(0, translate("Every Sunday")) + o = s:option(ListValue, value .. "_time_mode", translate(value .. " Time(Every day)")) + for t = 0, 23 do o:value(t, t .. ":00") end + o.default = 0 + o:depends(value .. "_week_mode", "0") + o:depends(value .. "_week_mode", "1") + o:depends(value .. "_week_mode", "2") + o:depends(value .. "_week_mode", "3") + o:depends(value .. "_week_mode", "4") + o:depends(value .. "_week_mode", "5") + o:depends(value .. "_week_mode", "6") + o:depends(value .. "_week_mode", "7") + o = s:option(ListValue, value .. "_interval_mode", translate(value .. " Interval(Hour)")) + for t = 1, 24 do o:value(t, t .. " " .. translate("Hour")) end + o.default = 2 + o:depends(value .. "_week_mode", "8") +end -- [[ Forwarding Settings ]]-- s = m:section(TypedSection, "global_forwarding", diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua index ae4c2a80ff..970a9e7596 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua @@ -10,7 +10,7 @@ local type_name = "Hysteria2" local option_prefix = "hysteria2_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,59 +18,59 @@ end s.fields["type"]:value(type_name, "Hysteria2") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("udp", "UDP") -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("hop"), translate("Additional ports for hysteria hop")) +o = s:option(Value, _n("hop"), translate("Additional ports for hysteria hop")) o.rewrite_option = o.option -o = s:option(Value, option_name("obfs"), translate("Obfs Password")) +o = s:option(Value, _n("obfs"), translate("Obfs Password")) o.rewrite_option = o.option -o = s:option(Value, option_name("auth_password"), translate("Auth Password")) +o = s:option(Value, _n("auth_password"), translate("Auth Password")) o.password = true o.rewrite_option = o.option -o = s:option(Flag, option_name("fast_open"), translate("Fast Open")) +o = s:option(Flag, _n("fast_open"), translate("Fast Open")) o.default = "0" -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o = s:option(Value, option_name("tls_pinSHA256"), translate("PinSHA256"),translate("Certificate fingerprint")) +o = s:option(Value, _n("tls_pinSHA256"), translate("PinSHA256"),translate("Certificate fingerprint")) o.rewrite_option = o.option -o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("up_mbps"), translate("Max upload Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("down_mbps"), translate("Max download Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("hop_interval"), translate("Hop Interval"), translate("Example:") .. "30s (≥5s)") +o = s:option(Value, _n("hop_interval"), translate("Hop Interval"), translate("Example:") .. "30s (≥5s)") o.rewrite_option = o.option -o = s:option(Value, option_name("recv_window"), translate("QUIC stream receive window")) +o = s:option(Value, _n("recv_window"), translate("QUIC stream receive window")) o.rewrite_option = o.option -o = s:option(Value, option_name("recv_window_conn"), translate("QUIC connection receive window")) +o = s:option(Value, _n("recv_window_conn"), translate("QUIC connection receive window")) o.rewrite_option = o.option -o = s:option(Value, option_name("idle_timeout"), translate("Idle Timeout"), translate("Example:") .. "30s (4s-120s)") +o = s:option(Value, _n("idle_timeout"), translate("Idle Timeout"), translate("Example:") .. "30s (4s-120s)") o.rewrite_option = o.option -o = s:option(Flag, option_name("disable_mtu_discovery"), translate("Disable MTU detection")) +o = s:option(Flag, _n("disable_mtu_discovery"), translate("Disable MTU detection")) o.default = "0" o.rewrite_option = o.option -o = s:option(Flag, option_name("lazy_start"), translate("Lazy Start")) +o = s:option(Flag, _n("lazy_start"), translate("Lazy Start")) o.default = "0" o.rewrite_option = o.option diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua index d2447d35d7..1683b4fe3f 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua @@ -10,7 +10,7 @@ local type_name = "Naiveproxy" local option_prefix = "naive_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,18 +18,18 @@ end s.fields["type"]:value(type_name, translate("NaiveProxy")) -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("https", translate("HTTPS")) o:value("quic", translate("QUIC")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("username"), translate("Username")) +o = s:option(Value, _n("username"), translate("Username")) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 8b55b6b466..a83510a7ef 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -14,7 +14,7 @@ local type_name = "Xray" local option_prefix = "xray_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -33,7 +33,7 @@ local xray_version = api.get_app_version("xray") s.fields["type"]:value(type_name, "Xray") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("vmess", translate("Vmess")) o:value("vless", translate("VLESS")) o:value("http", translate("HTTP")) @@ -45,9 +45,9 @@ o:value("_balancing", translate("Balancing")) o:value("_shunt", translate("Shunt")) o:value("_iface", translate("Custom Interface")) -o = s:option(Value, option_name("iface"), translate("Interface")) +o = s:option(Value, _n("iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("protocol")] = "_iface" }) +o:depends({ [_n("protocol")] = "_iface" }) local nodes_table = {} local balancers_table = {} @@ -96,12 +96,12 @@ uci:foreach(appname, "socks", function(s) end) -- 负载均衡列表 -local o = s:option(DynamicList, option_name("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, document")) -o:depends({ [option_name("protocol")] = "_balancing" }) +local o = s:option(DynamicList, _n("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, document")) +o:depends({ [_n("protocol")] = "_balancing" }) for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end -local o = s:option(ListValue, option_name("balancingStrategy"), translate("Balancing Strategy")) -o:depends({ [option_name("protocol")] = "_balancing" }) +local o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) +o:depends({ [_n("protocol")] = "_balancing" }) o:value("random") o:value("roundRobin") o:value("leastPing") @@ -109,11 +109,11 @@ o.default = "leastPing" -- Fallback Node if api.compare_versions(xray_version, ">=", "1.8.10") then - local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node")) + local o = s:option(ListValue, _n("fallback_node"), translate("Fallback Node")) if api.compare_versions(xray_version, ">=", "1.8.12") then - o:depends({ [option_name("protocol")] = "_balancing" }) + o:depends({ [_n("protocol")] = "_balancing" }) else - o:depends({ [option_name("balancingStrategy")] = "leastPing" }) + o:depends({ [_n("balancingStrategy")] = "leastPing" }) end local function check_fallback_chain(fb) for k, v in pairs(fallback_table) do @@ -132,11 +132,11 @@ if api.compare_versions(xray_version, ">=", "1.8.10") then end -- 探测地址 -local ucpu = s:option(Flag, option_name("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) -ucpu:depends({ [option_name("balancingStrategy")] = "leastPing" }) +local ucpu = s:option(Flag, _n("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) +ucpu:depends({ [_n("balancingStrategy")] = "leastPing" }) -local pu = s:option(Value, option_name("probeUrl"), translate("Probe URL")) -pu:depends({ [option_name("useCustomProbeUrl")] = true }) +local pu = s:option(Value, _n("probeUrl"), translate("Probe URL")) +pu:depends({ [_n("useCustomProbeUrl")] = true }) pu:value("https://cp.cloudflare.com/", "Cloudflare") pu:value("https://www.gstatic.com/generate_204", "Gstatic") pu:value("https://www.google.com/generate_204", "Google") @@ -147,27 +147,27 @@ pu.default = "https://www.google.com/generate_204" pu.description = translate("The URL used to detect the connection status.") -- 探测间隔 -local pi = s:option(Value, option_name("probeInterval"), translate("Probe Interval")) -pi:depends({ [option_name("balancingStrategy")] = "leastPing" }) +local pi = s:option(Value, _n("probeInterval"), translate("Probe Interval")) +pi:depends({ [_n("balancingStrategy")] = "leastPing" }) pi.default = "1m" pi.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are ns, us, ms, s, m, h, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.") if api.compare_versions(xray_version, ">=", "1.8.12") then - ucpu:depends({ [option_name("protocol")] = "_balancing" }) - pi:depends({ [option_name("protocol")] = "_balancing" }) + ucpu:depends({ [_n("protocol")] = "_balancing" }) + pi:depends({ [_n("protocol")] = "_balancing" }) else - ucpu:depends({ [option_name("balancingStrategy")] = "leastPing" }) - pi:depends({ [option_name("balancingStrategy")] = "leastPing" }) + ucpu:depends({ [_n("balancingStrategy")] = "leastPing" }) + pi:depends({ [_n("balancingStrategy")] = "leastPing" }) end -- [[ 分流模块 ]] if #nodes_table > 0 then - o = s:option(Flag, option_name("preproxy_enabled"), translate("Preproxy")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o = s:option(Flag, _n("preproxy_enabled"), translate("Preproxy")) + o:depends({ [_n("protocol")] = "_shunt" }) - o = s:option(ListValue, option_name("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) - o:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true }) + o = s:option(ListValue, _n("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) + o:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true }) for k, v in pairs(socks_list) do o:value(v.id, v.remark) end @@ -180,16 +180,15 @@ if #nodes_table > 0 then for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end - o.default = "nil" end uci:foreach(appname, "shunt_rules", function(e) if e[".name"] and e.remarks then - o = s:option(ListValue, option_name(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) - o:value("nil", translate("Close")) + o = s:option(ListValue, _n(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o:depends({ [_n("protocol")] = "_shunt" }) if #nodes_table > 0 then for k, v in pairs(socks_list) do @@ -201,28 +200,27 @@ uci:foreach(appname, "shunt_rules", function(e) for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local pt = s:option(ListValue, option_name(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) - pt:value("nil", translate("Close")) + local pt = s:option(ListValue, _n(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - pt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name(e[".name"])] = v.id }) + pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id }) end end end end) -o = s:option(DummyValue, option_name("shunt_tips"), " ") +o = s:option(DummyValue, _n("shunt_tips"), " ") o.not_rewrite = true o.rawhtml = true o.cfgvalue = function(t, n) return string.format('%s', translate("No shunt rules? Click me to go to add.")) end -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -local o = s:option(ListValue, option_name("default_node"), string.format('* %s', translate("Default"))) -o:depends({ [option_name("protocol")] = "_shunt" }) +local o = s:option(ListValue, _n("default_node"), string.format('* %s', translate("Default"))) +o:depends({ [_n("protocol")] = "_shunt" }) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -236,17 +234,16 @@ if #nodes_table > 0 then for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local dpt = s:option(ListValue, option_name("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) - dpt:value("nil", translate("Close")) + local dpt = s:option(ListValue, _n("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + dpt:value("", translate("Close")) dpt:value("main", translate("Preproxy Node")) - dpt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - dpt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name("default_node")] = v.id }) + dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id }) end end -o = s:option(ListValue, option_name("domainStrategy"), translate("Domain Strategy")) +o = s:option(ListValue, _n("domainStrategy"), translate("Domain Strategy")) o:value("AsIs") o:value("IPIfNonMatch") o:value("IPOnDemand") @@ -255,92 +252,92 @@ o.description = "
  • " .. translate("'AsIs': Only use domain for routi .. "
  • " .. translate("'IPIfNonMatch': When no rule matches current domain, resolves it into IP addresses (A or AAAA records) and try all rules again.") .. "
  • " .. translate("'IPOnDemand': As long as there is a IP-based rule, resolves the domain into IP immediately.") .. "
" -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -o = s:option(ListValue, option_name("domainMatcher"), translate("Domain matcher")) +o = s:option(ListValue, _n("domainMatcher"), translate("Domain matcher")) o:value("hybrid") o:value("linear") -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -- [[ 分流模块 End ]] -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -local protocols = s.fields[option_name("protocol")].keylist +local protocols = s.fields[_n("protocol")].keylist if #protocols > 0 then for index, value in ipairs(protocols) do if not value:find("_") then - s.fields[option_name("address")]:depends({ [option_name("protocol")] = value }) - s.fields[option_name("port")]:depends({ [option_name("protocol")] = value }) + s.fields[_n("address")]:depends({ [_n("protocol")] = value }) + s.fields[_n("port")]:depends({ [_n("protocol")] = value }) end end end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("security"), translate("Encrypt Method")) for a, t in ipairs(security_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Value, option_name("encryption"), translate("Encrypt Method")) +o = s:option(Value, _n("encryption"), translate("Encrypt Method")) o.default = "none" o:value("none") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("iv_check"), translate("IV Check")) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "aes-128-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "aes-256-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "chacha20-poly1305" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "xchacha20-poly1305" }) +o = s:option(Flag, _n("iv_check"), translate("IV Check")) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "aes-128-gcm" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "aes-256-gcm" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "chacha20-poly1305" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "xchacha20-poly1305" }) -o = s:option(Flag, option_name("uot"), translate("UDP over TCP")) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("uot"), translate("UDP over TCP")) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "raw" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("reality"), translate("REALITY"), translate("Only recommend to use with VLESS-TCP-XTLS-Vision.")) +o = s:option(Flag, _n("reality"), translate("REALITY"), translate("Only recommend to use with VLESS-TCP-XTLS-Vision.")) o.default = 0 -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "raw" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "h2" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "grpc" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "xhttp" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "raw" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "h2" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "grpc" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "xhttp" }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -349,36 +346,36 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) --- o = s:option(Value, option_name("minversion"), translate("minversion")) +-- o = s:option(Value, _n("minversion"), translate("minversion")) -- o.default = "1.3" -- o:value("1.3") --- o:depends({ [option_name("tls")] = true }) +-- o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) -- [[ REALITY部分 ]] -- -o = s:option(Value, option_name("reality_publicKey"), translate("Public Key")) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o = s:option(Value, _n("reality_publicKey"), translate("Public Key")) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o = s:option(Value, _n("reality_shortId"), translate("Short Id")) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Value, option_name("reality_spiderX"), translate("Spider X")) +o = s:option(Value, _n("reality_spiderX"), translate("Spider X")) o.placeholder = "/" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Flag, option_name("utls"), translate("uTLS")) +o = s:option(Flag, _n("utls"), translate("uTLS")) o.default = "0" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) -o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print")) +o = s:option(ListValue, _n("fingerprint"), translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -390,10 +387,10 @@ o:value("android") o:value("random") o:value("randomized") o.default = "chrome" -o:depends({ [option_name("tls")] = true, [option_name("utls")] = true }) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o:depends({ [_n("tls")] = true, [_n("utls")] = true }) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("raw", "RAW (TCP)") o:value("mkcp", "mKCP") o:value("ws", "WebSocket") @@ -403,193 +400,193 @@ o:value("quic", "QUIC") o:value("grpc", "gRPC") o:value("httpupgrade", "HttpUpgrade") o:value("xhttp", "XHTTP (SplitHTTP)") -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(Value, option_name("wireguard_public_key"), translate("Public Key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_public_key"), translate("Public Key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_secret_key"), translate("Private Key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_secret_key"), translate("Private Key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_preSharedKey"), translate("Pre shared key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_preSharedKey"), translate("Pre shared key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(DynamicList, option_name("wireguard_local_address"), translate("Local Address")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(DynamicList, _n("wireguard_local_address"), translate("Local Address")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_mtu"), translate("MTU")) +o = s:option(Value, _n("wireguard_mtu"), translate("MTU")) o.default = "1420" -o:depends({ [option_name("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "wireguard" }) if api.compare_versions(xray_version, ">=", "1.8.0") then - o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) + o:depends({ [_n("protocol")] = "wireguard" }) end -o = s:option(Value, option_name("wireguard_keepAlive"), translate("Keep Alive")) +o = s:option(Value, _n("wireguard_keepAlive"), translate("Keep Alive")) o.default = "0" -o:depends({ [option_name("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "wireguard" }) -- [[ RAW部分 ]]-- -- TCP伪装 -o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("tcp_guise"), translate("Camouflage Type")) o:value("none", "none") o:value("http", "http") -o:depends({ [option_name("transport")] = "raw" }) +o:depends({ [_n("transport")] = "raw" }) -- HTTP域名 -o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_host"), translate("HTTP Host")) +o:depends({ [_n("tcp_guise")] = "http" }) -- HTTP路径 -o = s:option(DynamicList, option_name("tcp_guise_http_path"), translate("HTTP Path")) +o = s:option(DynamicList, _n("tcp_guise_http_path"), translate("HTTP Path")) o.placeholder = "/" -o:depends({ [option_name("tcp_guise")] = "http" }) +o:depends({ [_n("tcp_guise")] = "http" }) -- [[ mKCP部分 ]]-- -o = s:option(ListValue, option_name("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +o = s:option(ListValue, _n("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_mtu"), translate("KCP MTU")) +o = s:option(Value, _n("mkcp_mtu"), translate("KCP MTU")) o.default = "1350" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_tti"), translate("KCP TTI")) +o = s:option(Value, _n("mkcp_tti"), translate("KCP TTI")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) +o = s:option(Value, _n("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) o.default = "5" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) +o = s:option(Value, _n("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Flag, option_name("mkcp_congestion"), translate("KCP Congestion")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Flag, _n("mkcp_congestion"), translate("KCP Congestion")) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_readBufferSize"), translate("KCP readBufferSize")) +o = s:option(Value, _n("mkcp_readBufferSize"), translate("KCP readBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) +o = s:option(Value, _n("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_seed"), translate("KCP Seed")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Value, _n("mkcp_seed"), translate("KCP Seed")) +o:depends({ [_n("transport")] = "mkcp" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)")) +o = s:option(Value, _n("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)")) o.datatype = "integer" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -- [[ HTTP/2部分 ]]-- -o = s:option(Value, option_name("h2_host"), translate("HTTP/2 Host")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path")) +o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "h2" }) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Flag, option_name("h2_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Flag, _n("h2_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_read_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("h2_read_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("h2_health_check")] = true }) +o:depends({ [_n("h2_health_check")] = true }) -o = s:option(Value, option_name("h2_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("h2_health_check_timeout"), translate("Health check timeout")) o.default = "15" -o:depends({ [option_name("h2_health_check")] = true }) +o:depends({ [_n("h2_health_check")] = true }) -- [[ DomainSocket部分 ]]-- -o = s:option(Value, option_name("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) -o:depends({ [option_name("transport")] = "ds" }) +o = s:option(Value, _n("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) +o:depends({ [_n("transport")] = "ds" }) -- [[ QUIC部分 ]]-- -o = s:option(ListValue, option_name("quic_security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("quic_security"), translate("Encrypt Method")) o:value("none") o:value("aes-128-gcm") o:value("chacha20-poly1305") -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(Value, option_name("quic_key"), translate("Encrypt Method") .. translate("Key")) -o:depends({ [option_name("transport")] = "quic" }) +o = s:option(Value, _n("quic_key"), translate("Encrypt Method") .. translate("Key")) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(ListValue, option_name("quic_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("quic_guise"), translate("Camouflage Type")) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(ListValue, option_name("grpc_mode"), "gRPC " .. translate("Transfer mode")) +o = s:option(ListValue, _n("grpc_mode"), "gRPC " .. translate("Transfer mode")) o:value("gun") o:value("multi") -o:depends({ [option_name("transport")] = "grpc" }) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("grpc_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Flag, _n("grpc_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Value, option_name("grpc_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("grpc_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("grpc_health_check_timeout"), translate("Health check timeout")) o.default = "20" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Flag, option_name("grpc_permit_without_stream"), translate("Permit without stream")) +o = s:option(Flag, _n("grpc_permit_without_stream"), translate("Permit without stream")) o.default = "0" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_initial_windows_size"), translate("Initial Windows Size")) +o = s:option(Value, _n("grpc_initial_windows_size"), translate("Initial Windows Size")) o.default = "0" -o:depends({ [option_name("transport")] = "grpc" }) +o:depends({ [_n("transport")] = "grpc" }) -- [[ HttpUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HttpUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HttpUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HttpUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HttpUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ XHTTP部分 ]]-- -o = s:option(ListValue, option_name("xhttp_mode"), "XHTTP " .. translate("Mode")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(ListValue, _n("xhttp_mode"), "XHTTP " .. translate("Mode")) +o:depends({ [_n("transport")] = "xhttp" }) o.default = "auto" o:value("auto") o:value("packet-up") o:value("stream-up") o:value("stream-one") -o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(Value, _n("xhttp_host"), translate("XHTTP Host")) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path")) +o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(TextValue, option_name("xhttp_extra"), translate("XHTTP Extra"), translate("An XHTTP extra object in raw json")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(TextValue, _n("xhttp_extra"), translate("XHTTP Extra"), translate("An XHTTP extra object in raw json")) +o:depends({ [_n("transport")] = "xhttp" }) o.rows = 15 o.wrap = "off" o.custom_write = function(self, section, value) @@ -618,62 +615,62 @@ o.validate = function(self, value) end -- [[ Mux.Cool ]]-- -o = s:option(Flag, option_name("mux"), "Mux", translate("Enable Mux.Cool")) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o = s:option(Flag, _n("mux"), "Mux", translate("Enable Mux.Cool")) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")) +o = s:option(Value, _n("mux_concurrency"), translate("Mux concurrency")) o.default = 8 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -- [[ XUDP Mux ]]-- -o = s:option(Flag, option_name("xmux"), "XUDP Mux") +o = s:option(Flag, _n("xmux"), "XUDP Mux") o.default = 1 -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "xtls-rprx-vision" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "xtls-rprx-vision" }) -o = s:option(Value, option_name("xudp_concurrency"), translate("XUDP Mux concurrency")) +o = s:option(Value, _n("xudp_concurrency"), translate("XUDP Mux concurrency")) o.default = 8 -o:depends({ [option_name("xmux")] = true }) +o:depends({ [_n("xmux")] = true }) --[[tcpMptcp]] -o = s:option(Flag, option_name("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration.")) +o = s:option(Flag, _n("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration.")) o.default = 0 -o = s:option(Flag, option_name("tcpNoDelay"), "tcpNoDelay") +o = s:option(Flag, _n("tcpNoDelay"), "tcpNoDelay") o.default = 0 -o = s:option(ListValue, option_name("chain_proxy"), translate("Chain Proxy")) +o = s:option(ListValue, _n("chain_proxy"), translate("Chain Proxy")) o:value("", translate("Close(Not use)")) o:value("1", translate("Preproxy Node")) o:value("2", translate("Landing Node")) -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - o:depends({ [option_name("protocol")] = v }) + o:depends({ [_n("protocol")] = v }) end end -o = s:option(ListValue, option_name("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "1" }) +o = s:option(ListValue, _n("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "1" }) -o = s:option(ListValue, option_name("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "2" }) +o = s:option(ListValue, _n("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "2" }) for k, v in pairs(nodes_table) do if v.type == "Xray" and v.id ~= arg[1] then - s.fields[option_name("preproxy_node")]:value(v.id, v.remark) - s.fields[option_name("to_node")]:value(v.id, v.remark) + s.fields[_n("preproxy_node")]:value(v.id, v.remark) + s.fields[_n("to_node")]:value(v.id, v.remark) end end -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - s.fields[option_name("tcpMptcp")]:depends({ [option_name("protocol")] = v }) - s.fields[option_name("tcpNoDelay")]:depends({ [option_name("protocol")] = v }) - s.fields[option_name("chain_proxy")]:depends({ [option_name("protocol")] = v }) + s.fields[_n("tcpMptcp")]:depends({ [_n("protocol")] = v }) + s.fields[_n("tcpNoDelay")]:depends({ [_n("protocol")] = v }) + s.fields[_n("chain_proxy")]:depends({ [_n("protocol")] = v }) end end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 794bf1349a..d5eb0ed406 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -17,7 +17,7 @@ local type_name = "sing-box" local option_prefix = "singbox_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -35,7 +35,7 @@ local security_list = { "none", "auto", "aes-128-gcm", "chacha20-poly1305", "zer s.fields["type"]:value(type_name, "Sing-Box") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("socks", "Socks") o:value("http", "HTTP") o:value("shadowsocks", "Shadowsocks") @@ -60,9 +60,9 @@ end o:value("_shunt", translate("Shunt")) o:value("_iface", translate("Custom Interface")) -o = s:option(Value, option_name("iface"), translate("Interface")) +o = s:option(Value, _n("iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("protocol")] = "_iface" }) +o:depends({ [_n("protocol")] = "_iface" }) local nodes_table = {} local iface_table = {} @@ -94,11 +94,11 @@ end) -- [[ 分流模块 ]] if #nodes_table > 0 then - o = s:option(Flag, option_name("preproxy_enabled"), translate("Preproxy")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o = s:option(Flag, _n("preproxy_enabled"), translate("Preproxy")) + o:depends({ [_n("protocol")] = "_shunt" }) - o = s:option(ListValue, option_name("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) - o:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true }) + o = s:option(ListValue, _n("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) + o:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true }) for k, v in pairs(socks_list) do o:value(v.id, v.remark) end @@ -108,16 +108,15 @@ if #nodes_table > 0 then for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end - o.default = "nil" end uci:foreach(appname, "shunt_rules", function(e) if e[".name"] and e.remarks then - o = s:option(ListValue, option_name(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) - o:value("nil", translate("Close")) + o = s:option(ListValue, _n(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o:depends({ [_n("protocol")] = "_shunt" }) if #nodes_table > 0 then for k, v in pairs(socks_list) do @@ -126,28 +125,27 @@ uci:foreach(appname, "shunt_rules", function(e) for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local pt = s:option(ListValue, option_name(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) - pt:value("nil", translate("Close")) + local pt = s:option(ListValue, _n(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - pt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name(e[".name"])] = v.id }) + pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id }) end end end end) -o = s:option(DummyValue, option_name("shunt_tips"), " ") +o = s:option(DummyValue, _n("shunt_tips"), " ") o.not_rewrite = true o.rawhtml = true o.cfgvalue = function(t, n) return string.format('%s', translate("No shunt rules? Click me to go to add.")) end -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -local o = s:option(ListValue, option_name("default_node"), string.format('* %s', translate("Default"))) -o:depends({ [option_name("protocol")] = "_shunt" }) +local o = s:option(ListValue, _n("default_node"), string.format('* %s', translate("Default"))) +o:depends({ [_n("protocol")] = "_shunt" }) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -158,61 +156,60 @@ if #nodes_table > 0 then for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local dpt = s:option(ListValue, option_name("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) - dpt:value("nil", translate("Close")) + local dpt = s:option(ListValue, _n("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + dpt:value("", translate("Close")) dpt:value("main", translate("Preproxy Node")) - dpt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - dpt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name("default_node")] = v.id }) + dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id }) end end -- [[ 分流模块 End ]] -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -local protocols = s.fields[option_name("protocol")].keylist +local protocols = s.fields[_n("protocol")].keylist if #protocols > 0 then for index, value in ipairs(protocols) do if not value:find("_") then - s.fields[option_name("address")]:depends({ [option_name("protocol")] = value }) - s.fields[option_name("port")]:depends({ [option_name("protocol")] = value }) + s.fields[_n("address")]:depends({ [_n("protocol")] = value }) + s.fields[_n("port")]:depends({ [_n("protocol")] = value }) end end end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "shadowsocksr" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocksr" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(ListValue, option_name("security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("security"), translate("Encrypt Method")) for a, t in ipairs(security_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_new_list) do o:value(t) end for a, t in ipairs(ss_method_old_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) if singbox_tags:find("with_shadowsocksr") then - o = s:option(ListValue, option_name("ssr_method"), translate("Encrypt Method")) + o = s:option(ListValue, _n("ssr_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_old_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) local ssr_protocol_list = { "origin", "verify_simple", "verify_deflate", "verify_sha1", "auth_simple", @@ -221,120 +218,120 @@ if singbox_tags:find("with_shadowsocksr") then "auth_chain_d", "auth_chain_e", "auth_chain_f" } - o = s:option(ListValue, option_name("ssr_protocol"), translate("Protocol")) + o = s:option(ListValue, _n("ssr_protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) - o = s:option(Value, option_name("ssr_protocol_param"), translate("Protocol_param")) - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o = s:option(Value, _n("ssr_protocol_param"), translate("Protocol_param")) + o:depends({ [_n("protocol")] = "shadowsocksr" }) local ssr_obfs_list = { "plain", "http_simple", "http_post", "random_head", "tls_simple", "tls1.0_session_auth", "tls1.2_ticket_auth" } - o = s:option(ListValue, option_name("ssr_obfs"), translate("Obfs")) + o = s:option(ListValue, _n("ssr_obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) - o = s:option(Value, option_name("ssr_obfs_param"), translate("Obfs_param")) - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o = s:option(Value, _n("ssr_obfs_param"), translate("Obfs_param")) + o:depends({ [_n("protocol")] = "shadowsocksr" }) end -o = s:option(Flag, option_name("uot"), translate("UDP over TCP")) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("uot"), translate("UDP over TCP")) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(Value, option_name("alter_id"), "Alter ID") +o = s:option(Value, _n("alter_id"), "Alter ID") o.datatype = "uinteger" o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Flag, option_name("global_padding"), "global_padding", translate("Protocol parameter. Will waste traffic randomly if enabled.")) +o = s:option(Flag, _n("global_padding"), "global_padding", translate("Protocol parameter. Will waste traffic randomly if enabled.")) o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Flag, option_name("authenticated_length"), "authenticated_length", translate("Protocol parameter. Enable length block encryption.")) +o = s:option(Flag, _n("authenticated_length"), "authenticated_length", translate("Protocol parameter. Enable length block encryption.")) o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true }) if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria_obfs"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_obfs"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(ListValue, option_name("hysteria_auth_type"), translate("Auth Type")) + o = s:option(ListValue, _n("hysteria_auth_type"), translate("Auth Type")) o:value("disable", translate("Disable")) o:value("string", translate("STRING")) o:value("base64", translate("BASE64")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "string"}) - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "base64"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "string"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "base64"}) - o = s:option(Value, option_name("hysteria_up_mbps"), translate("Max upload Mbps")) + o = s:option(Value, _n("hysteria_up_mbps"), translate("Max upload Mbps")) o.default = "10" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_down_mbps"), translate("Max download Mbps")) + o = s:option(Value, _n("hysteria_down_mbps"), translate("Max download Mbps")) o.default = "50" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window_conn"), translate("QUIC stream receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_conn"), translate("QUIC stream receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window"), translate("QUIC connection receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window"), translate("QUIC connection receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Flag, _n("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "hysteria" }) end if singbox_tags:find("with_quic") then - o = s:option(ListValue, option_name("tuic_congestion_control"), translate("Congestion control algorithm")) + o = s:option(ListValue, _n("tuic_congestion_control"), translate("Congestion control algorithm")) o.default = "cubic" o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(ListValue, option_name("tuic_udp_relay_mode"), translate("UDP relay mode")) + o = s:option(ListValue, _n("tuic_udp_relay_mode"), translate("UDP relay mode")) o.default = "native" o:value("native", translate("native")) o:value("quic", translate("QUIC")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) --[[ - o = s:option(Flag, option_name("tuic_udp_over_stream"), translate("UDP over stream")) - o:depends({ [option_name("protocol")] = "tuic" }) + o = s:option(Flag, _n("tuic_udp_over_stream"), translate("UDP over stream")) + o:depends({ [_n("protocol")] = "tuic" }) ]]-- - o = s:option(Flag, option_name("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) + o = s:option(Flag, _n("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_heartbeat"), translate("Heartbeat interval(second)")) + o = s:option(Value, _n("tuic_heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(ListValue, option_name("tuic_alpn"), translate("QUIC TLS ALPN")) + o = s:option(ListValue, _n("tuic_alpn"), translate("QUIC TLS ALPN")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -343,38 +340,38 @@ if singbox_tags:find("with_quic") then o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) end if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria2_up_mbps"), translate("Max upload Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_down_mbps"), translate("Max download Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_down_mbps"), translate("Max download Mbps")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(ListValue, option_name("hysteria2_obfs_type"), translate("Obfs Type")) + o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_obfs_password"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria2"}) + o:depends({ [_n("protocol")] = "hysteria2"}) end -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -383,36 +380,36 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) -o:depends({ [option_name("protocol")] = "hysteria"}) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) +o:depends({ [_n("protocol")] = "hysteria"}) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true }) -o:depends({ [option_name("protocol")] = "hysteria"}) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("tls")] = true }) +o:depends({ [_n("protocol")] = "hysteria"}) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) if singbox_tags:find("with_ech") then - o = s:option(Flag, option_name("ech"), translate("ECH")) + o = s:option(Flag, _n("ech"), translate("ECH")) o.default = "0" - o:depends({ [option_name("tls")] = true, [option_name("flow")] = "", [option_name("reality")] = false }) - o:depends({ [option_name("protocol")] = "tuic" }) - o:depends({ [option_name("protocol")] = "hysteria" }) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("tls")] = true, [_n("flow")] = "", [_n("reality")] = false }) + o:depends({ [_n("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(TextValue, option_name("ech_config"), translate("ECH Config")) + o = s:option(TextValue, _n("ech_config"), translate("ECH Config")) o.default = "" o.rows = 5 o.wrap = "off" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) o.validate = function(self, value) value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n") value = value:gsub("^%s*\n", "") @@ -422,21 +419,21 @@ if singbox_tags:find("with_ech") then return value end - o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) + o = s:option(Flag, _n("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) - o = s:option(Flag, option_name("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) + o = s:option(Flag, _n("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) end if singbox_tags:find("with_utls") then - o = s:option(Flag, option_name("utls"), translate("uTLS")) + o = s:option(Flag, _n("utls"), translate("uTLS")) o.default = "0" - o:depends({ [option_name("tls")] = true }) + o:depends({ [_n("tls")] = true }) - o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print")) + o = s:option(ListValue, _n("fingerprint"), translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -448,25 +445,25 @@ if singbox_tags:find("with_utls") then o:value("random") -- o:value("randomized") o.default = "chrome" - o:depends({ [option_name("tls")] = true, [option_name("utls")] = true }) + o:depends({ [_n("tls")] = true, [_n("utls")] = true }) -- [[ REALITY部分 ]] -- - o = s:option(Flag, option_name("reality"), translate("REALITY")) + o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 - o:depends({ [option_name("protocol")] = "vless", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "vmess", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "socks", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "trojan", [option_name("utls")] = true }) + o:depends({ [_n("protocol")] = "vless", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "vmess", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "shadowsocks", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "socks", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "trojan", [_n("utls")] = true }) - o = s:option(Value, option_name("reality_publicKey"), translate("Public Key")) - o:depends({ [option_name("utls")] = true, [option_name("reality")] = true }) + o = s:option(Value, _n("reality_publicKey"), translate("Public Key")) + o:depends({ [_n("utls")] = true, [_n("reality")] = true }) - o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) - o:depends({ [option_name("utls")] = true, [option_name("reality")] = true }) + o = s:option(Value, _n("reality_shortId"), translate("Short Id")) + o:depends({ [_n("utls")] = true, [_n("reality")] = true }) end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("tcp", "TCP") o:value("http", "HTTP") o:value("ws", "WebSocket") @@ -478,158 +475,158 @@ if singbox_tags:find("with_grpc") then o:value("grpc", "gRPC") else o:value("grpc", "gRPC-lite") end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) if singbox_tags:find("with_wireguard") then - o = s:option(Value, option_name("wireguard_public_key"), translate("Public Key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_public_key"), translate("Public Key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_secret_key"), translate("Private Key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_secret_key"), translate("Private Key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_preSharedKey"), translate("Pre shared key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_preSharedKey"), translate("Pre shared key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(DynamicList, option_name("wireguard_local_address"), translate("Local Address")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(DynamicList, _n("wireguard_local_address"), translate("Local Address")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_mtu"), translate("MTU")) + o = s:option(Value, _n("wireguard_mtu"), translate("MTU")) o.default = "1420" - o:depends({ [option_name("protocol")] = "wireguard" }) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) + o:depends({ [_n("protocol")] = "wireguard" }) end -- [[ HTTP部分 ]]-- -o = s:option(Value, option_name("http_host"), translate("HTTP Host")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_host"), translate("HTTP Host")) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_path"), translate("HTTP Path")) +o = s:option(Value, _n("http_path"), translate("HTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "http" }) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Flag, option_name("http_h2_health_check"), translate("Health check")) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http" }) +o = s:option(Flag, _n("http_h2_health_check"), translate("Health check")) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_h2_read_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("http_h2_read_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http", [option_name("http_h2_health_check")] = true }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http", [_n("http_h2_health_check")] = true }) -o = s:option(Value, option_name("http_h2_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("http_h2_health_check_timeout"), translate("Health check timeout")) o.default = "15" -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http", [option_name("http_h2_health_check")] = true }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http", [_n("http_h2_health_check")] = true }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Flag, option_name("ws_enableEarlyData"), translate("Enable early data")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Flag, _n("ws_enableEarlyData"), translate("Enable early data")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_maxEarlyData"), translate("Early data length")) +o = s:option(Value, _n("ws_maxEarlyData"), translate("Early data length")) o.default = "1024" -o:depends({ [option_name("ws_enableEarlyData")] = true }) +o:depends({ [_n("ws_enableEarlyData")] = true }) -o = s:option(Value, option_name("ws_earlyDataHeaderName"), translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol")) -o:depends({ [option_name("ws_enableEarlyData")] = true }) +o = s:option(Value, _n("ws_earlyDataHeaderName"), translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol")) +o:depends({ [_n("ws_enableEarlyData")] = true }) -- [[ HTTPUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HTTPUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HTTPUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("grpc_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Flag, _n("grpc_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Value, option_name("grpc_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("grpc_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("grpc_health_check_timeout"), translate("Health check timeout")) o.default = "20" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Flag, option_name("grpc_permit_without_stream"), translate("Permit without stream")) +o = s:option(Flag, _n("grpc_permit_without_stream"), translate("Permit without stream")) o.default = "0" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -- [[ Mux ]]-- -o = s:option(Flag, option_name("mux"), translate("Mux")) +o = s:option(Flag, _n("mux"), translate("Mux")) o.rmempty = false -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("uot")] = "" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("uot")] = "" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("mux_type"), translate("Mux")) +o = s:option(ListValue, _n("mux_type"), translate("Mux")) o:value("smux") o:value("yamux") o:value("h2mux") -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")) +o = s:option(Value, _n("mux_concurrency"), translate("Mux concurrency")) o.default = 4 -o:depends({ [option_name("mux")] = true, [option_name("tcpbrutal")] = false }) +o:depends({ [_n("mux")] = true, [_n("tcpbrutal")] = false }) -o = s:option(Flag, option_name("mux_padding"), translate("Padding")) +o = s:option(Flag, _n("mux_padding"), translate("Padding")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -- [[ TCP Brutal ]]-- -o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o = s:option(Flag, _n("tcpbrutal"), translate("TCP Brutal")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("tcpbrutal_up_mbps"), translate("Max upload Mbps")) o.default = "10" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("tcpbrutal_down_mbps"), translate("Max download Mbps")) o.default = "50" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Flag, option_name("shadowtls"), "ShadowTLS") +o = s:option(Flag, _n("shadowtls"), "ShadowTLS") o.default = 0 -o:depends({ [option_name("protocol")] = "vmess", [option_name("tls")] = false }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("tls")] = false }) +o:depends({ [_n("protocol")] = "vmess", [_n("tls")] = false }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("tls")] = false }) -o = s:option(ListValue, option_name("shadowtls_version"), "ShadowTLS " .. translate("Version")) +o = s:option(ListValue, _n("shadowtls_version"), "ShadowTLS " .. translate("Version")) o.default = "1" o:value("1", "ShadowTLS v1") o:value("2", "ShadowTLS v2") o:value("3", "ShadowTLS v3") -o:depends({ [option_name("shadowtls")] = true }) +o:depends({ [_n("shadowtls")] = true }) -o = s:option(Value, option_name("shadowtls_password"), "ShadowTLS " .. translate("Password")) +o = s:option(Value, _n("shadowtls_password"), "ShadowTLS " .. translate("Password")) o.password = true -o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_version")] = "2" }) -o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_version")] = "3" }) +o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_version")] = "2" }) +o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_version")] = "3" }) -o = s:option(Value, option_name("shadowtls_serverName"), "ShadowTLS " .. translate("Domain")) -o:depends({ [option_name("shadowtls")] = true }) +o = s:option(Value, _n("shadowtls_serverName"), "ShadowTLS " .. translate("Domain")) +o:depends({ [_n("shadowtls")] = true }) if singbox_tags:find("with_utls") then - o = s:option(Flag, option_name("shadowtls_utls"), "ShadowTLS " .. translate("uTLS")) + o = s:option(Flag, _n("shadowtls_utls"), "ShadowTLS " .. translate("uTLS")) o.default = "0" - o:depends({ [option_name("shadowtls")] = true }) + o:depends({ [_n("shadowtls")] = true }) - o = s:option(ListValue, option_name("shadowtls_fingerprint"), "ShadowTLS " .. translate("Finger Print")) + o = s:option(ListValue, _n("shadowtls_fingerprint"), "ShadowTLS " .. translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -641,62 +638,62 @@ if singbox_tags:find("with_utls") then o:value("random") -- o:value("randomized") o.default = "chrome" - o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_utls")] = true }) + o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_utls")] = true }) end -- [[ SIP003 plugin ]]-- -o = s:option(Flag, option_name("plugin_enabled"), translate("plugin")) +o = s:option(Flag, _n("plugin_enabled"), translate("plugin")) o.default = 0 -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("plugin"), "SIP003 " .. translate("plugin")) +o = s:option(ListValue, _n("plugin"), "SIP003 " .. translate("plugin")) o.default = "obfs-local" -o:depends({ [option_name("plugin_enabled")] = true }) +o:depends({ [_n("plugin_enabled")] = true }) o:value("obfs-local") o:value("v2ray-plugin") -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin_enabled")] = true }) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin_enabled")] = true }) -o = s:option(ListValue, option_name("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect.")) +o = s:option(ListValue, _n("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect.")) o.default = "" o:value("", translate("Auto")) o:value("prefer_ipv4", translate("Prefer IPv4")) o:value("prefer_ipv6", translate("Prefer IPv6")) o:value("ipv4_only", translate("IPv4 Only")) o:value("ipv6_only", translate("IPv6 Only")) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "shadowsocksr" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "wireguard" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocksr" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) -o = s:option(ListValue, option_name("chain_proxy"), translate("Chain Proxy")) +o = s:option(ListValue, _n("chain_proxy"), translate("Chain Proxy")) o:value("", translate("Close(Not use)")) o:value("1", translate("Preproxy Node")) o:value("2", translate("Landing Node")) -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - o:depends({ [option_name("protocol")] = v }) + o:depends({ [_n("protocol")] = v }) end end -o = s:option(ListValue, option_name("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "1" }) +o = s:option(ListValue, _n("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "1" }) -o = s:option(ListValue, option_name("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "2" }) +o = s:option(ListValue, _n("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "2" }) for k, v in pairs(nodes_table) do if v.type == "sing-box" and v.id ~= arg[1] then - s.fields[option_name("preproxy_node")]:value(v.id, v.remark) - s.fields[option_name("to_node")]:value(v.id, v.remark) + s.fields[_n("preproxy_node")]:value(v.id, v.remark) + s.fields[_n("to_node")]:value(v.id, v.remark) end end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua index 089e1ab70c..d4d8cda89f 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua @@ -10,7 +10,7 @@ local type_name = "SS-Rust" local option_prefix = "ssrust_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -24,34 +24,34 @@ local ssrust_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Rust")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(Value, option_name("method"), translate("Encrypt Method")) +o = s:option(Value, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssrust_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(ListValue, option_name("plugin"), translate("plugin")) +o = s:option(ListValue, _n("plugin"), translate("plugin")) o:value("none", translate("none")) if api.is_finded("xray-plugin") then o:value("xray-plugin") end if api.is_finded("v2ray-plugin") then o:value("v2ray-plugin") end if api.is_finded("obfs-local") then o:value("obfs-local") end -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin")] = "xray-plugin"}) -o:depends({ [option_name("plugin")] = "v2ray-plugin"}) -o:depends({ [option_name("plugin")] = "obfs-local"}) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin")] = "xray-plugin"}) +o:depends({ [_n("plugin")] = "v2ray-plugin"}) +o:depends({ [_n("plugin")] = "obfs-local"}) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua index af5292b4aa..1ccfd8e9c9 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua @@ -10,7 +10,7 @@ local type_name = "SS" local option_prefix = "ss_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -25,34 +25,34 @@ local ss_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Libev")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(Value, option_name("method"), translate("Encrypt Method")) +o = s:option(Value, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ss_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(ListValue, option_name("plugin"), translate("plugin")) +o = s:option(ListValue, _n("plugin"), translate("plugin")) o:value("none", translate("none")) if api.is_finded("xray-plugin") then o:value("xray-plugin") end if api.is_finded("v2ray-plugin") then o:value("v2ray-plugin") end if api.is_finded("obfs-local") then o:value("obfs-local") end -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin")] = "xray-plugin"}) -o:depends({ [option_name("plugin")] = "v2ray-plugin"}) -o:depends({ [option_name("plugin")] = "obfs-local"}) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin")] = "xray-plugin"}) +o:depends({ [_n("plugin")] = "v2ray-plugin"}) +o:depends({ [_n("plugin")] = "obfs-local"}) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua index 10dc24e405..4c65605854 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua @@ -10,7 +10,7 @@ local type_name = "SSR" local option_prefix = "ssr_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -37,32 +37,32 @@ local ssr_obfs_list = { s.fields["type"]:value(type_name, translate("ShadowsocksR Libev")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssr_encrypt_method_list) do o:value(t) end -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end -o = s:option(Value, option_name("protocol_param"), translate("Protocol_param")) +o = s:option(Value, _n("protocol_param"), translate("Protocol_param")) -o = s:option(ListValue, option_name("obfs"), translate("Obfs")) +o = s:option(ListValue, _n("obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end -o = s:option(Value, option_name("obfs_param"), translate("Obfs_param")) +o = s:option(Value, _n("obfs_param"), translate("Obfs_param")) -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua index 9377046e57..20ffce4030 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua @@ -10,7 +10,7 @@ local type_name = "Trojan-Plus" local option_prefix = "trojan_plus_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,19 +18,19 @@ end s.fields["type"]:value(type_name, "Trojan-Plus") -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then @@ -42,15 +42,15 @@ o.validate = function(self, value, t) end end -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket")) +o = s:option(Flag, _n("tls_sessionTicket"), translate("Session Ticket")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua index 1f77044039..ba3753d73e 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua @@ -10,7 +10,7 @@ local type_name = "TUIC" local option_prefix = "tuic_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,16 +18,16 @@ end s.fields["type"]:value(type_name, translate("TUIC")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -- Tuic Password for remote server connect -o = s:option(Value, option_name("password"), translate("TUIC User Password For Connect Remote Server")) +o = s:option(Value, _n("password"), translate("TUIC User Password For Connect Remote Server")) o.password = true o.rmempty = true o.default = "" @@ -35,32 +35,32 @@ o.rewrite_option = o.option --[[ -- Tuic username for local socks connect -o = s:option(Value, option_name("socks_username"), translate("TUIC UserName For Local Socks")) +o = s:option(Value, _n("socks_username"), translate("TUIC UserName For Local Socks")) o.rmempty = true o.default = "" o.rewrite_option = o.option -- Tuic Password for local socks connect -o = s:option(Value, option_name("socks_password"), translate("TUIC Password For Local Socks")) +o = s:option(Value, _n("socks_password"), translate("TUIC Password For Local Socks")) o.password = true o.rmempty = true o.default = "" o.rewrite_option = o.option --]] -o = s:option(Value, option_name("ip"), translate("Set the TUIC proxy server ip address")) +o = s:option(Value, _n("ip"), translate("Set the TUIC proxy server ip address")) o.datatype = "ipaddr" o.rmempty = true o.rewrite_option = o.option -o = s:option(ListValue, option_name("udp_relay_mode"), translate("UDP relay mode")) +o = s:option(ListValue, _n("udp_relay_mode"), translate("UDP relay mode")) o:value("native", translate("native")) o:value("quic", translate("QUIC")) o.default = "native" o.rmempty = true o.rewrite_option = o.option -o = s:option(ListValue, option_name("congestion_control"), translate("Congestion control algorithm")) +o = s:option(ListValue, _n("congestion_control"), translate("Congestion control algorithm")) o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) @@ -68,65 +68,65 @@ o.default = "cubic" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("heartbeat"), translate("Heartbeat interval(second)")) +o = s:option(Value, _n("heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("timeout"), translate("Timeout for establishing a connection to server(second)")) +o = s:option(Value, _n("timeout"), translate("Timeout for establishing a connection to server(second)")) o.datatype = "uinteger" o.default = "8" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("gc_interval"), translate("Garbage collection interval(second)")) +o = s:option(Value, _n("gc_interval"), translate("Garbage collection interval(second)")) o.datatype = "uinteger" o.default = "3" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("gc_lifetime"), translate("Garbage collection lifetime(second)")) +o = s:option(Value, _n("gc_lifetime"), translate("Garbage collection lifetime(second)")) o.datatype = "uinteger" o.default = "15" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("send_window"), translate("TUIC send window")) +o = s:option(Value, _n("send_window"), translate("TUIC send window")) o.datatype = "uinteger" o.default = 20971520 o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("receive_window"), translate("TUIC receive window")) +o = s:option(Value, _n("receive_window"), translate("TUIC receive window")) o.datatype = "uinteger" o.default = 10485760 o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("max_package_size"), translate("TUIC Maximum packet size the socks5 server can receive from external, in bytes")) +o = s:option(Value, _n("max_package_size"), translate("TUIC Maximum packet size the socks5 server can receive from external, in bytes")) o.datatype = "uinteger" o.default = 1500 o.rmempty = true o.rewrite_option = o.option --Tuic settings for the local inbound socks5 server -o = s:option(Flag, option_name("dual_stack"), translate("Set if the listening socket should be dual-stack")) +o = s:option(Flag, _n("dual_stack"), translate("Set if the listening socket should be dual-stack")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(Flag, option_name("disable_sni"), translate("Disable SNI")) +o = s:option(Flag, _n("disable_sni"), translate("Disable SNI")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(Flag, option_name("zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) +o = s:option(Flag, _n("zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(DynamicList, option_name("tls_alpn"), translate("TLS ALPN")) +o = s:option(DynamicList, _n("tls_alpn"), translate("TLS ALPN")) o.rmempty = true o.rewrite_option = o.option diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua index ced7374418..81c8c3fcc2 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua @@ -10,7 +10,7 @@ local type_name = "Hysteria2" local option_prefix = "hysteria2_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,31 +18,31 @@ end s.fields["type"]:value(type_name, "Hysteria2") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("obfs"), translate("Obfs Password")) +o = s:option(Value, _n("obfs"), translate("Obfs Password")) o.rewrite_option = o.option -o = s:option(Value, option_name("auth_password"), translate("Auth Password")) +o = s:option(Value, _n("auth_password"), translate("Auth Password")) o.password = true o.rewrite_option = o.option -o = s:option(Flag, option_name("udp"), translate("UDP")) +o = s:option(Flag, _n("udp"), translate("UDP")) o.default = "1" o.rewrite_option = o.option -o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("up_mbps"), translate("Max upload Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("down_mbps"), translate("Max download Mbps")) o.rewrite_option = o.option -o = s:option(Flag, option_name("ignoreClientBandwidth"), translate("ignoreClientBandwidth")) +o = s:option(Flag, _n("ignoreClientBandwidth"), translate("ignoreClientBandwidth")) o.default = "0" o.rewrite_option = o.option -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" o.validate = function(self, value, t) if value and value ~= "" then @@ -55,7 +55,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" o.validate = function(self, value, t) if value and value ~= "" then @@ -68,7 +68,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua index ac0c315450..2de2865f3d 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua @@ -10,7 +10,7 @@ local type_name = "Xray" local option_prefix = "xray_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -26,7 +26,7 @@ local header_type_list = { s.fields["type"]:value(type_name, "Xray") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("vmess", "Vmess") o:value("vless", "VLESS") o:value("http", "HTTP") @@ -35,91 +35,91 @@ o:value("shadowsocks", "Shadowsocks") o:value("trojan", "Trojan") o:value("dokodemo-door", "dokodemo-door") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end end return value end -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("d_protocol"), translate("Destination protocol")) +o = s:option(ListValue, _n("d_protocol"), translate("Destination protocol")) o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("d_address"), translate("Destination address")) -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o = s:option(Value, _n("d_address"), translate("Destination address")) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("d_port"), translate("Destination port")) +o = s:option(Value, _n("d_port"), translate("Destination port")) o.datatype = "port" -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("decryption"), translate("Encrypt Method")) +o = s:option(Value, _n("decryption"), translate("Encrypt Method")) o.default = "none" -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("x_ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("x_ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(x_ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("iv_check"), translate("IV Check")) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("iv_check"), translate("IV Check")) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("ss_network"), translate("Transport")) +o = s:option(ListValue, _n("ss_network"), translate("Transport")) o.default = "tcp,udp" o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("udp_forward"), translate("UDP Forward")) +o = s:option(Flag, _n("udp_forward"), translate("UDP Forward")) o.default = "1" o.rmempty = false -o:depends({ [option_name("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "raw" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then - local reality = s.fields[option_name("reality")] and s.fields[option_name("reality")]:formvalue(t) or nil + local reality = s.fields[_n("reality")] and s.fields[_n("reality")]:formvalue(t) or nil if reality and reality == "1" then return value end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -127,32 +127,32 @@ o.validate = function(self, value, t) return value end end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ REALITY部分 ]] -- -o = s:option(Flag, option_name("reality"), translate("REALITY")) +o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("reality_private_key"), translate("Private Key")) -o:depends({ [option_name("reality")] = true }) +o = s:option(Value, _n("reality_private_key"), translate("Private Key")) +o:depends({ [_n("reality")] = true }) -o = s:option(DynamicList, option_name("reality_shortId"), translate("Short Id")) -o:depends({ [option_name("reality")] = true }) +o = s:option(DynamicList, _n("reality_shortId"), translate("Short Id")) +o:depends({ [_n("reality")] = true }) -o = s:option(Value, option_name("reality_dest"), translate("Dest")) +o = s:option(Value, _n("reality_dest"), translate("Dest")) o.default = "google.com:443" -o:depends({ [option_name("reality")] = true }) +o:depends({ [_n("reality")] = true }) -o = s:option(Value, option_name("reality_serverNames"), translate("serverNames")) -o:depends({ [option_name("reality")] = true }) +o = s:option(Value, _n("reality_serverNames"), translate("serverNames")) +o:depends({ [_n("reality")] = true }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "h2,http/1.1" o:value("h3") o:value("h2") @@ -160,18 +160,18 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) --- o = s:option(Value, option_name("minversion"), translate("minversion")) +-- o = s:option(Value, _n("minversion"), translate("minversion")) -- o.default = "1.3" -- o:value("1.3") ---o:depends({ [option_name("tls")] = true }) +--o:depends({ [_n("tls")] = true }) -- [[ TLS部分 ]] -- -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -183,9 +183,9 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -197,7 +197,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("raw", "RAW") o:value("mkcp", "mKCP") o:value("ws", "WebSocket") @@ -207,157 +207,157 @@ o:value("quic", "QUIC") o:value("grpc", "gRPC") o:value("httpupgrade", "HttpUpgrade") o:value("xhttp", "XHTTP") -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) +o:depends({ [_n("transport")] = "ws" }) -- [[ HttpUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HttpUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HttpUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HttpUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HttpUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ SplitHTTP部分 ]]-- -o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(Value, _n("xhttp_host"), translate("XHTTP Host")) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path")) +o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_maxuploadsize"), translate("maxUploadSize")) +o = s:option(Value, _n("xhttp_maxuploadsize"), translate("maxUploadSize")) o.default = "1000000" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads")) +o = s:option(Value, _n("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads")) o.default = "10" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -- [[ HTTP/2部分 ]]-- -o = s:option(Value, option_name("h2_host"), translate("HTTP/2 Host")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path")) +o:depends({ [_n("transport")] = "h2" }) -- [[ TCP部分 ]]-- -- TCP伪装 -o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("tcp_guise"), translate("Camouflage Type")) o:value("none", "none") o:value("http", "http") -o:depends({ [option_name("transport")] = "raw" }) +o:depends({ [_n("transport")] = "raw" }) -- HTTP域名 -o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_host"), translate("HTTP Host")) +o:depends({ [_n("tcp_guise")] = "http" }) -- HTTP路径 -o = s:option(DynamicList, option_name("tcp_guise_http_path"), translate("HTTP Path")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_path"), translate("HTTP Path")) +o:depends({ [_n("tcp_guise")] = "http" }) -- [[ mKCP部分 ]]-- -o = s:option(ListValue, option_name("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +o = s:option(ListValue, _n("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_mtu"), translate("KCP MTU")) +o = s:option(Value, _n("mkcp_mtu"), translate("KCP MTU")) o.default = "1350" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_tti"), translate("KCP TTI")) +o = s:option(Value, _n("mkcp_tti"), translate("KCP TTI")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) +o = s:option(Value, _n("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) o.default = "5" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) +o = s:option(Value, _n("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Flag, option_name("mkcp_congestion"), translate("KCP Congestion")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Flag, _n("mkcp_congestion"), translate("KCP Congestion")) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_readBufferSize"), translate("KCP readBufferSize")) +o = s:option(Value, _n("mkcp_readBufferSize"), translate("KCP readBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) +o = s:option(Value, _n("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_seed"), translate("KCP Seed")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Value, _n("mkcp_seed"), translate("KCP Seed")) +o:depends({ [_n("transport")] = "mkcp" }) -- [[ DomainSocket部分 ]]-- -o = s:option(Value, option_name("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) -o:depends({ [option_name("transport")] = "ds" }) +o = s:option(Value, _n("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) +o:depends({ [_n("transport")] = "ds" }) -- [[ QUIC部分 ]]-- -o = s:option(ListValue, option_name("quic_security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("quic_security"), translate("Encrypt Method")) o:value("none") o:value("aes-128-gcm") o:value("chacha20-poly1305") -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(Value, option_name("quic_key"), translate("Encrypt Method") .. translate("Key")) -o:depends({ [option_name("transport")] = "quic" }) +o = s:option(Value, _n("quic_key"), translate("Encrypt Method") .. translate("Key")) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(ListValue, option_name("quic_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("quic_guise"), translate("Camouflage Type")) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("acceptProxyProtocol"), translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used.")) +o = s:option(Flag, _n("acceptProxyProtocol"), translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used.")) o.default = "0" -- [[ Fallback部分 ]]-- -o = s:option(Flag, option_name("fallback"), translate("Fallback")) -o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "raw" }) -o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "raw" }) +o = s:option(Flag, _n("fallback"), translate("Fallback")) +o:depends({ [_n("protocol")] = "vless", [_n("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "trojan", [_n("transport")] = "raw" }) --[[ -o = s:option(Value, option_name("fallback_alpn"), "Fallback alpn") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_alpn"), "Fallback alpn") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_path"), "Fallback path") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_path"), "Fallback path") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_dest"), "Fallback dest") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_dest"), "Fallback dest") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_xver"), "Fallback xver") +o = s:option(Value, _n("fallback_xver"), "Fallback xver") o.default = 0 -o:depends({ [option_name("fallback")] = true }) +o:depends({ [_n("fallback")] = true }) ]]-- -o = s:option(DynamicList, option_name("fallback_list"), "Fallback", translate("dest,path")) -o:depends({ [option_name("fallback")] = true }) +o = s:option(DynamicList, _n("fallback_list"), "Fallback", translate("dest,path")) +o:depends({ [_n("fallback")] = true }) -o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o = s:option(Flag, _n("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o.default = "0" -o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) +o = s:option(Flag, _n("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) o.default = "0" local nodes_table = {} @@ -370,46 +370,45 @@ for k, e in ipairs(api.get_valid_nodes()) do end end -o = s:option(ListValue, option_name("outbound_node"), translate("outbound node")) -o:value("nil", translate("Close")) +o = s:option(ListValue, _n("outbound_node"), translate("outbound node")) +o:value("", translate("Close")) o:value("_socks", translate("Custom Socks")) o:value("_http", translate("Custom HTTP")) o:value("_iface", translate("Custom Interface")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end -o.default = "nil" -o = s:option(Value, option_name("outbound_node_address"), translate("Address (Support Domain Name)")) -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o = s:option(Value, _n("outbound_node_address"), translate("Address (Support Domain Name)")) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_port"), translate("Port")) +o = s:option(Value, _n("outbound_node_port"), translate("Port")) o.datatype = "port" -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_username"), translate("Username")) -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o = s:option(Value, _n("outbound_node_username"), translate("Username")) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_password"), translate("Password")) +o = s:option(Value, _n("outbound_node_password"), translate("Password")) o.password = true -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_iface"), translate("Interface")) +o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("outbound_node")] = "_iface"}) +o:depends({ [_n("outbound_node")] = "_iface"}) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "warning" o:value("debug") o:value("info") o:value("warning") o:value("error") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua index 638460af85..61856ca1e1 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua @@ -14,7 +14,7 @@ local type_name = "sing-box" local option_prefix = "singbox_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -27,7 +27,7 @@ local ss_method_list = { s.fields["type"]:value(type_name, "Sing-Box") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("mixed", "Mixed") o:value("socks", "Socks") o:value("http", "HTTP") @@ -47,166 +47,166 @@ if singbox_tags:find("with_quic") then end o:value("direct", "Direct") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end end return value end -o:depends({ [option_name("protocol")] = "mixed" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "mixed" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "naive" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "naive" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "tuic" }) if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria_up_mbps"), translate("Max upload Mbps")) + o = s:option(Value, _n("hysteria_up_mbps"), translate("Max upload Mbps")) o.default = "100" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_down_mbps"), translate("Max download Mbps")) + o = s:option(Value, _n("hysteria_down_mbps"), translate("Max download Mbps")) o.default = "100" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_obfs"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_obfs"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(ListValue, option_name("hysteria_auth_type"), translate("Auth Type")) + o = s:option(ListValue, _n("hysteria_auth_type"), translate("Auth Type")) o:value("disable", translate("Disable")) o:value("string", translate("STRING")) o:value("base64", translate("BASE64")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "string"}) - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "base64"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "string"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "base64"}) - o = s:option(Value, option_name("hysteria_recv_window_conn"), translate("QUIC stream receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_conn"), translate("QUIC stream receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window_client"), translate("QUIC connection receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_client"), translate("QUIC connection receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_max_conn_client"), translate("QUIC concurrent bidirectional streams")) + o = s:option(Value, _n("hysteria_max_conn_client"), translate("QUIC concurrent bidirectional streams")) o.default = "1024" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Flag, _n("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "hysteria" }) end if singbox_tags:find("with_quic") then - o = s:option(ListValue, option_name("tuic_congestion_control"), translate("Congestion control algorithm")) + o = s:option(ListValue, _n("tuic_congestion_control"), translate("Congestion control algorithm")) o.default = "cubic" o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Flag, option_name("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) + o = s:option(Flag, _n("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_heartbeat"), translate("Heartbeat interval(second)")) + o = s:option(Value, _n("tuic_heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "tuic" }) + o = s:option(Value, _n("tuic_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "tuic" }) end if singbox_tags:find("with_quic") then - o = s:option(Flag, option_name("hysteria2_ignore_client_bandwidth"), translate("Commands the client to use the BBR flow control algorithm")) + o = s:option(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Commands the client to use the BBR flow control algorithm")) o.default = 0 - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_up_mbps"), translate("Max upload Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2", [option_name("hysteria2_ignore_client_bandwidth")] = false }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) + o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_ignore_client_bandwidth")] = false }) - o = s:option(Value, option_name("hysteria2_down_mbps"), translate("Max download Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2", [option_name("hysteria2_ignore_client_bandwidth")] = false }) + o = s:option(Value, _n("hysteria2_down_mbps"), translate("Max download Mbps")) + o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_ignore_client_bandwidth")] = false }) - o = s:option(ListValue, option_name("hysteria2_obfs_type"), translate("Obfs Type")) + o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_obfs_password"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria2"}) + o:depends({ [_n("protocol")] = "hysteria2"}) end -o = s:option(ListValue, option_name("d_protocol"), translate("Destination protocol")) +o = s:option(ListValue, _n("d_protocol"), translate("Destination protocol")) o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "direct" }) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("d_address"), translate("Destination address")) -o:depends({ [option_name("protocol")] = "direct" }) +o = s:option(Value, _n("d_address"), translate("Destination address")) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("d_port"), translate("Destination port")) +o = s:option(Value, _n("d_port"), translate("Destination port")) o.datatype = "port" -o:depends({ [option_name("protocol")] = "direct" }) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("decryption"), translate("Encrypt Method")) +o = s:option(Value, _n("decryption"), translate("Encrypt Method")) o.default = "none" -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then - local reality = s.fields[option_name("reality")] and s.fields[option_name("reality")]:formvalue(t) or nil + local reality = s.fields[_n("reality")] and s.fields[_n("reality")]:formvalue(t) or nil if reality and reality == "1" then return value end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -214,45 +214,45 @@ o.validate = function(self, value, t) return value end end -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) if singbox_tags:find("with_reality_server") then -- [[ REALITY部分 ]] -- - o = s:option(Flag, option_name("reality"), translate("REALITY")) + o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 - o:depends({ [option_name("protocol")] = "http", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "vmess", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "trojan", [option_name("tls")] = true }) + o:depends({ [_n("protocol")] = "http", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "vmess", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "trojan", [_n("tls")] = true }) - o = s:option(Value, option_name("reality_private_key"), translate("Private Key")) - o:depends({ [option_name("reality")] = true }) + o = s:option(Value, _n("reality_private_key"), translate("Private Key")) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) - o:depends({ [option_name("reality")] = true }) + o = s:option(Value, _n("reality_shortId"), translate("Short Id")) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_handshake_server"), translate("Handshake Server")) + o = s:option(Value, _n("reality_handshake_server"), translate("Handshake Server")) o.default = "google.com" - o:depends({ [option_name("reality")] = true }) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_handshake_server_port"), translate("Handshake Server Port")) + o = s:option(Value, _n("reality_handshake_server_port"), translate("Handshake Server Port")) o.datatype = "port" o.default = "443" - o:depends({ [option_name("reality")] = true }) + o:depends({ [_n("reality")] = true }) end -- [[ TLS部分 ]] -- -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -264,13 +264,13 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -283,19 +283,19 @@ o.validate = function(self, value, t) end if singbox_tags:find("with_ech") then - o = s:option(Flag, option_name("ech"), translate("ECH")) + o = s:option(Flag, _n("ech"), translate("ECH")) o.default = "0" - o:depends({ [option_name("tls")] = true, [option_name("flow")] = "", [option_name("reality")] = false }) - o:depends({ [option_name("protocol")] = "naive" }) - o:depends({ [option_name("protocol")] = "hysteria" }) - o:depends({ [option_name("protocol")] = "tuic" }) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("tls")] = true, [_n("flow")] = "", [_n("reality")] = false }) + o:depends({ [_n("protocol")] = "naive" }) + o:depends({ [_n("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(TextValue, option_name("ech_key"), translate("ECH Key")) + o = s:option(TextValue, _n("ech_key"), translate("ECH Key")) o.default = "" o.rows = 5 o.wrap = "off" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) o.validate = function(self, value) value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n") value = value:gsub("^%s*\n", "") @@ -305,80 +305,80 @@ if singbox_tags:find("with_ech") then return value end - o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) + o = s:option(Flag, _n("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) - o = s:option(Flag, option_name("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) + o = s:option(Flag, _n("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("tcp", "TCP") o:value("http", "HTTP") o:value("ws", "WebSocket") o:value("httpupgrade", "HTTPUpgrade") o:value("quic", "QUIC") o:value("grpc", "gRPC") -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ HTTP部分 ]]-- -o = s:option(Value, option_name("http_host"), translate("HTTP Host")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_host"), translate("HTTP Host")) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_path"), translate("HTTP Path")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_path"), translate("HTTP Path")) +o:depends({ [_n("transport")] = "http" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) +o:depends({ [_n("transport")] = "ws" }) -- [[ HTTPUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HTTPUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_path"), translate("HTTPUpgrade Path")) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -- [[ Mux ]]-- -o = s:option(Flag, option_name("mux"), translate("Mux")) +o = s:option(Flag, _n("mux"), translate("Mux")) o.rmempty = false -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ TCP Brutal ]]-- -o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o = s:option(Flag, _n("tcpbrutal"), translate("TCP Brutal")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("tcpbrutal_up_mbps"), translate("Max upload Mbps")) o.default = "10" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("tcpbrutal_down_mbps"), translate("Max download Mbps")) o.default = "50" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o = s:option(Flag, _n("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o.default = "0" -o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) +o = s:option(Flag, _n("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) o.default = "0" local nodes_table = {} @@ -391,46 +391,45 @@ for k, e in ipairs(api.get_valid_nodes()) do end end -o = s:option(ListValue, option_name("outbound_node"), translate("outbound node")) -o:value("nil", translate("Close")) +o = s:option(ListValue, _n("outbound_node"), translate("outbound node")) +o:value("", translate("Close")) o:value("_socks", translate("Custom Socks")) o:value("_http", translate("Custom HTTP")) o:value("_iface", translate("Custom Interface")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end -o.default = "nil" -o = s:option(Value, option_name("outbound_node_address"), translate("Address (Support Domain Name)")) -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o = s:option(Value, _n("outbound_node_address"), translate("Address (Support Domain Name)")) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_port"), translate("Port")) +o = s:option(Value, _n("outbound_node_port"), translate("Port")) o.datatype = "port" -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_username"), translate("Username")) -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o = s:option(Value, _n("outbound_node_username"), translate("Username")) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_password"), translate("Password")) +o = s:option(Value, _n("outbound_node_password"), translate("Password")) o.password = true -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_iface"), translate("Interface")) +o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("outbound_node")] = "_iface" }) +o:depends({ [_n("outbound_node")] = "_iface" }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "info" o:value("debug") o:value("info") o:value("warn") o:value("error") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua index 287a8181ca..82cd0524f0 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua @@ -10,7 +10,7 @@ local type_name = "Socks" local option_prefix = "socks_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,14 +18,14 @@ end s.fields["type"]:value(type_name, "Socks") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end @@ -33,14 +33,14 @@ o.validate = function(self, value, t) return value end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) +o:depends({ [_n("auth")] = true }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua index 45e1d0728c..63ed44c55e 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua @@ -10,7 +10,7 @@ local type_name = "SS-Rust" local option_prefix = "ssrust_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -24,23 +24,23 @@ local ssrust_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Rust")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssrust_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua index d46238a5f3..1d6b7c3c51 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua @@ -10,7 +10,7 @@ local type_name = "SS" local option_prefix = "ss_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -27,23 +27,23 @@ local ss_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ss_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua index 2a281a9ad1..a6ba4fb9af 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua @@ -10,7 +10,7 @@ local type_name = "SSR" local option_prefix = "ssr_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -37,37 +37,37 @@ local ssr_obfs_list = { s.fields["type"]:value(type_name, translate("ShadowsocksR")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssr_encrypt_method_list) do o:value(t) end -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end -o = s:option(Value, option_name("protocol_param"), translate("Protocol_param")) +o = s:option(Value, _n("protocol_param"), translate("Protocol_param")) -o = s:option(ListValue, option_name("obfs"), translate("Obfs")) +o = s:option(ListValue, _n("obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end -o = s:option(Value, option_name("obfs_param"), translate("Obfs_param")) +o = s:option(Value, _n("obfs_param"), translate("Obfs_param")) -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("udp_forward"), translate("UDP Forward")) +o = s:option(Flag, _n("udp_forward"), translate("UDP Forward")) o.default = "1" o.rmempty = false -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua index 05cafa8219..21bbad114e 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua @@ -10,7 +10,7 @@ local type_name = "Trojan-Plus" local option_prefix = "trojan_plus_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,15 +18,15 @@ end s.fields["type"]:value(type_name, "Trojan-Plus") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then @@ -35,8 +35,8 @@ o.validate = function(self, value, t) return nil, translate("Original Trojan only supported 'tls', please choose 'tls'.") end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -45,9 +45,9 @@ o.validate = function(self, value, t) end end -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -59,9 +59,9 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -73,36 +73,36 @@ o.validate = function(self, value, t) return nil end -o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket")) +o = s:option(Flag, _n("tls_sessionTicket"), translate("Session Ticket")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tcp_fast_open"), translate("TCP Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), translate("TCP Fast Open")) o.default = "0" -o = s:option(Flag, option_name("remote_enable"), translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray/Xray WebSocket and more.")) +o = s:option(Flag, _n("remote_enable"), translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray/Xray WebSocket and more.")) o.default = "1" o.rmempty = false -o = s:option(Value, option_name("remote_address"), translate("Remote Address")) +o = s:option(Value, _n("remote_address"), translate("Remote Address")) o.default = "127.0.0.1" -o:depends({ [option_name("remote_enable")] = true }) +o:depends({ [_n("remote_enable")] = true }) -o = s:option(Value, option_name("remote_port"), translate("Remote Port")) +o = s:option(Value, _n("remote_port"), translate("Remote Port")) o.datatype = "port" o.default = "80" -o:depends({ [option_name("remote_enable")] = true }) +o:depends({ [_n("remote_enable")] = true }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "2" o:value("0", "all") o:value("1", "info") o:value("2", "warn") o:value("3", "error") o:value("4", "fatal") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/openwrt-passwall/luci-app-passwall/luasrc/passwall/api.lua b/openwrt-passwall/luci-app-passwall/luasrc/passwall/api.lua index 61c0a0f8b7..81089eb74d 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/passwall/api.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/passwall/api.lua @@ -364,6 +364,26 @@ function get_domain_from_url(url) return url end +function get_node_name(node_id) + local e + if type(node_id) == "table" then + e = node_id + else + e = uci:get_all(appname, node_id) + end + if e then + if e.type and e.remarks then + if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt" or e.protocol == "_iface") then + local type = e.type + if type == "sing-box" then type = "Sing-Box" end + local remark = "%s:[%s] " % {type .. " " .. i18n.translatef(e.protocol), e.remarks} + return remark + end + end + end + return "" +end + function get_valid_nodes() local show_node_info = uci_get_type("global_other", "show_node_info") or "0" local nodes = {} @@ -1046,7 +1066,7 @@ end function get_version() local version = sys.exec("opkg list-installed luci-app-passwall 2>/dev/null | awk '{print $3}'") if not version or #version == 0 then - version = sys.exec("apk info luci-app-passwall 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-") + version = sys.exec("apk info -L luci-app-passwall 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-") end return version or "" end diff --git a/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_sing-box.lua index e651389992..4ce25bc901 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -20,7 +20,7 @@ end function gen_outbound(flag, node, tag, proxy_table) local result = nil - if node and node ~= "nil" then + if node then local node_id = node[".name"] if tag == nil then tag = node_id @@ -46,7 +46,7 @@ function gen_outbound(flag, node, tag, proxy_table) "127.0.0.1", --bind new_port, --socks port config_file, --config file - (proxy_tag and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port + (proxy_tag and relay_port) and tostring(relay_port) or "" --relay port ) ) ) @@ -56,7 +56,7 @@ function gen_outbound(flag, node, tag, proxy_table) port = new_port } else - if proxy_tag and proxy_tag ~= "nil" then + if proxy_tag then node.detour = proxy_tag end end @@ -679,7 +679,7 @@ function gen_config_server(node) } } - if node.outbound_node and node.outbound_node ~= "nil" then + if node.outbound_node then local outbound = nil if node.outbound_node == "_iface" and node.outbound_node_iface then outbound = { @@ -905,7 +905,7 @@ function gen_config(var) end if node.chain_proxy == "1" and node.preproxy_node then - if outbound["_flag_proxy_tag"] and outbound["_flag_proxy_tag"] ~= "nil" then + if outbound["_flag_proxy_tag"] then --Ignore else local preproxy_node = uci:get_all(appname, node.preproxy_node) @@ -951,7 +951,7 @@ function gen_config(var) local function gen_shunt_node(rule_name, _node_id) if not rule_name then return nil, nil end - if not _node_id then _node_id = node[rule_name] or "nil" end + if not _node_id then _node_id = node[rule_name] end local rule_outboundTag if _node_id == "_direct" then rule_outboundTag = "direct" @@ -959,7 +959,7 @@ function gen_config(var) rule_outboundTag = "block" elseif _node_id == "_default" and rule_name ~= "default" then rule_outboundTag = "default" - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil if socks_node then @@ -976,7 +976,7 @@ function gen_config(var) rule_outboundTag = _outbound.tag end end - elseif _node_id ~= "nil" then + elseif _node_id then local _node = uci:get_all(appname, _node_id) if not _node then return nil, nil end @@ -1180,7 +1180,7 @@ function gen_config(var) rule.domain_regex = #domain_table.domain_regex > 0 and domain_table.domain_regex or nil rule.geosite = #domain_table.geosite > 0 and domain_table.geosite or nil - if outboundTag and outboundTag ~= "nil" then + if outboundTag then table.insert(dns_domain_rules, api.clone(domain_table)) end end @@ -1476,7 +1476,7 @@ function gen_config(var) tag = "block" }) for index, value in ipairs(config.outbounds) do - if (not value["_flag_proxy_tag"] or value["_flag_proxy_tag"] == "nil") and not value.detour and value["_id"] and value.server and value.server_port then + if not value["_flag_proxy_tag"] and not value.detour and value["_id"] and value.server and value.server_port then sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list")) end for k, v in pairs(config.outbounds[index]) do diff --git a/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_xray.lua b/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_xray.lua index 0a2a663a74..57d392b4e8 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/openwrt-passwall/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -48,7 +48,7 @@ end function gen_outbound(flag, node, tag, proxy_table) local result = nil - if node and node ~= "nil" then + if node then local node_id = node[".name"] if tag == nil then tag = node_id @@ -82,7 +82,7 @@ function gen_outbound(flag, node, tag, proxy_table) "127.0.0.1", --bind new_port, --socks port config_file, --config file - (proxy_tag and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port + (proxy_tag and relay_port) and tostring(relay_port) or "" --relay port ) )) node = {} @@ -95,7 +95,7 @@ function gen_outbound(flag, node, tag, proxy_table) else if node.flow == "xtls-rprx-vision" then else - if proxy_tag and proxy_tag ~= "nil" then + if proxy_tag then node.proxySettings = { tag = proxy_tag, transportLayer = true @@ -404,7 +404,7 @@ function gen_config_server(node) } } - if node.outbound_node and node.outbound_node ~= "nil" then + if node.outbound_node then local outbound = nil if node.outbound_node == "_iface" and node.outbound_node_iface then outbound = { @@ -735,7 +735,7 @@ function gen_config(var) -- fallback node local fallback_node_tag = nil local fallback_node_id = _node.fallback_node - if fallback_node_id == "" or fallback_node_id == "nil" then fallback_node_id = nil end + if not fallback_node_id or fallback_node_id == "" then fallback_node_id = nil end if fallback_node_id then local is_new_node = true for _, outbound in ipairs(outbounds) do @@ -784,7 +784,7 @@ function gen_config(var) local last_insert_outbound if node.chain_proxy == "1" and node.preproxy_node then - if outbound["_flag_proxy_tag"] and outbound["_flag_proxy_tag"] ~= "nil" then + if outbound["_flag_proxy_tag"] then --Ignore else local preproxy_node = uci:get_all(appname, node.preproxy_node) @@ -846,7 +846,7 @@ function gen_config(var) return "blackhole", nil elseif _node_id == "_default" then return "default", nil - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil local socks_tag @@ -1396,7 +1396,7 @@ function gen_config(var) end for index, value in ipairs(config.outbounds) do - if (not value["_flag_proxy_tag"] or value["_flag_proxy_tag"] == "nil") and value["_id"] and value.server and value.server_port then + if not value["_flag_proxy_tag"] and value["_id"] and value.server and value.server_port then sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list")) end for k, v in pairs(config.outbounds[index]) do diff --git a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm new file mode 100644 index 0000000000..76a1ff2340 --- /dev/null +++ b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm @@ -0,0 +1,3 @@ +
" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>" style="display: none !important"> + " /> +
diff --git a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/global/footer.htm b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/global/footer.htm index 5a7a518f07..82a381f678 100644 --- a/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/global/footer.htm +++ b/openwrt-passwall/luci-app-passwall/luasrc/view/passwall/global/footer.htm @@ -53,13 +53,13 @@ local api = require "luci.passwall.api" var dom_id = dom.id.split(cbi_id).join(cbi_id.split("-").join(".")).split("cbi.").join("cbid.") var node_select = document.getElementsByName(dom_id)[0]; var node_select_value = node_select.value; - if (node_select_value && node_select_value != "nil" && node_select_value.indexOf("_default") != 0 && node_select_value.indexOf("_direct") != 0 && node_select_value.indexOf("_blackhole") != 0) { + if (node_select_value && node_select_value != "" && node_select_value.indexOf("_default") != 0 && node_select_value.indexOf("_direct") != 0 && node_select_value.indexOf("_blackhole") != 0) { if (global_id != null && node_select_value.indexOf("tcp") == 0) { var d = global_id + "-tcp_node"; d = d.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), "."); var dom = document.getElementsByName(d)[0]; var _node_select_value = dom.value; - if (_node_select_value && _node_select_value != "nil") { + if (_node_select_value && _node_select_value != "") { node_select_value = _node_select_value; } } @@ -117,7 +117,7 @@ local api = require "luci.passwall.api" var dom_id = dom_id.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), "."); var node_select = document.getElementsByName(dom_id)[0]; var node_select_value = node_select.value; - if (node_select_value && node_select_value != "nil") { + if (node_select_value && node_select_value != "") { var v = document.getElementById(dom_id + "-" + node_select_value); if (v) { node_select.title = v.text; diff --git a/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po b/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po index c8a0ec1d80..a845a9a0d0 100644 --- a/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po +++ b/openwrt-passwall/luci-app-passwall/po/zh-cn/passwall.po @@ -673,17 +673,32 @@ msgstr "单位:秒" msgid "Units:minutes" msgstr "单位:分钟" -msgid "Open and close automatically" -msgstr "定时自动开关" +msgid "stop automatically mode" +msgstr "定时关闭模式" -msgid "Automatically turn off time" -msgstr "自动关闭时间" +msgid "stop Time(Every day)" +msgstr "关闭时间(每天)" -msgid "Automatically turn on time" -msgstr "自动开启时间" +msgid "stop Interval(Hour)" +msgstr "关闭间隔(小时)" -msgid "Automatically restart time" -msgstr "自动重启时间" +msgid "start automatically mode" +msgstr "定时开启模式" + +msgid "start Time(Every day)" +msgstr "开启时间(每天)" + +msgid "start Interval(Hour)" +msgstr "开启间隔(小时)" + +msgid "restart automatically mode" +msgstr "定时重启模式" + +msgid "restart Time(Every day)" +msgstr "重启时间(每天)" + +msgid "restart Interval(Hour)" +msgstr "重启间隔(小时)" msgid "Forwarding Settings" msgstr "转发配置" @@ -925,6 +940,9 @@ msgstr "每周日" msgid "hour" msgstr "小时" +msgid "Hour" +msgstr "小时" + msgid "Location of V2ray/Xray asset" msgstr "V2ray/Xray 资源文件目录" diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/0_default_config b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/0_default_config index 8348217933..551c824f96 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/0_default_config +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/0_default_config @@ -2,8 +2,6 @@ config global option enabled '0' option socks_enabled '0' - option tcp_node 'nil' - option udp_node 'nil' option tcp_node_socks_port '1070' option filter_proxy_ipv6 '1' option dns_shunt 'chinadns-ng' @@ -32,7 +30,6 @@ config global_haproxy option balancing_enable '0' config global_delay - option auto_on '0' option start_daemon '1' option start_delay '60' @@ -102,7 +99,7 @@ config nodes 'myshunt' option Streaming '_default' option Proxy '_default' option Direct '_direct' - option default_node 'nil' + option default_node '_direct' option domainStrategy 'IPOnDemand' config shunt_rules 'DirectGame' diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh index 40b657cd68..14aa4e445a 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/app.sh @@ -707,7 +707,7 @@ run_socks() { ;; esac - eval node_${node}_socks_port=$socks_port + set_cache_var "node_${node}_socks_port" "${socks_port}" # http to socks [ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && { @@ -755,7 +755,7 @@ run_redir() { } } [ "$bind" != "127.0.0.1" ] && echolog "${PROTO}节点:[$remarks],监听端口:$local_port" - eval ${PROTO}_NODE_PORT=$port + set_cache_var "${PROTO}_NODE_PORT" "${port}" case "$PROTO" in UDP) @@ -856,7 +856,7 @@ run_redir() { } [ "$TCP_UDP" = "1" ] && { UDP_REDIR_PORT=$local_port - UDP_NODE="nil" + unset UDP_NODE _flag="TCP_UDP" _args="${_args} udp_redir_port=${UDP_REDIR_PORT}" config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") @@ -932,7 +932,7 @@ run_redir() { } [ "$TCP_UDP" = "1" ] && { UDP_REDIR_PORT=$local_port - UDP_NODE="nil" + unset UDP_NODE _flag="TCP_UDP" _args="${_args} udp_redir_port=${UDP_REDIR_PORT}" config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") @@ -974,7 +974,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE } local loglevel=$(config_t_get global trojan_loglevel "2") lua $UTIL_TROJAN gen_config -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel $lua_tproxy_arg > $config_file @@ -989,7 +989,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="-u" } lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port $lua_tproxy_arg > $config_file @@ -1001,7 +1001,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE lua_mode_arg="-mode tcp_and_udp" } lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port $lua_mode_arg $lua_tproxy_arg > $config_file @@ -1023,7 +1023,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="${_extra_param} -local_udp_redir_port $local_port" } lua $UTIL_SS gen_config -node $node ${_extra_param} > $config_file @@ -1044,7 +1044,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="${_extra_param} -local_udp_redir_port $local_port" } _extra_param="${_extra_param} -tcp_proxy_way $tcp_proxy_way" @@ -1057,7 +1057,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { _flag="TCP_UDP" UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE } local _socks_tproxy="" [ "$tcp_proxy_way" = "tproxy" ] && _socks_tproxy="1" @@ -1085,13 +1085,13 @@ run_redir() { esac unset tcp_node_socks_flag tcp_node_http_flag [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && echo "${node}" >> $TMP_PATH/direct_node_list - return 0 + [ -n "${redir_port}" ] && set_cache_var "node_${node}_${PROTO}_redir_port" "${local_port}" } start_redir() { local proto=${1} eval node=\$${proto}_NODE - if [ "$node" != "nil" ]; then + if [ -n "$node" ]; then TYPE=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') local config_file="${proto}.json" local log_file="${proto}.log" @@ -1099,7 +1099,12 @@ start_redir() { local port=$(echo $(get_new_port $current_port $proto)) eval ${proto}_REDIR=$port run_redir node=$node proto=${proto} bind=0.0.0.0 local_port=$port config_file=$config_file log_file=$log_file - set_cache_var "GLOBAL_${proto}_node" "$node" + set_cache_var "ACL_GLOBAL_${proto}_node" "${node}" + set_cache_var "ACL_GLOBAL_${proto}_redir_port" "${port}" + [ "$TCP_UDP" = "1" ] && { + set_cache_var "ACL_GLOBAL_UDP_node" "${node}" + set_cache_var "ACL_GLOBAL_UDP_redir_port" "${port}" + } else [ "${proto}" = "UDP" ] && [ "$TCP_UDP" = "1" ] && return echolog "${proto}节点没有选择或为空,不代理${proto}。" @@ -1114,8 +1119,8 @@ start_socks() { for id in $ids; do local enabled=$(config_n_get $id enabled 0) [ "$enabled" == "0" ] && continue - local node=$(config_n_get $id node nil) - [ "$node" == "nil" ] && continue + local node=$(config_n_get $id node) + [ -z "$node" ] && continue local bind_local=$(config_n_get $id bind_local 0) local bind="0.0.0.0" [ "$bind_local" = "1" ] && bind="127.0.0.1" @@ -1206,23 +1211,41 @@ start_crontab() { return } - auto_on=$(config_t_get global_delay auto_on 0) - if [ "$auto_on" = "1" ]; then - time_off=$(config_t_get global_delay time_off) - time_on=$(config_t_get global_delay time_on) - time_restart=$(config_t_get global_delay time_restart) - [ -z "$time_off" -o "$time_off" != "nil" ] && { - echo "0 $time_off * * * /etc/init.d/$CONFIG stop" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_off 点关闭服务。" - } - [ -z "$time_on" -o "$time_on" != "nil" ] && { - echo "0 $time_on * * * /etc/init.d/$CONFIG start" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_on 点开启服务。" - } - [ -z "$time_restart" -o "$time_restart" != "nil" ] && { - echo "0 $time_restart * * * /etc/init.d/$CONFIG restart" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_restart 点重启服务。" - } + stop_week_mode=$(config_t_get global_delay stop_week_mode) + stop_time_mode=$(config_t_get global_delay stop_time_mode) + if [ -n "$stop_week_mode" ]; then + local t="0 $stop_time_mode * * $stop_week_mode" + [ "$stop_week_mode" = "7" ] && t="0 $stop_time_mode * * *" + if [ "$stop_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG stop > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动关闭服务。" + fi + start_week_mode=$(config_t_get global_delay start_week_mode) + start_time_mode=$(config_t_get global_delay start_time_mode) + if [ -n "$start_week_mode" ]; then + local t="0 $start_time_mode * * $start_week_mode" + [ "$start_week_mode" = "7" ] && t="0 $start_time_mode * * *" + if [ "$start_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG start > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动开启服务。" + fi + restart_week_mode=$(config_t_get global_delay restart_week_mode) + restart_time_mode=$(config_t_get global_delay restart_time_mode) + if [ -n "$restart_week_mode" ]; then + local t="0 $restart_time_mode * * $restart_week_mode" + [ "$restart_week_mode" = "7" ] && t="0 $restart_time_mode * * *" + if [ "$restart_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG restart > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动重启服务。" fi autoupdate=$(config_t_get global_rules auto_update) @@ -1695,198 +1718,221 @@ acl_app() { [ ! -z "${source_list}" ] && echo -e "${source_list}" | sed '/^$/d' > ${acl_path}/source_list use_global_config=${use_global_config:-0} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} - use_direct_list=${use_direct_list:-1} - use_proxy_list=${use_proxy_list:-1} - use_block_list=${use_block_list:-1} - use_gfw_list=${use_gfw_list:-1} - chn_list=${chn_list:-direct} - tcp_proxy_mode=${tcp_proxy_mode:-proxy} - udp_proxy_mode=${udp_proxy_mode:-proxy} - filter_proxy_ipv6=${filter_proxy_ipv6:-0} - dnsmasq_filter_proxy_ipv6=${filter_proxy_ipv6} - dns_shunt=${dns_shunt:-dnsmasq} - dns_mode=${dns_mode:-dns2socks} - remote_dns=${remote_dns:-1.1.1.1} - use_default_dns=${use_default_dns:-direct} - [ "$dns_mode" = "sing-box" ] && { - [ "$v2ray_dns_mode" = "doh" ] && remote_dns=${remote_dns_doh:-https://1.1.1.1/dns-query} - } - [ "${use_global_config}" = "1" ] && { tcp_node="default" udp_node="default" } + tcp_no_redir_ports=${tcp_no_redir_ports:-${TCP_NO_REDIR_PORTS}} + udp_no_redir_ports=${udp_no_redir_ports:-${UDP_NO_REDIR_PORTS}} + if [ "$tcp_no_redir_ports" == "1:65535" ] && [ "$udp_no_redir_ports" == "1:65535" ]; then + unset use_global_config + unset tcp_node + unset udp_node + else + use_direct_list=${use_direct_list:-1} + use_proxy_list=${use_proxy_list:-1} + use_block_list=${use_block_list:-1} + use_gfw_list=${use_gfw_list:-1} + chn_list=${chn_list:-direct} + tcp_proxy_mode=${tcp_proxy_mode:-proxy} + udp_proxy_mode=${udp_proxy_mode:-proxy} + filter_proxy_ipv6=${filter_proxy_ipv6:-0} + dnsmasq_filter_proxy_ipv6=${filter_proxy_ipv6} + dns_shunt=${dns_shunt:-dnsmasq} + dns_mode=${dns_mode:-dns2socks} + remote_dns=${remote_dns:-1.1.1.1} + use_default_dns=${use_default_dns:-direct} + [ "$dns_mode" = "sing-box" ] && { + [ "$v2ray_dns_mode" = "doh" ] && remote_dns=${remote_dns_doh:-https://1.1.1.1/dns-query} + } + fi - [ "$tcp_node" != "nil" ] && { + [ -n "$tcp_node" ] && { + local GLOBAL_TCP_NODE=$(get_cache_var "ACL_GLOBAL_TCP_node") + echolog "${GLOBAL_TCP_NODE}" + [ -n "${GLOBAL_TCP_NODE}" ] && GLOBAL_TCP_redir_port=$(get_cache_var "ACL_GLOBAL_TCP_redir_port") if [ "$tcp_node" = "default" ]; then - tcp_node=$TCP_NODE - tcp_port=$TCP_REDIR_PORT + if [ -n "${GLOBAL_TCP_NODE}" ]; then + set_cache_var "ACL_${sid}_tcp_node" "${GLOBAL_TCP_NODE}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${GLOBAL_TCP_redir_port}" + set_cache_var "ACL_${sid}_dns_port" "${GLOBAL_DNSMASQ_PORT}" + set_cache_var "ACL_${sid}_tcp_default" "1" + else + echolog " - 全局节点未启用,跳过【${remarks}】" + fi else - [ "$(config_get_type $tcp_node nil)" = "nodes" ] && { - run_dns() { - local _dns_port - [ -n $1 ] && _dns_port=$1 - [ -z ${_dns_port} ] && { - dns_port=$(get_new_port $(expr $dns_port + 1)) - _dns_port=$dns_port - if [ "$dns_mode" = "dns2socks" ]; then - run_dns2socks flag=acl_${sid} socks_address=127.0.0.1 socks_port=$socks_port listen_address=0.0.0.0 listen_port=${_dns_port} dns=$remote_dns cache=1 - elif [ "$dns_mode" = "sing-box" -o "$dns_mode" = "xray" ]; then - config_file=$TMP_ACL_PATH/${tcp_node}_SOCKS_${socks_port}_DNS.json - [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} - local type=${dns_mode} - [ "${dns_mode}" = "sing-box" ] && type="singbox" - dnsmasq_filter_proxy_ipv6=0 - run_${type} flag=acl_${sid} type=$dns_mode dns_socks_address=127.0.0.1 dns_socks_port=$socks_port dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh="${remote_dns_doh}" remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY} config_file=$config_file - fi - eval node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)=${_dns_port} - } - - [ "$dns_shunt" = "chinadns-ng" ] && [ -n "$(first_type chinadns-ng)" ] && { - chinadns_ng_min=2024.04.13 - chinadns_ng_now=$(chinadns-ng -V | grep -i "ChinaDNS-NG " | awk '{print $2}') - if [ $(check_ver "$chinadns_ng_now" "$chinadns_ng_min") = 1 ]; then - echolog " * 注意:当前 ChinaDNS-NG 版本为[ $chinadns_ng_now ],请更新到[ $chinadns_ng_min ]或以上版本,否则 DNS 有可能无法正常工作!" - fi - - [ "$filter_proxy_ipv6" = "1" ] && dnsmasq_filter_proxy_ipv6=0 - chinadns_port=$(expr $chinadns_port + 1) - _china_ng_listen="127.0.0.1#${chinadns_port}" - - _chinadns_local_dns=$(IFS=','; set -- $LOCAL_DNS; [ "${1%%[#:]*}" = "127.0.0.1" ] && echo "$1" || ([ -n "$2" ] && echo "$1,$2" || echo "$1")) - _direct_dns_mode=$(config_t_get global direct_dns_mode "auto") - case "${_direct_dns_mode}" in - udp) - _chinadns_local_dns=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g') - ;; - tcp) - _chinadns_local_dns="tcp://$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')" - ;; - dot) - if [ "$(chinadns-ng -V | grep -i wolfssl)" != "nil" ]; then - _chinadns_local_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12") - fi - ;; - esac - - run_chinadns_ng \ - _flag="$sid" \ - _listen_port=${chinadns_port} \ - _dns_local=${_chinadns_local_dns} \ - _dns_trust=127.0.0.1#${_dns_port} \ - _no_ipv6_trust=${filter_proxy_ipv6} \ - _use_direct_list=${use_direct_list} \ - _use_proxy_list=${use_proxy_list} \ - _use_block_list=${use_block_list} \ - _gfwlist=${use_gfw_list} \ - _chnlist=${chn_list} \ - _default_mode=${tcp_proxy_mode} \ - _default_tag=${chinadns_ng_default_tag:-smart} \ - _no_logic_log=1 \ - _tcp_node=${tcp_node} - - use_default_dns="chinadns_ng" - } - - dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1)) - local dnsmasq_conf=${acl_path}/dnsmasq.conf - local dnsmasq_conf_path=${acl_path}/dnsmasq.d - lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG ${sid} -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ - -LISTEN_PORT ${dnsmasq_port} -DEFAULT_DNS $DEFAULT_DNS -LOCAL_DNS $LOCAL_DNS \ - -USE_DIRECT_LIST "${use_direct_list}" -USE_PROXY_LIST "${use_proxy_list}" -USE_BLOCK_LIST "${use_block_list}" -USE_GFW_LIST "${use_gfw_list}" -CHN_LIST "${chn_list}" \ - -TUN_DNS "127.0.0.1#${_dns_port}" -REMOTE_FAKEDNS 0 -USE_DEFAULT_DNS "${use_default_dns:-direct}" -CHINADNS_DNS ${_china_ng_listen:-0} \ - -TCP_NODE $tcp_node -DEFAULT_PROXY_MODE ${tcp_proxy_mode} -NO_PROXY_IPV6 ${dnsmasq_filter_proxy_ipv6:-0} -NFTFLAG ${nftflag:-0} \ - -NO_LOGIC_LOG 1 - ln_run "$(first_type dnsmasq)" "dnsmasq_${sid}" "/dev/null" -C ${dnsmasq_conf} -x ${acl_path}/dnsmasq.pid - set_cache_var "ACL_${sid}_dns_port" "${dnsmasq_port}" - eval node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)=${dnsmasq_port} - } - _redir_port=$(eval echo \${node_${tcp_node}_redir_port}) - _socks_port=$(eval echo \${node_${tcp_node}_socks_port}) - if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then - socks_port=${_socks_port} - tcp_port=${_redir_port} - _dnsmasq_port=$(eval echo \${node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)}) - if [ -z "${_dnsmasq_port}" ]; then - _dns_port=$(eval echo \${node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)}) - run_dns ${_dns_port} - else - [ -n "${_dnsmasq_port}" ] && set_cache_var "ACL_${sid}_dns_port" "${_dnsmasq_port}" - fi + [ "$(config_get_type $tcp_node)" = "nodes" ] && { + if [ -n "${GLOBAL_TCP_NODE}" ] && [ "$tcp_node" = "${GLOBAL_TCP_NODE}" ]; then + set_cache_var "ACL_${sid}_tcp_node" "${GLOBAL_TCP_NODE}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${GLOBAL_TCP_redir_port}" + set_cache_var "ACL_${sid}_dns_port" "${GLOBAL_DNSMASQ_PORT}" + set_cache_var "ACL_${sid}_tcp_default" "1" else - socks_port=$(get_new_port $(expr $socks_port + 1)) - eval node_${tcp_node}_socks_port=$socks_port - redir_port=$(get_new_port $(expr $redir_port + 1)) - eval node_${tcp_node}_redir_port=$redir_port - tcp_port=$redir_port - - local type=$(echo $(config_n_get $tcp_node type) | tr 'A-Z' 'a-z') - if [ -n "${type}" ] && ([ "${type}" = "sing-box" ] || [ "${type}" = "xray" ]); then - config_file="acl/${tcp_node}_TCP_${redir_port}.json" - _extra_param="socks_address=127.0.0.1 socks_port=$socks_port" - if [ "$dns_mode" = "sing-box" ] || [ "$dns_mode" = "xray" ]; then + run_dns() { + local _dns_port + [ -n $1 ] && _dns_port=$1 + [ -z ${_dns_port} ] && { dns_port=$(get_new_port $(expr $dns_port + 1)) _dns_port=$dns_port - config_file=$(echo $config_file | sed "s/TCP_/DNS_${_dns_port}_TCP_/g") - remote_dns_doh=${remote_dns} - dnsmasq_filter_proxy_ipv6=0 - [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} - _extra_param="dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh=${remote_dns_doh} remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY}" - fi - [ "$udp_node" != "nil" ] && ([ "$udp_node" = "tcp" ] || [ "$udp_node" = "$tcp_node" ]) && { - config_file=$(echo $config_file | sed "s/TCP_/TCP_UDP_/g") - _extra_param="${_extra_param} udp_redir_port=$redir_port" + if [ "$dns_mode" = "dns2socks" ]; then + run_dns2socks flag=acl_${sid} socks_address=127.0.0.1 socks_port=$socks_port listen_address=0.0.0.0 listen_port=${_dns_port} dns=$remote_dns cache=1 + elif [ "$dns_mode" = "sing-box" -o "$dns_mode" = "xray" ]; then + config_file=$TMP_ACL_PATH/${tcp_node}_SOCKS_${socks_port}_DNS.json + [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} + local type=${dns_mode} + [ "${dns_mode}" = "sing-box" ] && type="singbox" + dnsmasq_filter_proxy_ipv6=0 + run_${type} flag=acl_${sid} type=$dns_mode dns_socks_address=127.0.0.1 dns_socks_port=$socks_port dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh="${remote_dns_doh}" remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY} config_file=$config_file + fi + set_cache_var "node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)" "${_dns_port}" } - config_file="$TMP_PATH/$config_file" - [ "${type}" = "sing-box" ] && type="singbox" - run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file + + [ "$dns_shunt" = "chinadns-ng" ] && [ -n "$(first_type chinadns-ng)" ] && { + chinadns_ng_min=2024.04.13 + chinadns_ng_now=$(chinadns-ng -V | grep -i "ChinaDNS-NG " | awk '{print $2}') + if [ $(check_ver "$chinadns_ng_now" "$chinadns_ng_min") = 1 ]; then + echolog " * 注意:当前 ChinaDNS-NG 版本为[ $chinadns_ng_now ],请更新到[ $chinadns_ng_min ]或以上版本,否则 DNS 有可能无法正常工作!" + fi + + [ "$filter_proxy_ipv6" = "1" ] && dnsmasq_filter_proxy_ipv6=0 + chinadns_port=$(expr $chinadns_port + 1) + _china_ng_listen="127.0.0.1#${chinadns_port}" + + _chinadns_local_dns=$(IFS=','; set -- $LOCAL_DNS; [ "${1%%[#:]*}" = "127.0.0.1" ] && echo "$1" || ([ -n "$2" ] && echo "$1,$2" || echo "$1")) + _direct_dns_mode=$(config_t_get global direct_dns_mode "auto") + case "${_direct_dns_mode}" in + udp) + _chinadns_local_dns=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g') + ;; + tcp) + _chinadns_local_dns="tcp://$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')" + ;; + dot) + if [ "$(chinadns-ng -V | grep -i wolfssl)" != "nil" ]; then + _chinadns_local_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12") + fi + ;; + esac + + run_chinadns_ng \ + _flag="$sid" \ + _listen_port=${chinadns_port} \ + _dns_local=${_chinadns_local_dns} \ + _dns_trust=127.0.0.1#${_dns_port} \ + _no_ipv6_trust=${filter_proxy_ipv6} \ + _use_direct_list=${use_direct_list} \ + _use_proxy_list=${use_proxy_list} \ + _use_block_list=${use_block_list} \ + _gfwlist=${use_gfw_list} \ + _chnlist=${chn_list} \ + _default_mode=${tcp_proxy_mode} \ + _default_tag=${chinadns_ng_default_tag:-smart} \ + _no_logic_log=1 \ + _tcp_node=${tcp_node} + + use_default_dns="chinadns_ng" + } + + dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1)) + local dnsmasq_conf=${acl_path}/dnsmasq.conf + local dnsmasq_conf_path=${acl_path}/dnsmasq.d + lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG ${sid} -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ + -LISTEN_PORT ${dnsmasq_port} -DEFAULT_DNS $DEFAULT_DNS -LOCAL_DNS $LOCAL_DNS \ + -USE_DIRECT_LIST "${use_direct_list}" -USE_PROXY_LIST "${use_proxy_list}" -USE_BLOCK_LIST "${use_block_list}" -USE_GFW_LIST "${use_gfw_list}" -CHN_LIST "${chn_list}" \ + -TUN_DNS "127.0.0.1#${_dns_port}" -REMOTE_FAKEDNS 0 -USE_DEFAULT_DNS "${use_default_dns:-direct}" -CHINADNS_DNS ${_china_ng_listen:-0} \ + -TCP_NODE $tcp_node -DEFAULT_PROXY_MODE ${tcp_proxy_mode} -NO_PROXY_IPV6 ${dnsmasq_filter_proxy_ipv6:-0} -NFTFLAG ${nftflag:-0} \ + -NO_LOGIC_LOG 1 + ln_run "$(first_type dnsmasq)" "dnsmasq_${sid}" "/dev/null" -C ${dnsmasq_conf} -x ${acl_path}/dnsmasq.pid + set_cache_var "ACL_${sid}_dns_port" "${dnsmasq_port}" + set_cache_var "node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)" "${dnsmasq_port}" + } + _redir_port=$(get_cache_var "node_${tcp_node}_redir_port") + _socks_port=$(get_cache_var "node_${tcp_node}_socks_port") + if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then + socks_port=${_socks_port} + tcp_port=${_redir_port} + _dnsmasq_port=$(get_cache_var "node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)") + if [ -z "${_dnsmasq_port}" ]; then + _dns_port=$(get_cache_var "node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)") + run_dns ${_dns_port} + else + [ -n "${_dnsmasq_port}" ] && set_cache_var "ACL_${sid}_dns_port" "${_dnsmasq_port}" + fi else - config_file="acl/${tcp_node}_SOCKS_${socks_port}.json" - run_socks flag=$tcp_node node=$tcp_node bind=127.0.0.1 socks_port=$socks_port config_file=$config_file - local log_file=$TMP_ACL_PATH/ipt2socks_${tcp_node}_${redir_port}.log - log_file="/dev/null" - run_ipt2socks flag=acl_${tcp_node} tcp_tproxy=${is_tproxy} local_port=$redir_port socks_address=127.0.0.1 socks_port=$socks_port log_file=$log_file + socks_port=$(get_new_port $(expr $socks_port + 1)) + set_cache_var "node_${tcp_node}_socks_port" "${socks_port}" + redir_port=$(get_new_port $(expr $redir_port + 1)) + set_cache_var "node_${tcp_node}_redir_port" "${redir_port}" + tcp_port=$redir_port + + local type=$(echo $(config_n_get $tcp_node type) | tr 'A-Z' 'a-z') + if [ -n "${type}" ] && ([ "${type}" = "sing-box" ] || [ "${type}" = "xray" ]); then + config_file="acl/${tcp_node}_TCP_${redir_port}.json" + _extra_param="socks_address=127.0.0.1 socks_port=$socks_port" + if [ "$dns_mode" = "sing-box" ] || [ "$dns_mode" = "xray" ]; then + dns_port=$(get_new_port $(expr $dns_port + 1)) + _dns_port=$dns_port + config_file=$(echo $config_file | sed "s/TCP_/DNS_${_dns_port}_TCP_/g") + remote_dns_doh=${remote_dns} + dnsmasq_filter_proxy_ipv6=0 + [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} + _extra_param="dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh=${remote_dns_doh} remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY}" + fi + [ -n "$udp_node" ] && ([ "$udp_node" = "tcp" ] || [ "$udp_node" = "$tcp_node" ]) && { + config_file=$(echo $config_file | sed "s/TCP_/TCP_UDP_/g") + _extra_param="${_extra_param} udp_redir_port=$redir_port" + } + config_file="$TMP_PATH/$config_file" + [ "${type}" = "sing-box" ] && type="singbox" + run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file + else + config_file="acl/${tcp_node}_SOCKS_${socks_port}.json" + run_socks flag=$tcp_node node=$tcp_node bind=127.0.0.1 socks_port=$socks_port config_file=$config_file + local log_file=$TMP_ACL_PATH/ipt2socks_${tcp_node}_${redir_port}.log + log_file="/dev/null" + run_ipt2socks flag=acl_${tcp_node} tcp_tproxy=${is_tproxy} local_port=$redir_port socks_address=127.0.0.1 socks_port=$socks_port log_file=$log_file + fi + run_dns ${_dns_port} fi - run_dns ${_dns_port} + set_cache_var "ACL_${sid}_tcp_node" "${tcp_node}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${redir_port}" fi - set_cache_var "ACL_${sid}_tcp_node" "${tcp_node}" } fi - set_cache_var "ACL_${sid}_tcp_port" "${tcp_port}" } - [ "$udp_node" != "nil" ] && { - [ "$udp_node" = "tcp" ] && udp_node=$tcp_node + [ -n "$udp_node" ] && { if [ "$udp_node" = "default" ]; then - if [ "$TCP_UDP" = "0" ] && [ "$UDP_NODE" = "nil" ]; then - udp_node="nil" - unset udp_port - elif [ "$TCP_UDP" = "1" ] && [ "$udp_node" = "nil" ]; then - udp_node=$TCP_NODE - udp_port=$TCP_REDIR_PORT + local GLOBAL_UDP_NODE=$(get_cache_var "ACL_GLOBAL_UDP_node") + [ -n "${GLOBAL_UDP_NODE}" ] && GLOBAL_UDP_redir_port=$(get_cache_var "ACL_GLOBAL_UDP_redir_port") + if [ -n "${GLOBAL_UDP_NODE}" ]; then + set_cache_var "ACL_${sid}_udp_node" "${GLOBAL_UDP_NODE}" + set_cache_var "ACL_${sid}_udp_redir_port" "${GLOBAL_UDP_redir_port}" + set_cache_var "ACL_${sid}_udp_default" "1" else - udp_node=$UDP_NODE - udp_port=$UDP_REDIR_PORT + echolog " - 全局节点未启用,跳过【${remarks}】" fi - elif [ "$udp_node" = "$tcp_node" ]; then - udp_node=$tcp_node - udp_port=$tcp_port + elif [ "$udp_node" = "tcp" ]; then + udp_node=$(get_cache_var "ACL_${sid}_tcp_node") + udp_port=$(get_cache_var "ACL_${sid}_tcp_port") + set_cache_var "ACL_${sid}_udp_node" "${udp_node}" + set_cache_var "ACL_${sid}_udp_redir_port" "${udp_port}" else - [ "$(config_get_type $udp_node nil)" = "nodes" ] && { - if [ "$udp_node" = "$UDP_NODE" ]; then - udp_port=$UDP_REDIR_PORT + [ "$(config_get_type $udp_node)" = "nodes" ] && { + if [ -n "${GLOBAL_UDP_NODE}" ] && [ "$udp_node" = "${GLOBAL_UDP_NODE}" ]; then + set_cache_var "ACL_${sid}_udp_node" "${GLOBAL_UDP_NODE}" + set_cache_var "ACL_${sid}_udp_redir_port" "${GLOBAL_UDP_redir_port}" + set_cache_var "ACL_${sid}_udp_default" "1" else - _redir_port=$(eval echo \${node_${udp_node}_redir_port}) - _socks_port=$(eval echo \${node_${udp_node}_socks_port}) + _redir_port=$(get_cache_var "node_${udp_node}_redir_port") + _socks_port=$(get_cache_var "node_${udp_node}_socks_port") if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then socks_port=${_socks_port} udp_port=${_redir_port} else socks_port=$(get_new_port $(expr $socks_port + 1)) - eval node_${udp_node}_socks_port=$socks_port + set_cache_var "node_${udp_node}_socks_port" "${socks_port}" redir_port=$(get_new_port $(expr $redir_port + 1)) - eval node_${udp_node}_redir_port=$redir_port + set_cache_var "node_${udp_node}_redir_port" "${redir_port}" udp_port=$redir_port local type=$(echo $(config_n_get $udp_node type) | tr 'A-Z' 'a-z') @@ -1904,12 +1950,12 @@ acl_app() { fi fi set_cache_var "ACL_${sid}_udp_node" "${udp_node}" + set_cache_var "ACL_${sid}_udp_redir_port" "${redir_port}" fi } fi - set_cache_var "ACL_${sid}_udp_port" "${udp_port}" } - unset enabled sid remarks sources interface use_global_config tcp_node udp_node use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode filter_proxy_ipv6 dns_mode remote_dns v2ray_dns_mode remote_dns_doh dns_client_ip + unset enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports use_global_config tcp_node udp_node use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode filter_proxy_ipv6 dns_mode remote_dns v2ray_dns_mode remote_dns_doh dns_client_ip unset _ip _mac _iprange _ipset _ip_or_mac source_list tcp_port udp_port config_file _extra_param unset _china_ng_listen _chinadns_local_dns _direct_dns_mode chinadns_ng_default_tag dnsmasq_filter_proxy_ipv6 done @@ -2013,9 +2059,9 @@ stop() { ENABLED=$(config_t_get global enabled 0) SOCKS_ENABLED=$(config_t_get global socks_enabled 0) TCP_REDIR_PORT=1041 -TCP_NODE=$(config_t_get global tcp_node nil) +TCP_NODE=$(config_t_get global tcp_node) UDP_REDIR_PORT=1051 -UDP_NODE=$(config_t_get global udp_node nil) +UDP_NODE=$(config_t_get global udp_node) TCP_UDP=0 if [ "$UDP_NODE" == "tcp" ]; then UDP_NODE=$TCP_NODE @@ -2024,8 +2070,8 @@ elif [ "$UDP_NODE" == "$TCP_NODE" ]; then TCP_UDP=1 fi [ "$ENABLED" == 1 ] && { - [ "$TCP_NODE" != "nil" ] && [ "$(config_get_type $TCP_NODE nil)" != "nil" ] && ENABLED_DEFAULT_ACL=1 - [ "$UDP_NODE" != "nil" ] && [ "$(config_get_type $UDP_NODE nil)" != "nil" ] && ENABLED_DEFAULT_ACL=1 + [ -n "$TCP_NODE" ] && [ "$(config_get_type $TCP_NODE)" == "nodes" ] && ENABLED_DEFAULT_ACL=1 + [ -n "$UDP_NODE" ] && [ "$(config_get_type $UDP_NODE)" == "nodes" ] && ENABLED_DEFAULT_ACL=1 } ENABLED_ACLS=$(config_t_get global acl_enable 0) [ "$ENABLED_ACLS" == 1 ] && { diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua index 60e847dd81..704ffe83ad 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua @@ -307,8 +307,8 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua index 55153806fb..18d01d14b3 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua @@ -119,7 +119,6 @@ end function copy_instance(var) local LISTEN_PORT = var["-LISTEN_PORT"] - local DNSMASQ_CONF = var["-DNSMASQ_CONF"] local conf_lines = {} local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do @@ -127,14 +126,19 @@ function copy_instance(var) if line:find("passwall") then filter = true end if line:find("ubus") then filter = true end if line:find("dhcp") then filter = true end - if line:find("server") then filter = true end - if line:find("port") then filter = true end + if line:find("server=") == 1 then filter = true end + if line:find("port=") == 1 then filter = true end + if line:find("address=") == 1 or (line:find("server=") == 1 and line:find("/")) then filter = nil end if not filter then tinsert(conf_lines, line) end end tinsert(conf_lines, "port=" .. LISTEN_PORT) + if var["-return_table"] == "1" then + return conf_lines + end if #conf_lines > 0 then + local DNSMASQ_CONF = var["-DNSMASQ_CONF"] local conf_out = io.open(DNSMASQ_CONF, "a") conf_out:write(table.concat(conf_lines, "\n")) conf_out:close() @@ -498,8 +502,8 @@ function add_rule(var) local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end @@ -615,19 +619,7 @@ function add_rule(var) local conf_lines = {} if LISTEN_PORT then --Copy dnsmasq instance - local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") - for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do - local filter - if line:find("passwall") then filter = true end - if line:find("ubus") then filter = true end - if line:find("dhcp") then filter = true end - if line:find("server") then filter = true end - if line:find("port") then filter = true end - if not filter then - tinsert(conf_lines, line) - end - end - tinsert(conf_lines, "port=" .. LISTEN_PORT) + conf_lines = copy_instance({["-LISTEN_PORT"] = LISTEN_PORT, ["-return_table"] = "1"}) else --Modify the default dnsmasq service end diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua index 06b54e77e9..17f891803a 100644 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua @@ -450,8 +450,8 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/iptables.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/iptables.sh index 826297bf82..c5d23bac72 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -198,8 +198,6 @@ load_acl() { udp_proxy_drop_ports=${udp_proxy_drop_ports:-default} tcp_redir_ports=${tcp_redir_ports:-default} udp_redir_ports=${udp_redir_ports:-default} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} use_direct_list=${use_direct_list:-1} use_proxy_list=${use_proxy_list:-1} use_block_list=${use_block_list:-1} @@ -215,25 +213,17 @@ load_acl() { [ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS [ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node") + [ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node") - [ -n "$(get_cache_var "ACL_${sid}_tcp_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_port") - [ -n "$(get_cache_var "ACL_${sid}_udp_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_port") + [ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port") + [ -n "$tcp_node" ] && tcp_node_remark=$(config_n_get $tcp_node remarks) + [ -n "$udp_node" ] && udp_node_remark=$(config_n_get $udp_node remarks) use_shunt_tcp=0 use_shunt_udp=0 - [ "$tcp_node" != "nil" ] && { - tcp_node_remark=$(config_n_get $tcp_node remarks) - [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 - } - [ "$udp_node" != "nil" ] && { - udp_node_remark=$(config_n_get $udp_node remarks) - [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 - } - [ "$udp_node" == "tcp" ] && { - udp_node_remark=$tcp_node_remark - use_shunt_udp=$use_shunt_tcp - } + [ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 + [ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 [ "${use_global_config}" = "1" ] && { tcp_node_remark=$(config_n_get $TCP_NODE remarks) @@ -503,7 +493,7 @@ load_acl() { local DNS_REDIRECT [ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53 - if ([ "$TCP_NODE" != "nil" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then [ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT} else [ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT} @@ -566,7 +556,7 @@ load_acl() { # 加载TCP默认代理模式 if [ -n "${TCP_PROXY_MODE}" ]; then - [ "$TCP_NODE" != "nil" ] && { + [ -n "$TCP_NODE" ] && { msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]" if [ -n "${is_tproxy}" ]; then msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})" @@ -619,7 +609,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})" $ipt_m -A PSW $(comment "默认") -p udp -d $FAKE_IP -j PSW_RULE @@ -686,7 +676,7 @@ filter_server_port() { filter_node() { local node=${1} local stream=${2} - if [ -n "$node" ] && [ "$node" != "nil" ]; then + if [ -n "$node" ]; then local address=$(config_n_get $node address) local port=$(config_n_get $node port) [ -z "$address" ] && [ -z "$port" ] && { @@ -736,12 +726,12 @@ add_firewall_rule() { local USE_PROXY_LIST_ALL=${USE_PROXY_LIST} local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST} local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST} - local _TCP_NODE=$(config_t_get global tcp_node nil) - local _UDP_NODE=$(config_t_get global udp_node nil) + local _TCP_NODE=$(config_t_get global tcp_node) + local _UDP_NODE=$(config_t_get global udp_node) local USE_GEOVIEW=$(config_t_get global_rules enable_geoview) - [ "$_TCP_NODE" != "nil" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 - [ "$_UDP_NODE" != "nil" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 + [ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 + [ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 [ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do @@ -1012,7 +1002,7 @@ add_firewall_rule() { ip -6 rule add fwmark 1 table 100 ip -6 route add local ::/0 dev lo table 100 - [ "$TCP_UDP" = "1" ] && [ "$UDP_NODE" = "nil" ] && UDP_NODE=$TCP_NODE + [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE [ "$ENABLED_DEFAULT_ACL" == 1 ] && { local ipt_tmp=$ipt_n @@ -1046,7 +1036,7 @@ add_firewall_rule() { fi } - if ([ "$TCP_NODE" != "nil" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then [ -n "$DNS_REDIRECT_PORT" ] && { $ipt_n -A OUTPUT $(comment "PSW") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT $ip6t_n -A OUTPUT $(comment "PSW") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT 2>/dev/null @@ -1078,7 +1068,7 @@ add_firewall_rule() { } # 加载路由器自身代理 TCP - if [ "$TCP_NODE" != "nil" ]; then + if [ -n "$TCP_NODE" ]; then _proxy_tcp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then @@ -1156,7 +1146,7 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/nftables.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/nftables.sh index 27ff6638e2..4cf6f6ea74 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/nftables.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/nftables.sh @@ -258,8 +258,6 @@ load_acl() { udp_proxy_drop_ports=${udp_proxy_drop_ports:-default} tcp_redir_ports=${tcp_redir_ports:-default} udp_redir_ports=${udp_redir_ports:-default} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} use_direct_list=${use_direct_list:-1} use_proxy_list=${use_proxy_list:-1} use_block_list=${use_block_list:-1} @@ -275,25 +273,17 @@ load_acl() { [ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS [ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node") + [ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node") - [ -n "$(get_cache_var "ACL_${sid}_tcp_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_port") - [ -n "$(get_cache_var "ACL_${sid}_udp_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_port") + [ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port") + [ -n "$tcp_node" ] && tcp_node_remark=$(config_n_get $tcp_node remarks) + [ -n "$udp_node" ] && udp_node_remark=$(config_n_get $udp_node remarks) use_shunt_tcp=0 use_shunt_udp=0 - [ "$tcp_node" != "nil" ] && { - tcp_node_remark=$(config_n_get $tcp_node remarks) - [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 - } - [ "$udp_node" != "nil" ] && { - udp_node_remark=$(config_n_get $udp_node remarks) - [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 - } - [ "$udp_node" == "tcp" ] && { - udp_node_remark=$tcp_node_remark - use_shunt_udp=$use_shunt_tcp - } + [ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 + [ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 [ "${use_global_config}" = "1" ] && { tcp_node_remark=$(config_n_get $TCP_NODE remarks) @@ -556,7 +546,7 @@ load_acl() { local DNS_REDIRECT [ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53 - if ([ "$TCP_NODE" != "nil" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then [ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT} else [ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT} @@ -621,7 +611,7 @@ load_acl() { # 加载TCP默认代理模式 if [ -n "${TCP_PROXY_MODE}" ]; then - [ "$TCP_NODE" != "nil" ] && { + [ -n "$TCP_NODE" ] && { msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]" if [ -n "${is_tproxy}" ]; then msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})" @@ -679,7 +669,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})" nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ip daddr $FAKE_IP counter jump PSW_RULE comment \"默认\"" @@ -753,7 +743,7 @@ filter_server_port() { filter_node() { local node=${1} local stream=${2} - if [ -n "$node" ] && [ "$node" != "nil" ]; then + if [ -n "$node" ]; then local address=$(config_n_get $node address) local port=$(config_n_get $node port) [ -z "$address" ] && [ -z "$port" ] && { @@ -811,12 +801,12 @@ add_firewall_rule() { local USE_PROXY_LIST_ALL=${USE_PROXY_LIST} local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST} local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST} - local _TCP_NODE=$(config_t_get global tcp_node nil) - local _UDP_NODE=$(config_t_get global udp_node nil) + local _TCP_NODE=$(config_t_get global tcp_node) + local _UDP_NODE=$(config_t_get global udp_node) local USE_GEOVIEW=$(config_t_get global_rules enable_geoview) - [ "$_TCP_NODE" != "nil" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 - [ "$_UDP_NODE" != "nil" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 + [ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 + [ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 [ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do @@ -1077,7 +1067,7 @@ add_firewall_rule() { ip -6 route add local ::/0 dev lo table 100 } - [ "$TCP_UDP" = "1" ] && [ "$UDP_NODE" = "nil" ] && UDP_NODE=$TCP_NODE + [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE [ "$ENABLED_DEFAULT_ACL" == 1 ] && { msg="【路由器本机】," @@ -1104,7 +1094,7 @@ add_firewall_rule() { fi } - if ([ "$TCP_NODE" != "nil" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then [ -n "$DNS_REDIRECT_PORT" ] && { nft "add rule $NFTABLE_NAME nat_output ip protocol udp oif lo udp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW\"" nft "add rule $NFTABLE_NAME nat_output ip protocol tcp oif lo tcp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW\"" @@ -1136,7 +1126,7 @@ add_firewall_rule() { } # 加载路由器自身代理 TCP - if [ "$TCP_NODE" != "nil" ]; then + if [ -n "$TCP_NODE" ]; then _proxy_tcp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then @@ -1219,7 +1209,7 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh index a7d403fa7a..60ff4b4133 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh @@ -61,8 +61,8 @@ test_proxy() { test_node() { local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { local _tmp_port=$(/usr/share/${CONFIG}/app.sh get_new_port 61080 tcp,udp) /usr/share/${CONFIG}/app.sh run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json local curlx="socks5h://127.0.0.1:${_tmp_port}" @@ -101,7 +101,7 @@ test_auto_switch() { fi #检测主节点是否能使用 - if [ "$restore_switch" == "1" ] && [ "$main_node" != "nil" ] && [ "$now_node" != "$main_node" ]; then + if [ "$restore_switch" == "1" ] && [ -n "$main_node" ] && [ "$now_node" != "$main_node" ]; then test_node ${main_node} [ $? -eq 0 ] && { #主节点正常,切换到主节点 @@ -159,7 +159,7 @@ start() { LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}_socks_auto_switch_${id}.lock LOG_EVENT_FILTER=$(uci -q get "${CONFIG}.global[0].log_event_filter" 2>/dev/null) LOG_EVENT_CMD=$(uci -q get "${CONFIG}.global[0].log_event_cmd" 2>/dev/null) - main_node=$(config_n_get $id node nil) + main_node=$(config_n_get $id node) socks_port=$(config_n_get $id port 0) delay=$(config_n_get $id autoswitch_testing_time 30) sleep 5s @@ -167,8 +167,8 @@ start() { retry_num=$(config_n_get $id autoswitch_retry_num 1) restore_switch=$(config_n_get $id autoswitch_restore_switch 0) probe_url=$(config_n_get $id autoswitch_probe_url "https://www.google.com/generate_204") - backup_node=$(config_n_get $id autoswitch_backup_node nil) - while [ -n "$backup_node" -a "$backup_node" != "nil" ]; do + backup_node=$(config_n_get $id autoswitch_backup_node) + while [ -n "$backup_node" ]; do [ -f "$LOCK_FILE" ] && { sleep 6s continue diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 227e7ad703..d2ba44f244 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -264,7 +264,7 @@ do currentNode = _node_id and uci:get_all(appname, _node_id) or nil, remarks = "分流" .. e.remarks .. "节点", set = function(o, server) - if not server then server = "nil" end + if not server then server = "" end uci:set(appname, node_id, e[".name"], server) o.newNodeId = server end @@ -1263,10 +1263,10 @@ local function truncate_nodes(add_from) if config.currentNode and config.currentNode.add_mode == "2" then if add_from then if config.currentNode.add_from and config.currentNode.add_from == add_from then - config.set(config, "nil") + config.set(config, "") end else - config.set(config, "nil") + config.set(config, "") end if config.id then uci:delete(appname, config.id) @@ -1400,7 +1400,7 @@ local function select_node(nodes, config) config.set(config, server) end else - config.set(config, "nil") + config.set(config, "") end end diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/tasks.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/tasks.sh index 2597a4170f..49760e9ff7 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/tasks.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/tasks.sh @@ -30,6 +30,33 @@ do if [ "$CFG_UPDATE_INT" -ne 0 ]; then + stop_week_mode=$(config_t_get global_delay stop_week_mode) + stop_interval_mode=$(config_t_get global_delay stop_interval_mode) + stop_interval_mode=$(expr "$stop_interval_mode" \* 60) + if [ -n "$stop_week_mode" ]; then + [ "$stop_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$stop_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG stop > /dev/null 2>&1 & + } + fi + + start_week_mode=$(config_t_get global_delay start_week_mode) + start_interval_mode=$(config_t_get global_delay start_interval_mode) + start_interval_mode=$(expr "$start_interval_mode" \* 60) + if [ -n "$start_week_mode" ]; then + [ "$start_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$start_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG start > /dev/null 2>&1 & + } + fi + + restart_week_mode=$(config_t_get global_delay restart_week_mode) + restart_interval_mode=$(config_t_get global_delay restart_interval_mode) + restart_interval_mode=$(expr "$restart_interval_mode" \* 60) + if [ -n "$restart_week_mode" ]; then + [ "$restart_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$restart_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG restart > /dev/null 2>&1 & + } + fi + autoupdate=$(config_t_get global_rules auto_update) weekupdate=$(config_t_get global_rules week_update) hourupdate=$(config_t_get global_rules interval_update) diff --git a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/test.sh b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/test.sh index 7752a26502..1f596e9292 100755 --- a/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/test.sh +++ b/openwrt-passwall/luci-app-passwall/root/usr/share/passwall/test.sh @@ -56,8 +56,8 @@ test_proxy() { url_test_node() { result=0 local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { if [ "${_type}" == "socks" ]; then local _address=$(config_n_get ${node_id} address) local _port=$(config_n_get ${node_id} port) @@ -85,8 +85,8 @@ url_test_node() { test_node() { local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { if [ "${_type}" == "socks" ]; then local _address=$(config_n_get ${node_id} address) local _port=$(config_n_get ${node_id} port) diff --git a/openwrt-passwall2/luci-app-passwall2/Makefile b/openwrt-passwall2/luci-app-passwall2/Makefile index 29fe817222..2ec6533cf3 100644 --- a/openwrt-passwall2/luci-app-passwall2/Makefile +++ b/openwrt-passwall2/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=24.12.16 +PKG_VERSION:=24.12.19 PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index 3b266a42cd..bf77992e9c 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -94,6 +94,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then m:set(shunt_node_id, option, value) end end + local function get_remove(shunt_node_id, option) + return function(self, section) + m:del(shunt_node_id, option) + end + end if #normal_list > 0 then for k, v in pairs(shunt_list) do local vid = v.id @@ -148,8 +153,8 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, node_option, string.format('* %s', api.url("shunt_rules", id), e.remarks)) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) - o.default = "" o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) @@ -158,7 +163,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag") pt.write = get_write(v.id, id .. "_proxy_tag") - pt.default = "" + pt.remove = get_remove(v.id, id .. "_proxy_tag") pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) for k1, v1 in pairs(socks_list) do @@ -181,6 +186,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default"))) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) o.default = "_direct" o:value("_direct", translate("Direct Connection")) @@ -202,6 +208,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:value("", translate("Close")) o:value("main", translate("Preproxy Node")) for k1, v1 in pairs(normal_list) do diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/api.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/api.lua index 7a1b85a403..a5939ed7f4 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/api.lua @@ -207,6 +207,28 @@ function repeat_exist(table, value) return false end +function remove(...) + for index, value in ipairs({...}) do + if value and #value > 0 and value ~= "/" then + sys.call(string.format("rm -rf %s", value)) + end + end +end + +function is_install(package) + if package and #package > 0 then + local file_path = "/usr/lib/opkg/info" + local file_ext = ".control" + local has = sys.call("[ -d " .. file_path .. " ]") + if has == 0 then + file_path = "/lib/apk/packages" + file_ext = ".list" + end + return sys.call(string.format('[ -s "%s/%s%s" ]', file_path, package, file_ext)) == 0 + end + return false +end + function get_args(arg) local var = {} for i, arg_k in pairs(arg) do diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 95c1851c98..2fbdd68807 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -950,7 +950,7 @@ function gen_config(var) rule_outboundTag = "block" elseif _node_id == "_default" and rule_name ~= "default" then rule_outboundTag = "default" - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil if socks_node then diff --git a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 5f94df0420..981998fa95 100644 --- a/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/openwrt-passwall2/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -848,7 +848,7 @@ function gen_config(var) return "blackhole", nil elseif _node_id == "_default" then return "default", nil - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil local socks_tag diff --git a/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/app.sh b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/app.sh index 3ebe1e57e1..3ea4c2fde8 100755 --- a/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -991,73 +991,33 @@ start_haproxy() { [ "$(config_t_get global_haproxy balancing_enable 0)" != "1" ] && return haproxy_path=$TMP_PATH/haproxy haproxy_conf="config.cfg" - lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS} + lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS:-${AUTO_DNS}} ln_run "$(first_type haproxy)" haproxy "/dev/null" -f "${haproxy_path}/${haproxy_conf}" } -run_ipset_dns_server() { - if [ -n "$(first_type chinadns-ng)" ]; then - run_ipset_chinadns_ng $@ - else - run_ipset_dnsmasq $@ - fi -} - -gen_dnsmasq_items() { - local dnss settype setnames outf ipsetoutf - eval_set_val $@ - - awk -v dnss="${dnss}" -v settype="${settype}" -v setnames="${setnames}" -v outf="${outf}" -v ipsetoutf="${ipsetoutf}" ' - BEGIN { - if(outf == "") outf="/dev/stdout"; - if(ipsetoutf == "") ipsetoutf=outf; - split(dnss, dns, ","); setdns=length(dns)>0; setlist=length(setnames)>0; - if(setdns) for(i in dns) if(length(dns[i])==0) delete dns[i]; - fail=1; - } - ! /^$/&&!/^#/ { - fail=0 - if(setdns) for(i in dns) printf("server=/.%s/%s\n", $0, dns[i]) >>outf; - if(setlist) printf("%s=/.%s/%s\n", settype, $0, setnames) >>ipsetoutf; - } - END {fflush(outf); close(outf); fflush(ipsetoutf); close(ipsetoutf); exit(fail);} - ' -} - run_copy_dnsmasq() { local flag listen_port tun_dns eval_set_val $@ local dnsmasq_conf=$TMP_ACL_PATH/$flag/dnsmasq.conf local dnsmasq_conf_path=$TMP_ACL_PATH/$flag/dnsmasq.d mkdir -p $dnsmasq_conf_path - [ -s "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}" ] && { - cp -r /tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID} $dnsmasq_conf - sed -i "/passwall2/d" $dnsmasq_conf - sed -i "/ubus/d" $dnsmasq_conf - sed -i "/dhcp/d" $dnsmasq_conf - sed -i "/port=/d" $dnsmasq_conf - sed -i "/server=/d" $dnsmasq_conf - } - local set_type="ipset" - [ "${nftflag}" = "1" ] && { - set_type="nftset" - local setflag_4="4#inet#passwall2#" - local setflag_6="6#inet#passwall2#" - } - cat <<-EOF >> $dnsmasq_conf - port=${listen_port} - conf-dir=${dnsmasq_conf_path} - server=${tun_dns} - no-poll - no-resolv - EOF - awk '!seen[$0]++' $dnsmasq_conf > /tmp/dnsmasq.tmp && mv /tmp/dnsmasq.tmp $dnsmasq_conf - node_servers=$(uci show "${CONFIG}" | grep -E "(.address=|.download_address=)" | cut -d "'" -f 2) - hosts_foreach "node_servers" host_from_url | grep '[a-zA-Z]$' | sort -u | grep -v "engage.cloudflareclient.com" | gen_dnsmasq_items settype="${set_type}" setnames="${setflag_4}passwall2_vpslist,${setflag_6}passwall2_vpslist6" dnss="${LOCAL_DNS:-${AUTO_DNS}}" outf="${dnsmasq_conf_path}/10-vpslist_host.conf" ipsetoutf="${dnsmasq_conf_path}/ipset.conf" + lua $APP_PATH/helper_dnsmasq.lua copy_instance -LISTEN_PORT ${listen_port} -DNSMASQ_CONF ${dnsmasq_conf} + lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG "${flag}" -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ + -DEFAULT_DNS ${AUTO_DNS} -LOCAL_DNS ${LOCAL_DNS:-${AUTO_DNS}} -TUN_DNS ${tun_dns} \ + -NFTFLAG ${nftflag:-0} \ + -NO_LOGIC_LOG ${NO_LOGIC_LOG:-0} ln_run "$(first_type dnsmasq)" "dnsmasq_${flag}" "/dev/null" -C $dnsmasq_conf -x $TMP_ACL_PATH/$flag/dnsmasq.pid set_cache_var "ACL_${flag}_dns_port" "${listen_port}" } +run_ipset_dns_server() { + if [ -n "$(first_type chinadns-ng)" ]; then + run_ipset_chinadns_ng $@ + else + run_ipset_dnsmasq $@ + fi +} + run_ipset_chinadns_ng() { local listen_port server_dns ipset nftset config_file eval_set_val $@ diff --git a/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua new file mode 100644 index 0000000000..9e93b68ef7 --- /dev/null +++ b/openwrt-passwall2/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua @@ -0,0 +1,355 @@ +local api = require "luci.passwall2.api" +local appname = "passwall2" +local uci = api.uci +local sys = api.sys +local fs = api.fs +local datatypes = api.datatypes +local TMP = {} + +local function tinsert(table_name, val) + if table_name and type(table_name) == "table" then + if not TMP[table_name] then + TMP[table_name] = {} + end + if TMP[table_name][val] then + return false + end + table.insert(table_name, val) + TMP[table_name][val] = true + return true + end + return false +end + +local function backup_servers() + local DNSMASQ_DNS = uci:get("dhcp", "@dnsmasq[0]", "server") + if DNSMASQ_DNS and #DNSMASQ_DNS > 0 then + uci:set(appname, "@global[0]", "dnsmasq_servers", DNSMASQ_DNS) + uci:commit(appname) + end +end + +local function restore_servers() + local dns_table = {} + local DNSMASQ_DNS = uci:get("dhcp", "@dnsmasq[0]", "server") + if DNSMASQ_DNS and #DNSMASQ_DNS > 0 then + for k, v in ipairs(DNSMASQ_DNS) do + tinsert(dns_table, v) + end + end + local OLD_SERVER = uci:get(appname, "@global[0]", "dnsmasq_servers") + if OLD_SERVER and #OLD_SERVER > 0 then + for k, v in ipairs(OLD_SERVER) do + tinsert(dns_table, v) + end + uci:delete(appname, "@global[0]", "dnsmasq_servers") + uci:commit(appname) + end + if dns_table and #dns_table > 0 then + uci:set_list("dhcp", "@dnsmasq[0]", "server", dns_table) + uci:commit("dhcp") + end +end + +function stretch() + local dnsmasq_server = uci:get("dhcp", "@dnsmasq[0]", "server") + local dnsmasq_noresolv = uci:get("dhcp", "@dnsmasq[0]", "noresolv") + local _flag + if dnsmasq_server and #dnsmasq_server > 0 then + for k, v in ipairs(dnsmasq_server) do + if not v:find("/") then + _flag = true + end + end + end + if not _flag and dnsmasq_noresolv == "1" then + uci:delete("dhcp", "@dnsmasq[0]", "noresolv") + local RESOLVFILE = "/tmp/resolv.conf.d/resolv.conf.auto" + local file = io.open(RESOLVFILE, "r") + if not file then + RESOLVFILE = "/tmp/resolv.conf.auto" + else + local size = file:seek("end") + file:close() + if size == 0 then + RESOLVFILE = "/tmp/resolv.conf.auto" + end + end + uci:set("dhcp", "@dnsmasq[0]", "resolvfile", RESOLVFILE) + uci:commit("dhcp") + end +end + +function restart(var) + local LOG = var["-LOG"] + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + if LOG == "1" then + api.log("重启 dnsmasq 服务") + end +end + +function logic_restart(var) + local LOG = var["-LOG"] + local DEFAULT_DNS = api.get_cache_var("DEFAULT_DNS") + if DEFAULT_DNS then + backup_servers() + --sys.call("sed -i '/list server/d' /etc/config/dhcp >/dev/null 2>&1") + local dns_table = {} + local dnsmasq_server = uci:get("dhcp", "@dnsmasq[0]", "server") + if dnsmasq_server and #dnsmasq_server > 0 then + for k, v in ipairs(dnsmasq_server) do + if v:find("/") then + tinsert(dns_table, v) + end + end + if dns_table and #dns_table > 0 then + uci:set_list("dhcp", "@dnsmasq[0]", "server", dns_table) + uci:commit("dhcp") + end + end + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + restore_servers() + else + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + end + if LOG == "1" then + api.log("重启 dnsmasq 服务") + end +end + +function copy_instance(var) + local LISTEN_PORT = var["-LISTEN_PORT"] + local conf_lines = {} + local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") + for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do + local filter + if line:find("passwall2") then filter = true end + if line:find("ubus") then filter = true end + if line:find("dhcp") then filter = true end + if line:find("server=") == 1 then filter = true end + if line:find("port=") == 1 then filter = true end + if line:find("address=") == 1 or (line:find("server=") == 1 and line:find("/")) then filter = nil end + if not filter then + tinsert(conf_lines, line) + end + end + tinsert(conf_lines, "port=" .. LISTEN_PORT) + if var["-return_table"] == "1" then + return conf_lines + end + if #conf_lines > 0 then + local DNSMASQ_CONF = var["-DNSMASQ_CONF"] + local conf_out = io.open(DNSMASQ_CONF, "a") + conf_out:write(table.concat(conf_lines, "\n")) + conf_out:write("\n") + conf_out:close() + end +end + +function add_rule(var) + local FLAG = var["-FLAG"] + local TMP_DNSMASQ_PATH = var["-TMP_DNSMASQ_PATH"] + local DNSMASQ_CONF_FILE = var["-DNSMASQ_CONF_FILE"] + local LISTEN_PORT = var["-LISTEN_PORT"] + local DEFAULT_DNS = var["-DEFAULT_DNS"] + local LOCAL_DNS = var["-LOCAL_DNS"] + local TUN_DNS = var["-TUN_DNS"] + local NO_LOGIC_LOG = var["-NO_LOGIC_LOG"] + local NFTFLAG = var["-NFTFLAG"] + local CACHE_PATH = api.CACHE_PATH + local CACHE_FLAG = "dnsmasq_" .. FLAG + local CACHE_DNS_PATH = CACHE_PATH .. "/" .. CACHE_FLAG + local CACHE_TEXT_FILE = CACHE_DNS_PATH .. ".txt" + + local list1 = {} + local excluded_domain = {} + local excluded_domain_str = "!" + + local function check_dns(domain, dns) + if domain == "" or domain:find("#") then + return false + end + if not dns then + return + end + for k,v in ipairs(list1[domain].dns) do + if dns == v then + return true + end + end + return false + end + + local function check_ipset(domain, ipset) + if domain == "" or domain:find("#") then + return false + end + if not ipset then + return + end + for k,v in ipairs(list1[domain].ipsets) do + if ipset == v then + return true + end + end + return false + end + + local function set_domain_dns(domain, dns) + if domain == "" or domain:find("#") then + return + end + if not dns then + return + end + if not list1[domain] then + list1[domain] = { + dns = {}, + ipsets = {} + } + end + for line in string.gmatch(dns, '[^' .. "," .. ']+') do + if not check_dns(domain, line) then + table.insert(list1[domain].dns, line) + end + end + end + + local function set_domain_ipset(domain, ipset) + if domain == "" or domain:find("#") then + return + end + if not ipset then + return + end + if not list1[domain] then + list1[domain] = { + dns = {}, + ipsets = {} + } + end + for line in string.gmatch(ipset, '[^' .. "," .. ']+') do + if not check_ipset(domain, line) then + table.insert(list1[domain].ipsets, line) + end + end + end + + local cache_text = "" + local nodes_address_md5 = sys.exec("echo -n $(uci show passwall2 | grep '\\.address') | md5sum") + local new_text = TMP_DNSMASQ_PATH .. DNSMASQ_CONF_FILE .. DEFAULT_DNS .. LOCAL_DNS .. TUN_DNS .. nodes_address_md5 .. NFTFLAG + if fs.access(CACHE_TEXT_FILE) then + for line in io.lines(CACHE_TEXT_FILE) do + cache_text = line + end + end + + if cache_text ~= new_text then + api.remove(CACHE_DNS_PATH .. "*") + end + + local dnsmasq_default_dns = TUN_DNS + + local setflag_4= (NFTFLAG == "1") and "4#inet#passwall2#" or "" + local setflag_6= (NFTFLAG == "1") and "6#inet#passwall2#" or "" + + if not fs.access(CACHE_DNS_PATH) then + fs.mkdir(CACHE_DNS_PATH) + + local fwd_dns + + --始终用国内DNS解析节点域名 + if true then + fwd_dns = LOCAL_DNS + uci:foreach(appname, "nodes", function(t) + local function process_address(address) + if address == "engage.cloudflareclient.com" then return end + if datatypes.hostname(address) then + set_domain_dns(address, fwd_dns) + set_domain_ipset(address, setflag_4 .. "passwall2_vpslist," .. setflag_6 .. "passwall2_vpslist6") + end + end + process_address(t.address) + process_address(t.download_address) + end) + end + + if list1 and next(list1) then + local server_out = io.open(CACHE_DNS_PATH .. "/001-server.conf", "a") + local ipset_out = io.open(CACHE_DNS_PATH .. "/ipset.conf", "a") + local set_name = "ipset" + if NFTFLAG == "1" then + set_name = "nftset" + end + for key, value in pairs(list1) do + if value.dns and #value.dns > 0 then + for i, dns in ipairs(value.dns) do + server_out:write(string.format("server=/.%s/%s", key, dns) .. "\n") + end + end + if value.ipsets and #value.ipsets > 0 then + local ipsets_str = "" + for i, ipset in ipairs(value.ipsets) do + ipsets_str = ipsets_str .. ipset .. "," + end + ipsets_str = ipsets_str:sub(1, #ipsets_str - 1) + ipset_out:write(string.format("%s=/.%s/%s", set_name, key, ipsets_str) .. "\n") + end + end + server_out:close() + ipset_out:close() + end + + local f_out = io.open(CACHE_TEXT_FILE, "a") + f_out:write(new_text) + f_out:close() + end + + if api.is_install("procd\\-ujail") then + fs.copyr(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) + else + api.remove(TMP_DNSMASQ_PATH) + fs.symlink(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) + end + + if DNSMASQ_CONF_FILE ~= "nil" then + local conf_lines = {} + if LISTEN_PORT then + --Copy dnsmasq instance + conf_lines = copy_instance({["-LISTEN_PORT"] = LISTEN_PORT, ["-return_table"] = "1"}) + else + --Modify the default dnsmasq service + end + tinsert(conf_lines, string.format("conf-dir=%s", TMP_DNSMASQ_PATH)) + if dnsmasq_default_dns then + for s in string.gmatch(dnsmasq_default_dns, '[^' .. "," .. ']+') do + tinsert(conf_lines, string.format("server=%s", s)) + end + tinsert(conf_lines, "all-servers") + tinsert(conf_lines, "no-poll") + tinsert(conf_lines, "no-resolv") + + if FLAG == "default" then + api.set_cache_var("DEFAULT_DNS", DEFAULT_DNS) + end + end + if #conf_lines > 0 then + local conf_out = io.open(DNSMASQ_CONF_FILE, "a") + conf_out:write(table.concat(conf_lines, "\n")) + conf_out:close() + end + end +end + +_G.stretch = stretch +_G.restart = restart +_G.logic_restart = logic_restart +_G.copy_instance = copy_instance +_G.add_rule = add_rule + +if arg[1] then + local func =_G[arg[1]] + if func then + func(api.get_function_args(arg)) + end +end diff --git a/shadowsocks-rust/Cargo.lock b/shadowsocks-rust/Cargo.lock index be73724eed..e1e2bac60b 100644 --- a/shadowsocks-rust/Cargo.lock +++ b/shadowsocks-rust/Cargo.lock @@ -1869,9 +1869,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libloading" diff --git a/sing-box/common/dialer/default.go b/sing-box/common/dialer/default.go index 537c1818a6..49bd145cd6 100644 --- a/sing-box/common/dialer/default.go +++ b/sing-box/common/dialer/default.go @@ -79,7 +79,8 @@ func NewDefault(ctx context.Context, options option.DialerOptions) (*DefaultDial listener.Control = control.Append(listener.Control, control.RoutingMark(autoRedirectOutputMark)) } } - if options.BindInterface != "" || options.Inet4BindAddress != nil || options.Inet6BindAddress != nil || options.TCPFastOpen { + disableDefaultBind := options.BindInterface != "" || options.Inet4BindAddress != nil || options.Inet6BindAddress != nil + if disableDefaultBind || options.TCPFastOpen { if options.NetworkStrategy != nil || len(options.NetworkType) > 0 && options.FallbackNetworkType == nil && options.FallbackDelay == 0 { return nil, E.New("`network_strategy` is conflict with `bind_interface`, `inet4_bind_address`, `inet6_bind_address` and `tcp_fast_open`") } @@ -87,34 +88,36 @@ func NewDefault(ctx context.Context, options option.DialerOptions) (*DefaultDial if networkManager != nil { defaultOptions := networkManager.DefaultOptions() - if defaultOptions.BindInterface != "" { - bindFunc := control.BindToInterface(networkManager.InterfaceFinder(), defaultOptions.BindInterface, -1) - dialer.Control = control.Append(dialer.Control, bindFunc) - listener.Control = control.Append(listener.Control, bindFunc) - } else if networkManager.AutoDetectInterface() { - if platformInterface != nil { - networkStrategy = (*C.NetworkStrategy)(options.NetworkStrategy) - if networkStrategy == nil { - networkStrategy = common.Ptr(C.NetworkStrategyDefault) - } - networkType = common.Map(options.NetworkType, option.InterfaceType.Build) - fallbackNetworkType = common.Map(options.FallbackNetworkType, option.InterfaceType.Build) - if networkStrategy == nil && len(networkType) == 0 && len(fallbackNetworkType) == 0 { - networkStrategy = defaultOptions.NetworkStrategy - networkType = defaultOptions.NetworkType - fallbackNetworkType = defaultOptions.FallbackNetworkType - } - networkFallbackDelay = time.Duration(options.FallbackDelay) - if networkFallbackDelay == 0 && defaultOptions.FallbackDelay != 0 { - networkFallbackDelay = defaultOptions.FallbackDelay - } - bindFunc := networkManager.ProtectFunc() - dialer.Control = control.Append(dialer.Control, bindFunc) - listener.Control = control.Append(listener.Control, bindFunc) - } else { - bindFunc := networkManager.AutoDetectInterfaceFunc() + if !disableDefaultBind { + if defaultOptions.BindInterface != "" { + bindFunc := control.BindToInterface(networkManager.InterfaceFinder(), defaultOptions.BindInterface, -1) dialer.Control = control.Append(dialer.Control, bindFunc) listener.Control = control.Append(listener.Control, bindFunc) + } else if networkManager.AutoDetectInterface() { + if platformInterface != nil { + networkStrategy = (*C.NetworkStrategy)(options.NetworkStrategy) + if networkStrategy == nil { + networkStrategy = common.Ptr(C.NetworkStrategyDefault) + } + networkType = common.Map(options.NetworkType, option.InterfaceType.Build) + fallbackNetworkType = common.Map(options.FallbackNetworkType, option.InterfaceType.Build) + if networkStrategy == nil && len(networkType) == 0 && len(fallbackNetworkType) == 0 { + networkStrategy = defaultOptions.NetworkStrategy + networkType = defaultOptions.NetworkType + fallbackNetworkType = defaultOptions.FallbackNetworkType + } + networkFallbackDelay = time.Duration(options.FallbackDelay) + if networkFallbackDelay == 0 && defaultOptions.FallbackDelay != 0 { + networkFallbackDelay = defaultOptions.FallbackDelay + } + bindFunc := networkManager.ProtectFunc() + dialer.Control = control.Append(dialer.Control, bindFunc) + listener.Control = control.Append(listener.Control, bindFunc) + } else { + bindFunc := networkManager.AutoDetectInterfaceFunc() + dialer.Control = control.Append(dialer.Control, bindFunc) + listener.Control = control.Append(listener.Control, bindFunc) + } } } if options.RoutingMark == 0 && defaultOptions.RoutingMark != 0 { diff --git a/sing-box/route/conn.go b/sing-box/route/conn.go index ed16e608fe..e010c2cdb6 100644 --- a/sing-box/route/conn.go +++ b/sing-box/route/conn.go @@ -97,12 +97,19 @@ func (m *ConnectionManager) NewPacketConnection(ctx context.Context, this N.Dial err error ) if metadata.UDPConnect { - if len(metadata.DestinationAddresses) > 0 || metadata.Destination.IsIP() { - if parallelDialer, isParallelDialer := this.(dialer.ParallelInterfaceDialer); isParallelDialer { + parallelDialer, isParallelDialer := this.(dialer.ParallelInterfaceDialer) + if len(metadata.DestinationAddresses) > 0 { + if isParallelDialer { remoteConn, err = dialer.DialSerialNetwork(ctx, parallelDialer, N.NetworkUDP, metadata.Destination, metadata.DestinationAddresses, metadata.NetworkStrategy, metadata.NetworkType, metadata.FallbackNetworkType, metadata.FallbackDelay) } else { remoteConn, err = N.DialSerial(ctx, this, N.NetworkUDP, metadata.Destination, metadata.DestinationAddresses) } + } else if metadata.Destination.IsIP() { + if isParallelDialer { + remoteConn, err = dialer.DialSerialNetwork(ctx, parallelDialer, N.NetworkUDP, metadata.Destination, metadata.DestinationAddresses, metadata.NetworkStrategy, metadata.NetworkType, metadata.FallbackNetworkType, metadata.FallbackDelay) + } else { + remoteConn, err = this.DialContext(ctx, N.NetworkUDP, metadata.Destination) + } } else { remoteConn, err = this.DialContext(ctx, N.NetworkUDP, metadata.Destination) } diff --git a/small/luci-app-passwall/luasrc/controller/passwall.lua b/small/luci-app-passwall/luasrc/controller/passwall.lua index 33c5319d14..6851861399 100644 --- a/small/luci-app-passwall/luasrc/controller/passwall.lua +++ b/small/luci-app-passwall/luasrc/controller/passwall.lua @@ -166,11 +166,11 @@ end function get_now_use_node() local path = "/tmp/etc/passwall/acl/default" local e = {} - local tcp_node = api.get_cache_var("GLOBAL_TCP_node") + local tcp_node = api.get_cache_var("ACL_GLOBAL_TCP_node") if tcp_node then e["TCP"] = tcp_node end - local udp_node = api.get_cache_var("GLOBAL_UDP_node") + local udp_node = api.get_cache_var("ACL_GLOBAL_UDP_node") if udp_node then e["UDP"] = udp_node end @@ -364,8 +364,8 @@ end function clear_all_nodes() uci:set(appname, '@global[0]', "enabled", "0") - uci:set(appname, '@global[0]', "tcp_node", "nil") - uci:set(appname, '@global[0]', "udp_node", "nil") + uci:delete(appname, '@global[0]', "tcp_node") + uci:delete(appname, '@global[0]', "udp_node") uci:foreach(appname, "socks", function(t) uci:delete(appname, t[".name"]) uci:set_list(appname, t[".name"], "autoswitch_backup_node", {}) @@ -374,8 +374,8 @@ function clear_all_nodes() uci:delete(appname, t[".name"]) end) uci:foreach(appname, "acl_rule", function(t) - uci:set(appname, t[".name"], "tcp_node", "nil") - uci:set(appname, t[".name"], "udp_node", "nil") + uci:delete(appname, t[".name"], "tcp_node") + uci:delete(appname, t[".name"], "udp_node") end) uci:foreach(appname, "nodes", function(node) uci:delete(appname, node['.name']) @@ -388,11 +388,11 @@ end function delete_select_nodes() local ids = luci.http.formvalue("ids") string.gsub(ids, '[^' .. "," .. ']+', function(w) - if (uci:get(appname, "@global[0]", "tcp_node") or "nil") == w then - uci:set(appname, '@global[0]', "tcp_node", "nil") + if (uci:get(appname, "@global[0]", "tcp_node") or "") == w then + uci:delete(appname, '@global[0]', "tcp_node") end - if (uci:get(appname, "@global[0]", "udp_node") or "nil") == w then - uci:set(appname, '@global[0]', "udp_node", "nil") + if (uci:get(appname, "@global[0]", "udp_node") or "") == w then + uci:delete(appname, '@global[0]', "udp_node") end uci:foreach(appname, "socks", function(t) if t["node"] == w then @@ -413,10 +413,10 @@ function delete_select_nodes() end) uci:foreach(appname, "acl_rule", function(t) if t["tcp_node"] == w then - uci:set(appname, t[".name"], "tcp_node", "nil") + uci:delete(appname, t[".name"], "tcp_node") end if t["udp_node"] == w then - uci:set(appname, t[".name"], "udp_node", "nil") + uci:delete(appname, t[".name"], "udp_node") end end) uci:foreach(appname, "nodes", function(t) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua index e4b13e1072..82a354bef7 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua @@ -52,7 +52,7 @@ o.rmempty = false ---- Remarks o = s:option(Value, "remarks", translate("Remarks")) o.default = arg[1] -o.rmempty = true +o.rmempty = false o = s:option(ListValue, "interface", translate("Source Interface")) o:value("", translate("All")) @@ -148,97 +148,117 @@ sources.write = dynamicList_write ---- TCP No Redir Ports local TCP_NO_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_no_redir_ports") o = s:option(Value, "tcp_no_redir_ports", translate("TCP No Redir Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o.validate = port_validate ---- UDP No Redir Ports local UDP_NO_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_no_redir_ports") o = s:option(Value, "udp_no_redir_ports", translate("UDP No Redir Ports"), - "" .. translate( - "Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") .. - "") -o.default = "default" + "" .. + translate("Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") .. + "") +o:value("", translate("Use global config") .. "(" .. UDP_NO_REDIR_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. UDP_NO_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o.validate = port_validate +o = s:option(DummyValue, "_hide_node_option", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ tcp_no_redir_ports = "1:65535", udp_no_redir_ports = "1:65535" }) +if TCP_NO_REDIR_PORTS == "1:65535" and UDP_NO_REDIR_PORTS == "1:65535" then + o:depends({ tcp_no_redir_ports = "", udp_no_redir_ports = "" }) +end + o = s:option(Flag, "use_global_config", translatef("Use global config")) o.default = "0" o.rmempty = false +o:depends({ _hide_node_option = "1", ['!reverse'] = true }) -tcp_node = s:option(ListValue, "tcp_node", "" .. translate("TCP Node") .. "") -tcp_node.default = "" -tcp_node:value("", translate("Close")) -tcp_node:depends("use_global_config", false) +o = s:option(ListValue, "tcp_node", "" .. translate("TCP Node") .. "") +o.default = "" +o:depends({ _hide_node_option = false, use_global_config = false }) -udp_node = s:option(ListValue, "udp_node", "" .. translate("UDP Node") .. "") -udp_node.default = "" -udp_node:value("", translate("Close")) -udp_node:value("tcp", translate("Same as the tcp node")) -udp_node:depends({ tcp_node = "", ['!reverse'] = true }) +o = s:option(DummyValue, "_tcp_node_bool", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ tcp_node = "", ['!reverse'] = true }) + +o = s:option(ListValue, "udp_node", "" .. translate("UDP Node") .. "") +o.default = "" +o:value("", translate("Close")) +o:value("tcp", translate("Same as the tcp node")) +o:depends({ _tcp_node_bool = "1" }) for k, v in pairs(nodes_table) do - tcp_node:value(v.id, v["remark"]) - udp_node:value(v.id, v["remark"]) + s.fields["tcp_node"]:value(v.id, v["remark"]) + s.fields["udp_node"]:value(v.id, v["remark"]) end +o = s:option(DummyValue, "_udp_node_bool", "") +o.template = "passwall/cbi/hidevalue" +o.value = "1" +o:depends({ udp_node = "", ['!reverse'] = true }) + ---- TCP Proxy Drop Ports local TCP_PROXY_DROP_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_proxy_drop_ports") o = s:option(Value, "tcp_proxy_drop_ports", translate("TCP Proxy Drop Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")") o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- UDP Proxy Drop Ports local UDP_PROXY_DROP_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_proxy_drop_ports") o = s:option(Value, "udp_proxy_drop_ports", translate("UDP Proxy Drop Ports")) -o.default = "default" +o:value("", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) -o:value("default", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")") o:value("443", translate("QUIC")) o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- TCP Redir Ports local TCP_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "tcp_redir_ports") o = s:option(Value, "tcp_redir_ports", translate("TCP Redir Ports"), translatef("Only work with using the %s node.", "TCP")) -o.default = "default" -o:value("default", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")") +o:value("", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o:value("80,443", "80,443") o:value("80:65535", "80 " .. translate("or more")) o:value("1:443", "443 " .. translate("or less")) o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _tcp_node_bool = "1" }) ---- UDP Redir Ports local UDP_REDIR_PORTS = uci:get(appname, "@global_forwarding[0]", "udp_redir_ports") o = s:option(Value, "udp_redir_ports", translate("UDP Redir Ports"), translatef("Only work with using the %s node.", "UDP")) -o.default = "default" -o:value("default", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")") +o:value("", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) o:value("53", "53") o.validate = port_validate +o:depends({ use_global_config = true }) +o:depends({ _udp_node_bool = "1" }) o = s:option(Flag, "use_direct_list", translatef("Use %s", translate("Direct List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(Flag, "use_proxy_list", translatef("Use %s", translate("Proxy List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(Flag, "use_block_list", translatef("Use %s", translate("Block List"))) o.default = "1" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) if has_gfwlist then o = s:option(Flag, "use_gfw_list", translatef("Use %s", translate("GFW List"))) o.default = "1" - o:depends({ tcp_node = "", ['!reverse'] = true }) + o:depends({ _tcp_node_bool = "1" }) end if has_chnlist or has_chnroute then @@ -247,36 +267,36 @@ if has_chnlist or has_chnroute then o:value("direct", translate("Direct Connection")) o:value("proxy", translate("Proxy")) o.default = "direct" - o:depends({ tcp_node = "", ['!reverse'] = true }) + o:depends({ _tcp_node_bool = "1" }) end o = s:option(ListValue, "tcp_proxy_mode", "TCP " .. translate("Proxy Mode")) o:value("disable", translate("No Proxy")) o:value("proxy", translate("Proxy")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o = s:option(ListValue, "udp_proxy_mode", "UDP " .. translate("Proxy Mode")) o:value("disable", translate("No Proxy")) o:value("proxy", translate("Proxy")) -o:depends({ udp_node = "", ['!reverse'] = true }) +o:depends({ _udp_node_bool = "1" }) o = s:option(DummyValue, "switch_mode", " ") o.template = appname .. "/global/proxy" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) ---- DNS o = s:option(ListValue, "dns_shunt", "DNS " .. translate("Shunt")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) o:value("dnsmasq", "Dnsmasq") o:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) o = s:option(Flag, "filter_proxy_ipv6", translate("Filter Proxy Host IPv6"), translate("Experimental feature.")) o.default = "0" -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) ---- DNS Forward Mode o = s:option(ListValue, "dns_mode", translate("Filter Mode")) -o:depends({ tcp_node = "", ['!reverse'] = true }) +o:depends({ _tcp_node_bool = "1" }) if api.is_finded("dns2socks") then o:value("dns2socks", "dns2socks") end diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 488cd50ace..958ff0aa6f 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -126,19 +126,19 @@ o = s:taboption("Main", Flag, "enabled", translate("Main switch")) o.rmempty = false ---- TCP Node -tcp_node = s:taboption("Main", ListValue, "tcp_node", "" .. translate("TCP Node") .. "") -tcp_node:value("nil", translate("Close")) +o = s:taboption("Main", ListValue, "tcp_node", "" .. translate("TCP Node") .. "") +o:value("", translate("Close")) ---- UDP Node -udp_node = s:taboption("Main", ListValue, "udp_node", "" .. translate("UDP Node") .. "") -udp_node:value("nil", translate("Close")) -udp_node:value("tcp", translate("Same as the tcp node")) +o = s:taboption("Main", ListValue, "udp_node", "" .. translate("UDP Node") .. "") +o:value("", translate("Close")) +o:value("tcp", translate("Same as the tcp node")) -- 分流 if (has_singbox or has_xray) and #nodes_table > 0 then local function get_cfgvalue(shunt_node_id, option) return function(self, section) - return m:get(shunt_node_id, option) or "nil" + return m:get(shunt_node_id, option) end end local function get_write(shunt_node_id, option) @@ -146,6 +146,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then m:set(shunt_node_id, option, value) end end + local function get_remove(shunt_node_id, option) + return function(self, section) + m:del(shunt_node_id, option) + end + end if #normal_list > 0 then for k, v in pairs(shunt_list) do local vid = v.id @@ -187,7 +192,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then if (has_singbox and has_xray) or (v.type == "sing-box" and not has_singbox) or (v.type == "Xray" and not has_xray) then type:depends("tcp_node", v.id) else - type:depends("tcp_node", "hide") --不存在的依赖,即始终隐藏 + type:depends("tcp_node", "__hide") --不存在的依赖,即始终隐藏 end uci:foreach(appname, "shunt_rules", function(e) @@ -197,8 +202,9 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, node_option, string.format('* %s', api.url("shunt_rules", id), e.remarks)) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("tcp_node", v.id) - o:value("nil", translate("Close")) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -206,9 +212,9 @@ if (has_singbox or has_xray) and #nodes_table > 0 then local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag") pt.write = get_write(v.id, id .. "_proxy_tag") - pt:value("nil", translate("Close")) + pt.remove = get_remove(v.id, id .. "_proxy_tag") + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k1, v1 in pairs(socks_list) do o:value(v1.id, v1.remark) end @@ -229,6 +235,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default"))) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("tcp_node", v.id) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -249,7 +256,8 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) - o:value("nil", translate("Close")) + o.remove = get_remove(v.id, id) + o:value("", translate("Close")) o:value("main", translate("Preproxy Node")) for k1, v1 in pairs(normal_list) do if v1.protocol ~= "_balancing" then @@ -263,7 +271,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then tips.cfgvalue = function(t, n) return string.format('%s', translate("There are no available nodes, please add or subscribe nodes first.")) end - tips:depends({ tcp_node = "nil", ["!reverse"] = true }) + tips:depends({ tcp_node = "", ["!reverse"] = true }) for k, v in pairs(shunt_list) do tips:depends("udp_node", v.id) end @@ -273,36 +281,35 @@ if (has_singbox or has_xray) and #nodes_table > 0 then end end -tcp_node_socks_port = s:taboption("Main", Value, "tcp_node_socks_port", translate("TCP Node") .. " Socks " .. translate("Listen Port")) -tcp_node_socks_port.default = 1070 -tcp_node_socks_port.datatype = "port" -tcp_node_socks_port:depends({ tcp_node = "nil", ["!reverse"] = true }) +o = s:taboption("Main", Value, "tcp_node_socks_port", translate("TCP Node") .. " Socks " .. translate("Listen Port")) +o.default = 1070 +o.datatype = "port" +o:depends({ tcp_node = "", ["!reverse"] = true }) --[[ if has_singbox or has_xray then - tcp_node_http_port = s:taboption("Main", Value, "tcp_node_http_port", translate("TCP Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) - tcp_node_http_port.default = 0 - tcp_node_http_port.datatype = "port" + o = s:taboption("Main", Value, "tcp_node_http_port", translate("TCP Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) + o.default = 0 + o.datatype = "port" end ]]-- -tcp_node_socks_bind_local = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) -tcp_node_socks_bind_local.default = "1" -tcp_node_socks_bind_local:depends({ tcp_node = "nil", ["!reverse"] = true }) +o = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o.default = "1" +o:depends({ tcp_node = "", ["!reverse"] = true }) s:tab("DNS", translate("DNS")) -dns_shunt = s:taboption("DNS", ListValue, "dns_shunt", "DNS " .. translate("Shunt")) -dns_shunt:value("dnsmasq", "Dnsmasq") -dns_shunt:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) +o = s:taboption("DNS", ListValue, "dns_shunt", "DNS " .. translate("Shunt")) +o:value("dnsmasq", "Dnsmasq") +o:value("chinadns-ng", translate("ChinaDNS-NG (recommended)")) if api.is_finded("smartdns") then - dns_shunt:value("smartdns", "SmartDNS") - group_domestic = s:taboption("DNS", Value, "group_domestic", translate("Domestic group name")) - group_domestic.placeholder = "local" - group_domestic:depends("dns_shunt", "smartdns") - group_domestic.description = translate("You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here.") + o:value("smartdns", "SmartDNS") + o = s:taboption("DNS", Value, "group_domestic", translate("Domestic group name")) + o.placeholder = "local" + o:depends("dns_shunt", "smartdns") + o.description = translate("You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here.") end o = s:taboption("DNS", ListValue, "direct_dns_mode", translate("Direct DNS") .. " " .. translate("Request protocol")) -o.default = "" o:value("", translate("Auto")) o:value("udp", translatef("Requery DNS By %s", "UDP")) o:value("tcp", translatef("Requery DNS By %s", "TCP")) @@ -399,23 +406,23 @@ if api.is_finded("smartdns") then end ---- DNS Forward Mode -dns_mode = s:taboption("DNS", ListValue, "dns_mode", translate("Filter Mode")) -dns_mode:value("udp", translatef("Requery DNS By %s", "UDP")) -dns_mode:value("tcp", translatef("Requery DNS By %s", "TCP")) +o = s:taboption("DNS", ListValue, "dns_mode", translate("Filter Mode")) +o:value("udp", translatef("Requery DNS By %s", "UDP")) +o:value("tcp", translatef("Requery DNS By %s", "TCP")) if chinadns_tls == 0 then - dns_mode:value("dot", translatef("Requery DNS By %s", "DoT")) + o:value("dot", translatef("Requery DNS By %s", "DoT")) end if api.is_finded("dns2socks") then - dns_mode:value("dns2socks", "dns2socks") + o:value("dns2socks", "dns2socks") end if has_singbox then - dns_mode:value("sing-box", "Sing-Box") + o:value("sing-box", "Sing-Box") end if has_xray then - dns_mode:value("xray", "Xray") + o:value("xray", "Xray") end if api.is_finded("smartdns") then - dns_mode:depends({ dns_shunt = "smartdns", ['!reverse'] = true }) + o:depends({ dns_shunt = "smartdns", ['!reverse'] = true }) end o = s:taboption("DNS", ListValue, "xray_dns_mode", translate("Request protocol")) @@ -426,7 +433,7 @@ o.cfgvalue = function(self, section) return m:get(section, "v2ray_dns_mode") end o.write = function(self, section, value) - if dns_mode:formvalue(section) == "xray" then + if s.fields["dns_mode"]:formvalue(section) == "xray" then return m:set(section, "v2ray_dns_mode", value) end end @@ -439,7 +446,7 @@ o.cfgvalue = function(self, section) return m:get(section, "v2ray_dns_mode") end o.write = function(self, section, value) - if dns_mode:formvalue(section) == "sing-box" then + if s.fields["dns_mode"]:formvalue(section) == "sing-box" then return m:set(section, "v2ray_dns_mode", value) end end @@ -518,9 +525,9 @@ o.default = "0" o:depends({dns_mode = "sing-box", dns_shunt = "dnsmasq"}) o.validate = function(self, value, t) if value and value == "1" then - local _dns_mode = dns_mode:formvalue(t) - local _tcp_node = tcp_node:formvalue(t) - if _dns_mode and _tcp_node and _tcp_node ~= "nil" then + local _dns_mode = s.fields["dns_mode"]:formvalue(t) + local _tcp_node = s.fields["tcp_node"]:formvalue(t) + if _dns_mode and _tcp_node then if m:get(_tcp_node, "type"):lower() ~= _dns_mode then return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode) end @@ -597,16 +604,16 @@ if has_chnlist or has_chnroute then end ---- TCP Default Proxy Mode -tcp_proxy_mode = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP " .. translate("Default Proxy Mode")) -tcp_proxy_mode:value("disable", translate("No Proxy")) -tcp_proxy_mode:value("proxy", translate("Proxy")) -tcp_proxy_mode.default = "proxy" +o = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP " .. translate("Default Proxy Mode")) +o:value("disable", translate("No Proxy")) +o:value("proxy", translate("Proxy")) +o.default = "proxy" ---- UDP Default Proxy Mode -udp_proxy_mode = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP " .. translate("Default Proxy Mode")) -udp_proxy_mode:value("disable", translate("No Proxy")) -udp_proxy_mode:value("proxy", translate("Proxy")) -udp_proxy_mode.default = "proxy" +o = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP " .. translate("Default Proxy Mode")) +o:value("disable", translate("No Proxy")) +o:value("proxy", translate("Proxy")) +o.default = "proxy" o = s:taboption("Proxy", DummyValue, "switch_mode", " ") o.template = appname .. "/global/proxy" @@ -634,20 +641,20 @@ o = s:taboption("log", Flag, "log_udp", translate("Enable") .. " " .. translatef o.default = "1" o.rmempty = false -loglevel = s:taboption("log", ListValue, "loglevel", "Sing-Box/Xray " .. translate("Log Level")) -loglevel.default = "warning" -loglevel:value("debug") -loglevel:value("info") -loglevel:value("warning") -loglevel:value("error") +o = s:taboption("log", ListValue, "loglevel", "Sing-Box/Xray " .. translate("Log Level")) +o.default = "warning" +o:value("debug") +o:value("info") +o:value("warning") +o:value("error") -trojan_loglevel = s:taboption("log", ListValue, "trojan_loglevel", "Trojan " .. translate("Log Level")) -trojan_loglevel.default = "2" -trojan_loglevel:value("0", "all") -trojan_loglevel:value("1", "info") -trojan_loglevel:value("2", "warn") -trojan_loglevel:value("3", "error") -trojan_loglevel:value("4", "fatal") +o = s:taboption("log", ListValue, "trojan_loglevel", "Trojan " .. translate("Log Level")) +o.default = "2" +o:value("0", "all") +o:value("1", "info") +o:value("2", "warn") +o:value("3", "error") +o:value("4", "fatal") o = s:taboption("log", Flag, "advanced_log_feature", translate("Advanced log feature"), translate("For professionals only.")) o.default = "0" @@ -670,30 +677,30 @@ o.template = appname .. "/global/faq" o = s:taboption("Main", Flag, "socks_enabled", "Socks " .. translate("Main switch")) o.rmempty = false -s = m:section(TypedSection, "socks", translate("Socks Config")) -s.template = "cbi/tblsection" -s.anonymous = true -s.addremove = true -s.extedit = api.url("socks_config", "%s") -function s.create(e, t) +s2 = m:section(TypedSection, "socks", translate("Socks Config")) +s2.template = "cbi/tblsection" +s2.anonymous = true +s2.addremove = true +s2.extedit = api.url("socks_config", "%s") +function s2.create(e, t) local uuid = api.gen_short_uuid() t = uuid TypedSection.create(e, t) luci.http.redirect(e.extedit:format(t)) end -o = s:option(DummyValue, "status", translate("Status")) +o = s2:option(DummyValue, "status", translate("Status")) o.rawhtml = true o.cfgvalue = function(t, n) return string.format('
', n) end ---- Enable -o = s:option(Flag, "enabled", translate("Enable")) +o = s2:option(Flag, "enabled", translate("Enable")) o.default = 1 o.rmempty = false -socks_node = s:option(ListValue, "node", translate("Socks Node")) +o = s2:option(ListValue, "node", translate("Socks Node")) local n = 1 uci:foreach(appname, "socks", function(s) @@ -703,26 +710,26 @@ uci:foreach(appname, "socks", function(s) n = n + 1 end) -o = s:option(Value, "port", "Socks " .. translate("Listen Port")) +o = s2:option(Value, "port", "Socks " .. translate("Listen Port")) o.default = n + 1080 o.datatype = "port" o.rmempty = false if has_singbox or has_xray then - o = s:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) + o = s2:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) o.default = 0 o.datatype = "port" end for k, v in pairs(nodes_table) do - tcp_node:value(v.id, v["remark"]) - udp_node:value(v.id, v["remark"]) + s.fields["tcp_node"]:value(v.id, v["remark"]) + s.fields["udp_node"]:value(v.id, v["remark"]) if v.type == "Socks" then if has_singbox or has_xray then - socks_node:value(v.id, v["remark"]) + s2.fields["node"]:value(v.id, v["remark"]) end else - socks_node:value(v.id, v["remark"]) + s2.fields["node"]:value(v.id, v["remark"]) end end diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua index 5fedaa2ed8..7f4bc9152b 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua @@ -61,15 +61,15 @@ function s.remove(e, t) end end) TypedSection.remove(e, t) - local new_node = "nil" + local new_node = "" local node0 = m:get("@nodes[0]") or nil if node0 then new_node = node0[".name"] end - if (m:get("@global[0]", "tcp_node") or "nil") == t then + if (m:get("@global[0]", "tcp_node") or "") == t then m:set('@global[0]', "tcp_node", new_node) end - if (m:get("@global[0]", "udp_node") or "nil") == t then + if (m:get("@global[0]", "udp_node") or "") == t then m:set('@global[0]', "udp_node", new_node) end end diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 0bc15c66d7..dbbdbbf92e 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -17,44 +17,44 @@ s = m:section(TypedSection, "global_delay", translate("Delay Settings")) s.anonymous = true s.addremove = false ----- Delay Start -o = s:option(Value, "start_delay", translate("Delay Start"), - translate("Units:seconds")) -o.default = "1" -o.rmempty = true - ---- Open and close Daemon o = s:option(Flag, "start_daemon", translate("Open and close Daemon")) o.default = 1 o.rmempty = false ---[[ ----- Open and close automatically -o = s:option(Flag, "auto_on", translate("Open and close automatically")) -o.default = 0 -o.rmempty = false +---- Delay Start +o = s:option(Value, "start_delay", translate("Delay Start"), translate("Units:seconds")) +o.default = "1" +o.rmempty = true ----- Automatically turn off time -o = s:option(ListValue, "time_off", translate("Automatically turn off time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end - ----- Automatically turn on time -o = s:option(ListValue, "time_on", translate("Automatically turn on time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end - ----- Automatically restart time -o = s:option(ListValue, "time_restart", translate("Automatically restart time")) -o.default = nil -o:depends("auto_on", true) -o:value(nil, translate("Disable")) -for e = 0, 23 do o:value(e, e .. translate("oclock")) end ---]] +for index, value in ipairs({"stop", "start", "restart"}) do + o = s:option(ListValue, value .. "_week_mode", translate(value .. " automatically mode")) + o:value("", translate("Disable")) + o:value(8, translate("Loop Mode")) + o:value(7, translate("Every day")) + o:value(1, translate("Every Monday")) + o:value(2, translate("Every Tuesday")) + o:value(3, translate("Every Wednesday")) + o:value(4, translate("Every Thursday")) + o:value(5, translate("Every Friday")) + o:value(6, translate("Every Saturday")) + o:value(0, translate("Every Sunday")) + o = s:option(ListValue, value .. "_time_mode", translate(value .. " Time(Every day)")) + for t = 0, 23 do o:value(t, t .. ":00") end + o.default = 0 + o:depends(value .. "_week_mode", "0") + o:depends(value .. "_week_mode", "1") + o:depends(value .. "_week_mode", "2") + o:depends(value .. "_week_mode", "3") + o:depends(value .. "_week_mode", "4") + o:depends(value .. "_week_mode", "5") + o:depends(value .. "_week_mode", "6") + o:depends(value .. "_week_mode", "7") + o = s:option(ListValue, value .. "_interval_mode", translate(value .. " Interval(Hour)")) + for t = 1, 24 do o:value(t, t .. " " .. translate("Hour")) end + o.default = 2 + o:depends(value .. "_week_mode", "8") +end -- [[ Forwarding Settings ]]-- s = m:section(TypedSection, "global_forwarding", diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua index ae4c2a80ff..970a9e7596 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua @@ -10,7 +10,7 @@ local type_name = "Hysteria2" local option_prefix = "hysteria2_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,59 +18,59 @@ end s.fields["type"]:value(type_name, "Hysteria2") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("udp", "UDP") -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("hop"), translate("Additional ports for hysteria hop")) +o = s:option(Value, _n("hop"), translate("Additional ports for hysteria hop")) o.rewrite_option = o.option -o = s:option(Value, option_name("obfs"), translate("Obfs Password")) +o = s:option(Value, _n("obfs"), translate("Obfs Password")) o.rewrite_option = o.option -o = s:option(Value, option_name("auth_password"), translate("Auth Password")) +o = s:option(Value, _n("auth_password"), translate("Auth Password")) o.password = true o.rewrite_option = o.option -o = s:option(Flag, option_name("fast_open"), translate("Fast Open")) +o = s:option(Flag, _n("fast_open"), translate("Fast Open")) o.default = "0" -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o = s:option(Value, option_name("tls_pinSHA256"), translate("PinSHA256"),translate("Certificate fingerprint")) +o = s:option(Value, _n("tls_pinSHA256"), translate("PinSHA256"),translate("Certificate fingerprint")) o.rewrite_option = o.option -o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("up_mbps"), translate("Max upload Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("down_mbps"), translate("Max download Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("hop_interval"), translate("Hop Interval"), translate("Example:") .. "30s (≥5s)") +o = s:option(Value, _n("hop_interval"), translate("Hop Interval"), translate("Example:") .. "30s (≥5s)") o.rewrite_option = o.option -o = s:option(Value, option_name("recv_window"), translate("QUIC stream receive window")) +o = s:option(Value, _n("recv_window"), translate("QUIC stream receive window")) o.rewrite_option = o.option -o = s:option(Value, option_name("recv_window_conn"), translate("QUIC connection receive window")) +o = s:option(Value, _n("recv_window_conn"), translate("QUIC connection receive window")) o.rewrite_option = o.option -o = s:option(Value, option_name("idle_timeout"), translate("Idle Timeout"), translate("Example:") .. "30s (4s-120s)") +o = s:option(Value, _n("idle_timeout"), translate("Idle Timeout"), translate("Example:") .. "30s (4s-120s)") o.rewrite_option = o.option -o = s:option(Flag, option_name("disable_mtu_discovery"), translate("Disable MTU detection")) +o = s:option(Flag, _n("disable_mtu_discovery"), translate("Disable MTU detection")) o.default = "0" o.rewrite_option = o.option -o = s:option(Flag, option_name("lazy_start"), translate("Lazy Start")) +o = s:option(Flag, _n("lazy_start"), translate("Lazy Start")) o.default = "0" o.rewrite_option = o.option diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua index d2447d35d7..1683b4fe3f 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/naive.lua @@ -10,7 +10,7 @@ local type_name = "Naiveproxy" local option_prefix = "naive_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,18 +18,18 @@ end s.fields["type"]:value(type_name, translate("NaiveProxy")) -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("https", translate("HTTPS")) o:value("quic", translate("QUIC")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("username"), translate("Username")) +o = s:option(Value, _n("username"), translate("Username")) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 8b55b6b466..a83510a7ef 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -14,7 +14,7 @@ local type_name = "Xray" local option_prefix = "xray_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -33,7 +33,7 @@ local xray_version = api.get_app_version("xray") s.fields["type"]:value(type_name, "Xray") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("vmess", translate("Vmess")) o:value("vless", translate("VLESS")) o:value("http", translate("HTTP")) @@ -45,9 +45,9 @@ o:value("_balancing", translate("Balancing")) o:value("_shunt", translate("Shunt")) o:value("_iface", translate("Custom Interface")) -o = s:option(Value, option_name("iface"), translate("Interface")) +o = s:option(Value, _n("iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("protocol")] = "_iface" }) +o:depends({ [_n("protocol")] = "_iface" }) local nodes_table = {} local balancers_table = {} @@ -96,12 +96,12 @@ uci:foreach(appname, "socks", function(s) end) -- 负载均衡列表 -local o = s:option(DynamicList, option_name("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, document")) -o:depends({ [option_name("protocol")] = "_balancing" }) +local o = s:option(DynamicList, _n("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, document")) +o:depends({ [_n("protocol")] = "_balancing" }) for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end -local o = s:option(ListValue, option_name("balancingStrategy"), translate("Balancing Strategy")) -o:depends({ [option_name("protocol")] = "_balancing" }) +local o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) +o:depends({ [_n("protocol")] = "_balancing" }) o:value("random") o:value("roundRobin") o:value("leastPing") @@ -109,11 +109,11 @@ o.default = "leastPing" -- Fallback Node if api.compare_versions(xray_version, ">=", "1.8.10") then - local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node")) + local o = s:option(ListValue, _n("fallback_node"), translate("Fallback Node")) if api.compare_versions(xray_version, ">=", "1.8.12") then - o:depends({ [option_name("protocol")] = "_balancing" }) + o:depends({ [_n("protocol")] = "_balancing" }) else - o:depends({ [option_name("balancingStrategy")] = "leastPing" }) + o:depends({ [_n("balancingStrategy")] = "leastPing" }) end local function check_fallback_chain(fb) for k, v in pairs(fallback_table) do @@ -132,11 +132,11 @@ if api.compare_versions(xray_version, ">=", "1.8.10") then end -- 探测地址 -local ucpu = s:option(Flag, option_name("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) -ucpu:depends({ [option_name("balancingStrategy")] = "leastPing" }) +local ucpu = s:option(Flag, _n("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) +ucpu:depends({ [_n("balancingStrategy")] = "leastPing" }) -local pu = s:option(Value, option_name("probeUrl"), translate("Probe URL")) -pu:depends({ [option_name("useCustomProbeUrl")] = true }) +local pu = s:option(Value, _n("probeUrl"), translate("Probe URL")) +pu:depends({ [_n("useCustomProbeUrl")] = true }) pu:value("https://cp.cloudflare.com/", "Cloudflare") pu:value("https://www.gstatic.com/generate_204", "Gstatic") pu:value("https://www.google.com/generate_204", "Google") @@ -147,27 +147,27 @@ pu.default = "https://www.google.com/generate_204" pu.description = translate("The URL used to detect the connection status.") -- 探测间隔 -local pi = s:option(Value, option_name("probeInterval"), translate("Probe Interval")) -pi:depends({ [option_name("balancingStrategy")] = "leastPing" }) +local pi = s:option(Value, _n("probeInterval"), translate("Probe Interval")) +pi:depends({ [_n("balancingStrategy")] = "leastPing" }) pi.default = "1m" pi.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are ns, us, ms, s, m, h, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.") if api.compare_versions(xray_version, ">=", "1.8.12") then - ucpu:depends({ [option_name("protocol")] = "_balancing" }) - pi:depends({ [option_name("protocol")] = "_balancing" }) + ucpu:depends({ [_n("protocol")] = "_balancing" }) + pi:depends({ [_n("protocol")] = "_balancing" }) else - ucpu:depends({ [option_name("balancingStrategy")] = "leastPing" }) - pi:depends({ [option_name("balancingStrategy")] = "leastPing" }) + ucpu:depends({ [_n("balancingStrategy")] = "leastPing" }) + pi:depends({ [_n("balancingStrategy")] = "leastPing" }) end -- [[ 分流模块 ]] if #nodes_table > 0 then - o = s:option(Flag, option_name("preproxy_enabled"), translate("Preproxy")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o = s:option(Flag, _n("preproxy_enabled"), translate("Preproxy")) + o:depends({ [_n("protocol")] = "_shunt" }) - o = s:option(ListValue, option_name("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) - o:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true }) + o = s:option(ListValue, _n("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) + o:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true }) for k, v in pairs(socks_list) do o:value(v.id, v.remark) end @@ -180,16 +180,15 @@ if #nodes_table > 0 then for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end - o.default = "nil" end uci:foreach(appname, "shunt_rules", function(e) if e[".name"] and e.remarks then - o = s:option(ListValue, option_name(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) - o:value("nil", translate("Close")) + o = s:option(ListValue, _n(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o:depends({ [_n("protocol")] = "_shunt" }) if #nodes_table > 0 then for k, v in pairs(socks_list) do @@ -201,28 +200,27 @@ uci:foreach(appname, "shunt_rules", function(e) for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local pt = s:option(ListValue, option_name(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) - pt:value("nil", translate("Close")) + local pt = s:option(ListValue, _n(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - pt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name(e[".name"])] = v.id }) + pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id }) end end end end) -o = s:option(DummyValue, option_name("shunt_tips"), " ") +o = s:option(DummyValue, _n("shunt_tips"), " ") o.not_rewrite = true o.rawhtml = true o.cfgvalue = function(t, n) return string.format('%s', translate("No shunt rules? Click me to go to add.")) end -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -local o = s:option(ListValue, option_name("default_node"), string.format('* %s', translate("Default"))) -o:depends({ [option_name("protocol")] = "_shunt" }) +local o = s:option(ListValue, _n("default_node"), string.format('* %s', translate("Default"))) +o:depends({ [_n("protocol")] = "_shunt" }) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -236,17 +234,16 @@ if #nodes_table > 0 then for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local dpt = s:option(ListValue, option_name("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) - dpt:value("nil", translate("Close")) + local dpt = s:option(ListValue, _n("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + dpt:value("", translate("Close")) dpt:value("main", translate("Preproxy Node")) - dpt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - dpt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name("default_node")] = v.id }) + dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id }) end end -o = s:option(ListValue, option_name("domainStrategy"), translate("Domain Strategy")) +o = s:option(ListValue, _n("domainStrategy"), translate("Domain Strategy")) o:value("AsIs") o:value("IPIfNonMatch") o:value("IPOnDemand") @@ -255,92 +252,92 @@ o.description = "
  • " .. translate("'AsIs': Only use domain for routi .. "
  • " .. translate("'IPIfNonMatch': When no rule matches current domain, resolves it into IP addresses (A or AAAA records) and try all rules again.") .. "
  • " .. translate("'IPOnDemand': As long as there is a IP-based rule, resolves the domain into IP immediately.") .. "
" -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -o = s:option(ListValue, option_name("domainMatcher"), translate("Domain matcher")) +o = s:option(ListValue, _n("domainMatcher"), translate("Domain matcher")) o:value("hybrid") o:value("linear") -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -- [[ 分流模块 End ]] -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -local protocols = s.fields[option_name("protocol")].keylist +local protocols = s.fields[_n("protocol")].keylist if #protocols > 0 then for index, value in ipairs(protocols) do if not value:find("_") then - s.fields[option_name("address")]:depends({ [option_name("protocol")] = value }) - s.fields[option_name("port")]:depends({ [option_name("protocol")] = value }) + s.fields[_n("address")]:depends({ [_n("protocol")] = value }) + s.fields[_n("port")]:depends({ [_n("protocol")] = value }) end end end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("security"), translate("Encrypt Method")) for a, t in ipairs(security_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Value, option_name("encryption"), translate("Encrypt Method")) +o = s:option(Value, _n("encryption"), translate("Encrypt Method")) o.default = "none" o:value("none") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("iv_check"), translate("IV Check")) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "aes-128-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "aes-256-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "chacha20-poly1305" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "xchacha20-poly1305" }) +o = s:option(Flag, _n("iv_check"), translate("IV Check")) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "aes-128-gcm" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "aes-256-gcm" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "chacha20-poly1305" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("ss_method")] = "xchacha20-poly1305" }) -o = s:option(Flag, option_name("uot"), translate("UDP over TCP")) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("uot"), translate("UDP over TCP")) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "raw" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("reality"), translate("REALITY"), translate("Only recommend to use with VLESS-TCP-XTLS-Vision.")) +o = s:option(Flag, _n("reality"), translate("REALITY"), translate("Only recommend to use with VLESS-TCP-XTLS-Vision.")) o.default = 0 -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "raw" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "h2" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "grpc" }) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "xhttp" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "raw" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "h2" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "grpc" }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "xhttp" }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -349,36 +346,36 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) --- o = s:option(Value, option_name("minversion"), translate("minversion")) +-- o = s:option(Value, _n("minversion"), translate("minversion")) -- o.default = "1.3" -- o:value("1.3") --- o:depends({ [option_name("tls")] = true }) +-- o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) -- [[ REALITY部分 ]] -- -o = s:option(Value, option_name("reality_publicKey"), translate("Public Key")) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o = s:option(Value, _n("reality_publicKey"), translate("Public Key")) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o = s:option(Value, _n("reality_shortId"), translate("Short Id")) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Value, option_name("reality_spiderX"), translate("Spider X")) +o = s:option(Value, _n("reality_spiderX"), translate("Spider X")) o.placeholder = "/" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(Flag, option_name("utls"), translate("uTLS")) +o = s:option(Flag, _n("utls"), translate("uTLS")) o.default = "0" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) -o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print")) +o = s:option(ListValue, _n("fingerprint"), translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -390,10 +387,10 @@ o:value("android") o:value("random") o:value("randomized") o.default = "chrome" -o:depends({ [option_name("tls")] = true, [option_name("utls")] = true }) -o:depends({ [option_name("tls")] = true, [option_name("reality")] = true }) +o:depends({ [_n("tls")] = true, [_n("utls")] = true }) +o:depends({ [_n("tls")] = true, [_n("reality")] = true }) -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("raw", "RAW (TCP)") o:value("mkcp", "mKCP") o:value("ws", "WebSocket") @@ -403,193 +400,193 @@ o:value("quic", "QUIC") o:value("grpc", "gRPC") o:value("httpupgrade", "HttpUpgrade") o:value("xhttp", "XHTTP (SplitHTTP)") -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(Value, option_name("wireguard_public_key"), translate("Public Key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_public_key"), translate("Public Key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_secret_key"), translate("Private Key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_secret_key"), translate("Private Key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_preSharedKey"), translate("Pre shared key")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(Value, _n("wireguard_preSharedKey"), translate("Pre shared key")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(DynamicList, option_name("wireguard_local_address"), translate("Local Address")) -o:depends({ [option_name("protocol")] = "wireguard" }) +o = s:option(DynamicList, _n("wireguard_local_address"), translate("Local Address")) +o:depends({ [_n("protocol")] = "wireguard" }) -o = s:option(Value, option_name("wireguard_mtu"), translate("MTU")) +o = s:option(Value, _n("wireguard_mtu"), translate("MTU")) o.default = "1420" -o:depends({ [option_name("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "wireguard" }) if api.compare_versions(xray_version, ">=", "1.8.0") then - o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) + o:depends({ [_n("protocol")] = "wireguard" }) end -o = s:option(Value, option_name("wireguard_keepAlive"), translate("Keep Alive")) +o = s:option(Value, _n("wireguard_keepAlive"), translate("Keep Alive")) o.default = "0" -o:depends({ [option_name("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "wireguard" }) -- [[ RAW部分 ]]-- -- TCP伪装 -o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("tcp_guise"), translate("Camouflage Type")) o:value("none", "none") o:value("http", "http") -o:depends({ [option_name("transport")] = "raw" }) +o:depends({ [_n("transport")] = "raw" }) -- HTTP域名 -o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_host"), translate("HTTP Host")) +o:depends({ [_n("tcp_guise")] = "http" }) -- HTTP路径 -o = s:option(DynamicList, option_name("tcp_guise_http_path"), translate("HTTP Path")) +o = s:option(DynamicList, _n("tcp_guise_http_path"), translate("HTTP Path")) o.placeholder = "/" -o:depends({ [option_name("tcp_guise")] = "http" }) +o:depends({ [_n("tcp_guise")] = "http" }) -- [[ mKCP部分 ]]-- -o = s:option(ListValue, option_name("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +o = s:option(ListValue, _n("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_mtu"), translate("KCP MTU")) +o = s:option(Value, _n("mkcp_mtu"), translate("KCP MTU")) o.default = "1350" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_tti"), translate("KCP TTI")) +o = s:option(Value, _n("mkcp_tti"), translate("KCP TTI")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) +o = s:option(Value, _n("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) o.default = "5" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) +o = s:option(Value, _n("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Flag, option_name("mkcp_congestion"), translate("KCP Congestion")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Flag, _n("mkcp_congestion"), translate("KCP Congestion")) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_readBufferSize"), translate("KCP readBufferSize")) +o = s:option(Value, _n("mkcp_readBufferSize"), translate("KCP readBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) +o = s:option(Value, _n("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_seed"), translate("KCP Seed")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Value, _n("mkcp_seed"), translate("KCP Seed")) +o:depends({ [_n("transport")] = "mkcp" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)")) +o = s:option(Value, _n("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)")) o.datatype = "integer" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -- [[ HTTP/2部分 ]]-- -o = s:option(Value, option_name("h2_host"), translate("HTTP/2 Host")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path")) +o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "h2" }) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Flag, option_name("h2_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Flag, _n("h2_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_read_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("h2_read_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("h2_health_check")] = true }) +o:depends({ [_n("h2_health_check")] = true }) -o = s:option(Value, option_name("h2_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("h2_health_check_timeout"), translate("Health check timeout")) o.default = "15" -o:depends({ [option_name("h2_health_check")] = true }) +o:depends({ [_n("h2_health_check")] = true }) -- [[ DomainSocket部分 ]]-- -o = s:option(Value, option_name("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) -o:depends({ [option_name("transport")] = "ds" }) +o = s:option(Value, _n("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) +o:depends({ [_n("transport")] = "ds" }) -- [[ QUIC部分 ]]-- -o = s:option(ListValue, option_name("quic_security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("quic_security"), translate("Encrypt Method")) o:value("none") o:value("aes-128-gcm") o:value("chacha20-poly1305") -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(Value, option_name("quic_key"), translate("Encrypt Method") .. translate("Key")) -o:depends({ [option_name("transport")] = "quic" }) +o = s:option(Value, _n("quic_key"), translate("Encrypt Method") .. translate("Key")) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(ListValue, option_name("quic_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("quic_guise"), translate("Camouflage Type")) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(ListValue, option_name("grpc_mode"), "gRPC " .. translate("Transfer mode")) +o = s:option(ListValue, _n("grpc_mode"), "gRPC " .. translate("Transfer mode")) o:value("gun") o:value("multi") -o:depends({ [option_name("transport")] = "grpc" }) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("grpc_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Flag, _n("grpc_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Value, option_name("grpc_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("grpc_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("grpc_health_check_timeout"), translate("Health check timeout")) o.default = "20" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Flag, option_name("grpc_permit_without_stream"), translate("Permit without stream")) +o = s:option(Flag, _n("grpc_permit_without_stream"), translate("Permit without stream")) o.default = "0" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_initial_windows_size"), translate("Initial Windows Size")) +o = s:option(Value, _n("grpc_initial_windows_size"), translate("Initial Windows Size")) o.default = "0" -o:depends({ [option_name("transport")] = "grpc" }) +o:depends({ [_n("transport")] = "grpc" }) -- [[ HttpUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HttpUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HttpUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HttpUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HttpUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ XHTTP部分 ]]-- -o = s:option(ListValue, option_name("xhttp_mode"), "XHTTP " .. translate("Mode")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(ListValue, _n("xhttp_mode"), "XHTTP " .. translate("Mode")) +o:depends({ [_n("transport")] = "xhttp" }) o.default = "auto" o:value("auto") o:value("packet-up") o:value("stream-up") o:value("stream-one") -o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(Value, _n("xhttp_host"), translate("XHTTP Host")) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path")) +o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(TextValue, option_name("xhttp_extra"), translate("XHTTP Extra"), translate("An XHTTP extra object in raw json")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(TextValue, _n("xhttp_extra"), translate("XHTTP Extra"), translate("An XHTTP extra object in raw json")) +o:depends({ [_n("transport")] = "xhttp" }) o.rows = 15 o.wrap = "off" o.custom_write = function(self, section, value) @@ -618,62 +615,62 @@ o.validate = function(self, value) end -- [[ Mux.Cool ]]-- -o = s:option(Flag, option_name("mux"), "Mux", translate("Enable Mux.Cool")) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o = s:option(Flag, _n("mux"), "Mux", translate("Enable Mux.Cool")) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")) +o = s:option(Value, _n("mux_concurrency"), translate("Mux concurrency")) o.default = 8 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -- [[ XUDP Mux ]]-- -o = s:option(Flag, option_name("xmux"), "XUDP Mux") +o = s:option(Flag, _n("xmux"), "XUDP Mux") o.default = 1 -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "xtls-rprx-vision" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "xtls-rprx-vision" }) -o = s:option(Value, option_name("xudp_concurrency"), translate("XUDP Mux concurrency")) +o = s:option(Value, _n("xudp_concurrency"), translate("XUDP Mux concurrency")) o.default = 8 -o:depends({ [option_name("xmux")] = true }) +o:depends({ [_n("xmux")] = true }) --[[tcpMptcp]] -o = s:option(Flag, option_name("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration.")) +o = s:option(Flag, _n("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration.")) o.default = 0 -o = s:option(Flag, option_name("tcpNoDelay"), "tcpNoDelay") +o = s:option(Flag, _n("tcpNoDelay"), "tcpNoDelay") o.default = 0 -o = s:option(ListValue, option_name("chain_proxy"), translate("Chain Proxy")) +o = s:option(ListValue, _n("chain_proxy"), translate("Chain Proxy")) o:value("", translate("Close(Not use)")) o:value("1", translate("Preproxy Node")) o:value("2", translate("Landing Node")) -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - o:depends({ [option_name("protocol")] = v }) + o:depends({ [_n("protocol")] = v }) end end -o = s:option(ListValue, option_name("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "1" }) +o = s:option(ListValue, _n("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "1" }) -o = s:option(ListValue, option_name("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "2" }) +o = s:option(ListValue, _n("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "2" }) for k, v in pairs(nodes_table) do if v.type == "Xray" and v.id ~= arg[1] then - s.fields[option_name("preproxy_node")]:value(v.id, v.remark) - s.fields[option_name("to_node")]:value(v.id, v.remark) + s.fields[_n("preproxy_node")]:value(v.id, v.remark) + s.fields[_n("to_node")]:value(v.id, v.remark) end end -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - s.fields[option_name("tcpMptcp")]:depends({ [option_name("protocol")] = v }) - s.fields[option_name("tcpNoDelay")]:depends({ [option_name("protocol")] = v }) - s.fields[option_name("chain_proxy")]:depends({ [option_name("protocol")] = v }) + s.fields[_n("tcpMptcp")]:depends({ [_n("protocol")] = v }) + s.fields[_n("tcpNoDelay")]:depends({ [_n("protocol")] = v }) + s.fields[_n("chain_proxy")]:depends({ [_n("protocol")] = v }) end end diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 794bf1349a..d5eb0ed406 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -17,7 +17,7 @@ local type_name = "sing-box" local option_prefix = "singbox_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -35,7 +35,7 @@ local security_list = { "none", "auto", "aes-128-gcm", "chacha20-poly1305", "zer s.fields["type"]:value(type_name, "Sing-Box") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("socks", "Socks") o:value("http", "HTTP") o:value("shadowsocks", "Shadowsocks") @@ -60,9 +60,9 @@ end o:value("_shunt", translate("Shunt")) o:value("_iface", translate("Custom Interface")) -o = s:option(Value, option_name("iface"), translate("Interface")) +o = s:option(Value, _n("iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("protocol")] = "_iface" }) +o:depends({ [_n("protocol")] = "_iface" }) local nodes_table = {} local iface_table = {} @@ -94,11 +94,11 @@ end) -- [[ 分流模块 ]] if #nodes_table > 0 then - o = s:option(Flag, option_name("preproxy_enabled"), translate("Preproxy")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o = s:option(Flag, _n("preproxy_enabled"), translate("Preproxy")) + o:depends({ [_n("protocol")] = "_shunt" }) - o = s:option(ListValue, option_name("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) - o:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true }) + o = s:option(ListValue, _n("main_node"), string.format('%s', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including Default) has a separate switch that controls whether this rule uses the pre-proxy or not.")) + o:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true }) for k, v in pairs(socks_list) do o:value(v.id, v.remark) end @@ -108,16 +108,15 @@ if #nodes_table > 0 then for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end - o.default = "nil" end uci:foreach(appname, "shunt_rules", function(e) if e[".name"] and e.remarks then - o = s:option(ListValue, option_name(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) - o:value("nil", translate("Close")) + o = s:option(ListValue, _n(e[".name"]), string.format('* %s', api.url("shunt_rules", e[".name"]), e.remarks)) + o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) - o:depends({ [option_name("protocol")] = "_shunt" }) + o:depends({ [_n("protocol")] = "_shunt" }) if #nodes_table > 0 then for k, v in pairs(socks_list) do @@ -126,28 +125,27 @@ uci:foreach(appname, "shunt_rules", function(e) for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local pt = s:option(ListValue, option_name(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) - pt:value("nil", translate("Close")) + local pt = s:option(ListValue, _n(e[".name"] .. "_proxy_tag"), string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) + pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) - pt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - pt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name(e[".name"])] = v.id }) + pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id }) end end end end) -o = s:option(DummyValue, option_name("shunt_tips"), " ") +o = s:option(DummyValue, _n("shunt_tips"), " ") o.not_rewrite = true o.rawhtml = true o.cfgvalue = function(t, n) return string.format('%s', translate("No shunt rules? Click me to go to add.")) end -o:depends({ [option_name("protocol")] = "_shunt" }) +o:depends({ [_n("protocol")] = "_shunt" }) -local o = s:option(ListValue, option_name("default_node"), string.format('* %s', translate("Default"))) -o:depends({ [option_name("protocol")] = "_shunt" }) +local o = s:option(ListValue, _n("default_node"), string.format('* %s', translate("Default"))) +o:depends({ [_n("protocol")] = "_shunt" }) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -158,61 +156,60 @@ if #nodes_table > 0 then for k, v in pairs(iface_table) do o:value(v.id, v.remark) end - local dpt = s:option(ListValue, option_name("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) - dpt:value("nil", translate("Close")) + local dpt = s:option(ListValue, _n("default_proxy_tag"), string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + dpt:value("", translate("Close")) dpt:value("main", translate("Preproxy Node")) - dpt.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remark) - dpt:depends({ [option_name("protocol")] = "_shunt", [option_name("preproxy_enabled")] = true, [option_name("default_node")] = v.id }) + dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id }) end end -- [[ 分流模块 End ]] -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -local protocols = s.fields[option_name("protocol")].keylist +local protocols = s.fields[_n("protocol")].keylist if #protocols > 0 then for index, value in ipairs(protocols) do if not value:find("_") then - s.fields[option_name("address")]:depends({ [option_name("protocol")] = value }) - s.fields[option_name("port")]:depends({ [option_name("protocol")] = value }) + s.fields[_n("address")]:depends({ [_n("protocol")] = value }) + s.fields[_n("port")]:depends({ [_n("protocol")] = value }) end end end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "shadowsocksr" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocksr" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(ListValue, option_name("security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("security"), translate("Encrypt Method")) for a, t in ipairs(security_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_new_list) do o:value(t) end for a, t in ipairs(ss_method_old_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) if singbox_tags:find("with_shadowsocksr") then - o = s:option(ListValue, option_name("ssr_method"), translate("Encrypt Method")) + o = s:option(ListValue, _n("ssr_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_old_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) local ssr_protocol_list = { "origin", "verify_simple", "verify_deflate", "verify_sha1", "auth_simple", @@ -221,120 +218,120 @@ if singbox_tags:find("with_shadowsocksr") then "auth_chain_d", "auth_chain_e", "auth_chain_f" } - o = s:option(ListValue, option_name("ssr_protocol"), translate("Protocol")) + o = s:option(ListValue, _n("ssr_protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) - o = s:option(Value, option_name("ssr_protocol_param"), translate("Protocol_param")) - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o = s:option(Value, _n("ssr_protocol_param"), translate("Protocol_param")) + o:depends({ [_n("protocol")] = "shadowsocksr" }) local ssr_obfs_list = { "plain", "http_simple", "http_post", "random_head", "tls_simple", "tls1.0_session_auth", "tls1.2_ticket_auth" } - o = s:option(ListValue, option_name("ssr_obfs"), translate("Obfs")) + o = s:option(ListValue, _n("ssr_obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o:depends({ [_n("protocol")] = "shadowsocksr" }) - o = s:option(Value, option_name("ssr_obfs_param"), translate("Obfs_param")) - o:depends({ [option_name("protocol")] = "shadowsocksr" }) + o = s:option(Value, _n("ssr_obfs_param"), translate("Obfs_param")) + o:depends({ [_n("protocol")] = "shadowsocksr" }) end -o = s:option(Flag, option_name("uot"), translate("UDP over TCP")) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("uot"), translate("UDP over TCP")) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(Value, option_name("alter_id"), "Alter ID") +o = s:option(Value, _n("alter_id"), "Alter ID") o.datatype = "uinteger" o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Flag, option_name("global_padding"), "global_padding", translate("Protocol parameter. Will waste traffic randomly if enabled.")) +o = s:option(Flag, _n("global_padding"), "global_padding", translate("Protocol parameter. Will waste traffic randomly if enabled.")) o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(Flag, option_name("authenticated_length"), "authenticated_length", translate("Protocol parameter. Enable length block encryption.")) +o = s:option(Flag, _n("authenticated_length"), "authenticated_length", translate("Protocol parameter. Enable length block encryption.")) o.default = "0" -o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vmess" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true }) if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria_obfs"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_obfs"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(ListValue, option_name("hysteria_auth_type"), translate("Auth Type")) + o = s:option(ListValue, _n("hysteria_auth_type"), translate("Auth Type")) o:value("disable", translate("Disable")) o:value("string", translate("STRING")) o:value("base64", translate("BASE64")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "string"}) - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "base64"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "string"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "base64"}) - o = s:option(Value, option_name("hysteria_up_mbps"), translate("Max upload Mbps")) + o = s:option(Value, _n("hysteria_up_mbps"), translate("Max upload Mbps")) o.default = "10" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_down_mbps"), translate("Max download Mbps")) + o = s:option(Value, _n("hysteria_down_mbps"), translate("Max download Mbps")) o.default = "50" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window_conn"), translate("QUIC stream receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_conn"), translate("QUIC stream receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window"), translate("QUIC connection receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window"), translate("QUIC connection receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Flag, _n("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "hysteria" }) end if singbox_tags:find("with_quic") then - o = s:option(ListValue, option_name("tuic_congestion_control"), translate("Congestion control algorithm")) + o = s:option(ListValue, _n("tuic_congestion_control"), translate("Congestion control algorithm")) o.default = "cubic" o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(ListValue, option_name("tuic_udp_relay_mode"), translate("UDP relay mode")) + o = s:option(ListValue, _n("tuic_udp_relay_mode"), translate("UDP relay mode")) o.default = "native" o:value("native", translate("native")) o:value("quic", translate("QUIC")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) --[[ - o = s:option(Flag, option_name("tuic_udp_over_stream"), translate("UDP over stream")) - o:depends({ [option_name("protocol")] = "tuic" }) + o = s:option(Flag, _n("tuic_udp_over_stream"), translate("UDP over stream")) + o:depends({ [_n("protocol")] = "tuic" }) ]]-- - o = s:option(Flag, option_name("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) + o = s:option(Flag, _n("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_heartbeat"), translate("Heartbeat interval(second)")) + o = s:option(Value, _n("tuic_heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(ListValue, option_name("tuic_alpn"), translate("QUIC TLS ALPN")) + o = s:option(ListValue, _n("tuic_alpn"), translate("QUIC TLS ALPN")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -343,38 +340,38 @@ if singbox_tags:find("with_quic") then o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) end if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria2_up_mbps"), translate("Max upload Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_down_mbps"), translate("Max download Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_down_mbps"), translate("Max download Mbps")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(ListValue, option_name("hysteria2_obfs_type"), translate("Obfs Type")) + o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_obfs_password"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria2"}) + o:depends({ [_n("protocol")] = "hysteria2"}) end -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "default" o:value("default", translate("Default")) o:value("h3") @@ -383,36 +380,36 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) -o:depends({ [option_name("protocol")] = "hysteria"}) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) +o:depends({ [_n("protocol")] = "hysteria"}) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true }) -o:depends({ [option_name("protocol")] = "hysteria"}) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("tls")] = true }) +o:depends({ [_n("protocol")] = "hysteria"}) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) if singbox_tags:find("with_ech") then - o = s:option(Flag, option_name("ech"), translate("ECH")) + o = s:option(Flag, _n("ech"), translate("ECH")) o.default = "0" - o:depends({ [option_name("tls")] = true, [option_name("flow")] = "", [option_name("reality")] = false }) - o:depends({ [option_name("protocol")] = "tuic" }) - o:depends({ [option_name("protocol")] = "hysteria" }) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("tls")] = true, [_n("flow")] = "", [_n("reality")] = false }) + o:depends({ [_n("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(TextValue, option_name("ech_config"), translate("ECH Config")) + o = s:option(TextValue, _n("ech_config"), translate("ECH Config")) o.default = "" o.rows = 5 o.wrap = "off" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) o.validate = function(self, value) value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n") value = value:gsub("^%s*\n", "") @@ -422,21 +419,21 @@ if singbox_tags:find("with_ech") then return value end - o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) + o = s:option(Flag, _n("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) - o = s:option(Flag, option_name("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) + o = s:option(Flag, _n("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) end if singbox_tags:find("with_utls") then - o = s:option(Flag, option_name("utls"), translate("uTLS")) + o = s:option(Flag, _n("utls"), translate("uTLS")) o.default = "0" - o:depends({ [option_name("tls")] = true }) + o:depends({ [_n("tls")] = true }) - o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print")) + o = s:option(ListValue, _n("fingerprint"), translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -448,25 +445,25 @@ if singbox_tags:find("with_utls") then o:value("random") -- o:value("randomized") o.default = "chrome" - o:depends({ [option_name("tls")] = true, [option_name("utls")] = true }) + o:depends({ [_n("tls")] = true, [_n("utls")] = true }) -- [[ REALITY部分 ]] -- - o = s:option(Flag, option_name("reality"), translate("REALITY")) + o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 - o:depends({ [option_name("protocol")] = "vless", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "vmess", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "socks", [option_name("utls")] = true }) - o:depends({ [option_name("protocol")] = "trojan", [option_name("utls")] = true }) + o:depends({ [_n("protocol")] = "vless", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "vmess", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "shadowsocks", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "socks", [_n("utls")] = true }) + o:depends({ [_n("protocol")] = "trojan", [_n("utls")] = true }) - o = s:option(Value, option_name("reality_publicKey"), translate("Public Key")) - o:depends({ [option_name("utls")] = true, [option_name("reality")] = true }) + o = s:option(Value, _n("reality_publicKey"), translate("Public Key")) + o:depends({ [_n("utls")] = true, [_n("reality")] = true }) - o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) - o:depends({ [option_name("utls")] = true, [option_name("reality")] = true }) + o = s:option(Value, _n("reality_shortId"), translate("Short Id")) + o:depends({ [_n("utls")] = true, [_n("reality")] = true }) end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("tcp", "TCP") o:value("http", "HTTP") o:value("ws", "WebSocket") @@ -478,158 +475,158 @@ if singbox_tags:find("with_grpc") then o:value("grpc", "gRPC") else o:value("grpc", "gRPC-lite") end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) if singbox_tags:find("with_wireguard") then - o = s:option(Value, option_name("wireguard_public_key"), translate("Public Key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_public_key"), translate("Public Key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_secret_key"), translate("Private Key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_secret_key"), translate("Private Key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_preSharedKey"), translate("Pre shared key")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_preSharedKey"), translate("Pre shared key")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(DynamicList, option_name("wireguard_local_address"), translate("Local Address")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(DynamicList, _n("wireguard_local_address"), translate("Local Address")) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_mtu"), translate("MTU")) + o = s:option(Value, _n("wireguard_mtu"), translate("MTU")) o.default = "1420" - o:depends({ [option_name("protocol")] = "wireguard" }) + o:depends({ [_n("protocol")] = "wireguard" }) - o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) - o:depends({ [option_name("protocol")] = "wireguard" }) + o = s:option(Value, _n("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) + o:depends({ [_n("protocol")] = "wireguard" }) end -- [[ HTTP部分 ]]-- -o = s:option(Value, option_name("http_host"), translate("HTTP Host")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_host"), translate("HTTP Host")) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_path"), translate("HTTP Path")) +o = s:option(Value, _n("http_path"), translate("HTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "http" }) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Flag, option_name("http_h2_health_check"), translate("Health check")) -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http" }) +o = s:option(Flag, _n("http_h2_health_check"), translate("Health check")) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_h2_read_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("http_h2_read_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http", [option_name("http_h2_health_check")] = true }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http", [_n("http_h2_health_check")] = true }) -o = s:option(Value, option_name("http_h2_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("http_h2_health_check_timeout"), translate("Health check timeout")) o.default = "15" -o:depends({ [option_name("tls")] = true, [option_name("transport")] = "http", [option_name("http_h2_health_check")] = true }) +o:depends({ [_n("tls")] = true, [_n("transport")] = "http", [_n("http_h2_health_check")] = true }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "ws" }) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Flag, option_name("ws_enableEarlyData"), translate("Enable early data")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Flag, _n("ws_enableEarlyData"), translate("Enable early data")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_maxEarlyData"), translate("Early data length")) +o = s:option(Value, _n("ws_maxEarlyData"), translate("Early data length")) o.default = "1024" -o:depends({ [option_name("ws_enableEarlyData")] = true }) +o:depends({ [_n("ws_enableEarlyData")] = true }) -o = s:option(Value, option_name("ws_earlyDataHeaderName"), translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol")) -o:depends({ [option_name("ws_enableEarlyData")] = true }) +o = s:option(Value, _n("ws_earlyDataHeaderName"), translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol")) +o:depends({ [_n("ws_enableEarlyData")] = true }) -- [[ HTTPUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HTTPUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HTTPUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("grpc_health_check"), translate("Health check")) -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Flag, _n("grpc_health_check"), translate("Health check")) +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Value, option_name("grpc_idle_timeout"), translate("Idle timeout")) +o = s:option(Value, _n("grpc_idle_timeout"), translate("Idle timeout")) o.default = "10" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Value, option_name("grpc_health_check_timeout"), translate("Health check timeout")) +o = s:option(Value, _n("grpc_health_check_timeout"), translate("Health check timeout")) o.default = "20" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -o = s:option(Flag, option_name("grpc_permit_without_stream"), translate("Permit without stream")) +o = s:option(Flag, _n("grpc_permit_without_stream"), translate("Permit without stream")) o.default = "0" -o:depends({ [option_name("grpc_health_check")] = true }) +o:depends({ [_n("grpc_health_check")] = true }) -- [[ Mux ]]-- -o = s:option(Flag, option_name("mux"), translate("Mux")) +o = s:option(Flag, _n("mux"), translate("Mux")) o.rmempty = false -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("uot")] = "" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("uot")] = "" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("mux_type"), translate("Mux")) +o = s:option(ListValue, _n("mux_type"), translate("Mux")) o:value("smux") o:value("yamux") o:value("h2mux") -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")) +o = s:option(Value, _n("mux_concurrency"), translate("Mux concurrency")) o.default = 4 -o:depends({ [option_name("mux")] = true, [option_name("tcpbrutal")] = false }) +o:depends({ [_n("mux")] = true, [_n("tcpbrutal")] = false }) -o = s:option(Flag, option_name("mux_padding"), translate("Padding")) +o = s:option(Flag, _n("mux_padding"), translate("Padding")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -- [[ TCP Brutal ]]-- -o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o = s:option(Flag, _n("tcpbrutal"), translate("TCP Brutal")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("tcpbrutal_up_mbps"), translate("Max upload Mbps")) o.default = "10" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("tcpbrutal_down_mbps"), translate("Max download Mbps")) o.default = "50" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Flag, option_name("shadowtls"), "ShadowTLS") +o = s:option(Flag, _n("shadowtls"), "ShadowTLS") o.default = 0 -o:depends({ [option_name("protocol")] = "vmess", [option_name("tls")] = false }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("tls")] = false }) +o:depends({ [_n("protocol")] = "vmess", [_n("tls")] = false }) +o:depends({ [_n("protocol")] = "shadowsocks", [_n("tls")] = false }) -o = s:option(ListValue, option_name("shadowtls_version"), "ShadowTLS " .. translate("Version")) +o = s:option(ListValue, _n("shadowtls_version"), "ShadowTLS " .. translate("Version")) o.default = "1" o:value("1", "ShadowTLS v1") o:value("2", "ShadowTLS v2") o:value("3", "ShadowTLS v3") -o:depends({ [option_name("shadowtls")] = true }) +o:depends({ [_n("shadowtls")] = true }) -o = s:option(Value, option_name("shadowtls_password"), "ShadowTLS " .. translate("Password")) +o = s:option(Value, _n("shadowtls_password"), "ShadowTLS " .. translate("Password")) o.password = true -o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_version")] = "2" }) -o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_version")] = "3" }) +o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_version")] = "2" }) +o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_version")] = "3" }) -o = s:option(Value, option_name("shadowtls_serverName"), "ShadowTLS " .. translate("Domain")) -o:depends({ [option_name("shadowtls")] = true }) +o = s:option(Value, _n("shadowtls_serverName"), "ShadowTLS " .. translate("Domain")) +o:depends({ [_n("shadowtls")] = true }) if singbox_tags:find("with_utls") then - o = s:option(Flag, option_name("shadowtls_utls"), "ShadowTLS " .. translate("uTLS")) + o = s:option(Flag, _n("shadowtls_utls"), "ShadowTLS " .. translate("uTLS")) o.default = "0" - o:depends({ [option_name("shadowtls")] = true }) + o:depends({ [_n("shadowtls")] = true }) - o = s:option(ListValue, option_name("shadowtls_fingerprint"), "ShadowTLS " .. translate("Finger Print")) + o = s:option(ListValue, _n("shadowtls_fingerprint"), "ShadowTLS " .. translate("Finger Print")) o:value("chrome") o:value("firefox") o:value("edge") @@ -641,62 +638,62 @@ if singbox_tags:find("with_utls") then o:value("random") -- o:value("randomized") o.default = "chrome" - o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_utls")] = true }) + o:depends({ [_n("shadowtls")] = true, [_n("shadowtls_utls")] = true }) end -- [[ SIP003 plugin ]]-- -o = s:option(Flag, option_name("plugin_enabled"), translate("plugin")) +o = s:option(Flag, _n("plugin_enabled"), translate("plugin")) o.default = 0 -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("plugin"), "SIP003 " .. translate("plugin")) +o = s:option(ListValue, _n("plugin"), "SIP003 " .. translate("plugin")) o.default = "obfs-local" -o:depends({ [option_name("plugin_enabled")] = true }) +o:depends({ [_n("plugin_enabled")] = true }) o:value("obfs-local") o:value("v2ray-plugin") -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin_enabled")] = true }) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin_enabled")] = true }) -o = s:option(ListValue, option_name("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect.")) +o = s:option(ListValue, _n("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect.")) o.default = "" o:value("", translate("Auto")) o:value("prefer_ipv4", translate("Prefer IPv4")) o:value("prefer_ipv6", translate("Prefer IPv6")) o:value("ipv4_only", translate("IPv4 Only")) o:value("ipv6_only", translate("IPv6 Only")) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "shadowsocksr" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "wireguard" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocksr" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "wireguard" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) -o = s:option(ListValue, option_name("chain_proxy"), translate("Chain Proxy")) +o = s:option(ListValue, _n("chain_proxy"), translate("Chain Proxy")) o:value("", translate("Close(Not use)")) o:value("1", translate("Preproxy Node")) o:value("2", translate("Landing Node")) -for i, v in ipairs(s.fields[option_name("protocol")].keylist) do +for i, v in ipairs(s.fields[_n("protocol")].keylist) do if not v:find("_") then - o:depends({ [option_name("protocol")] = v }) + o:depends({ [_n("protocol")] = v }) end end -o = s:option(ListValue, option_name("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "1" }) +o = s:option(ListValue, _n("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "1" }) -o = s:option(ListValue, option_name("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) -o:depends({ [option_name("chain_proxy")] = "2" }) +o = s:option(ListValue, _n("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) +o:depends({ [_n("chain_proxy")] = "2" }) for k, v in pairs(nodes_table) do if v.type == "sing-box" and v.id ~= arg[1] then - s.fields[option_name("preproxy_node")]:value(v.id, v.remark) - s.fields[option_name("to_node")]:value(v.id, v.remark) + s.fields[_n("preproxy_node")]:value(v.id, v.remark) + s.fields[_n("to_node")]:value(v.id, v.remark) end end diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua index 089e1ab70c..d4d8cda89f 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss-rust.lua @@ -10,7 +10,7 @@ local type_name = "SS-Rust" local option_prefix = "ssrust_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -24,34 +24,34 @@ local ssrust_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Rust")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(Value, option_name("method"), translate("Encrypt Method")) +o = s:option(Value, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssrust_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(ListValue, option_name("plugin"), translate("plugin")) +o = s:option(ListValue, _n("plugin"), translate("plugin")) o:value("none", translate("none")) if api.is_finded("xray-plugin") then o:value("xray-plugin") end if api.is_finded("v2ray-plugin") then o:value("v2ray-plugin") end if api.is_finded("obfs-local") then o:value("obfs-local") end -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin")] = "xray-plugin"}) -o:depends({ [option_name("plugin")] = "v2ray-plugin"}) -o:depends({ [option_name("plugin")] = "obfs-local"}) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin")] = "xray-plugin"}) +o:depends({ [_n("plugin")] = "v2ray-plugin"}) +o:depends({ [_n("plugin")] = "obfs-local"}) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua index af5292b4aa..1ccfd8e9c9 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ss.lua @@ -10,7 +10,7 @@ local type_name = "SS" local option_prefix = "ss_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -25,34 +25,34 @@ local ss_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Libev")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(Value, option_name("method"), translate("Encrypt Method")) +o = s:option(Value, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ss_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(ListValue, option_name("plugin"), translate("plugin")) +o = s:option(ListValue, _n("plugin"), translate("plugin")) o:value("none", translate("none")) if api.is_finded("xray-plugin") then o:value("xray-plugin") end if api.is_finded("v2ray-plugin") then o:value("v2ray-plugin") end if api.is_finded("obfs-local") then o:value("obfs-local") end -o = s:option(Value, option_name("plugin_opts"), translate("opts")) -o:depends({ [option_name("plugin")] = "xray-plugin"}) -o:depends({ [option_name("plugin")] = "v2ray-plugin"}) -o:depends({ [option_name("plugin")] = "obfs-local"}) +o = s:option(Value, _n("plugin_opts"), translate("opts")) +o:depends({ [_n("plugin")] = "xray-plugin"}) +o:depends({ [_n("plugin")] = "v2ray-plugin"}) +o:depends({ [_n("plugin")] = "obfs-local"}) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua index 10dc24e405..4c65605854 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ssr.lua @@ -10,7 +10,7 @@ local type_name = "SSR" local option_prefix = "ssr_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -37,32 +37,32 @@ local ssr_obfs_list = { s.fields["type"]:value(type_name, translate("ShadowsocksR Libev")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssr_encrypt_method_list) do o:value(t) end -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end -o = s:option(Value, option_name("protocol_param"), translate("Protocol_param")) +o = s:option(Value, _n("protocol_param"), translate("Protocol_param")) -o = s:option(ListValue, option_name("obfs"), translate("Obfs")) +o = s:option(ListValue, _n("obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end -o = s:option(Value, option_name("obfs_param"), translate("Obfs_param")) +o = s:option(Value, _n("obfs_param"), translate("Obfs_param")) -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua index 9377046e57..20ffce4030 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/trojan-plus.lua @@ -10,7 +10,7 @@ local type_name = "Trojan-Plus" local option_prefix = "trojan_plus_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,19 +18,19 @@ end s.fields["type"]:value(type_name, "Trojan-Plus") -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) +o = s:option(ListValue, _n("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required")) o:value("false") o:value("true") -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then @@ -42,15 +42,15 @@ o.validate = function(self, value, t) end end -o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) +o = s:option(Flag, _n("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("tls_serverName"), translate("Domain")) -o:depends({ [option_name("tls")] = true }) +o = s:option(Value, _n("tls_serverName"), translate("Domain")) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket")) +o = s:option(Flag, _n("tls_sessionTicket"), translate("Session Ticket")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua index 1f77044039..ba3753d73e 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/client/type/tuic.lua @@ -10,7 +10,7 @@ local type_name = "TUIC" local option_prefix = "tuic_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,16 +18,16 @@ end s.fields["type"]:value(type_name, translate("TUIC")) -o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)")) +o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) -o = s:option(Value, option_name("port"), translate("Port")) +o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, option_name("uuid"), translate("ID")) +o = s:option(Value, _n("uuid"), translate("ID")) o.password = true -- Tuic Password for remote server connect -o = s:option(Value, option_name("password"), translate("TUIC User Password For Connect Remote Server")) +o = s:option(Value, _n("password"), translate("TUIC User Password For Connect Remote Server")) o.password = true o.rmempty = true o.default = "" @@ -35,32 +35,32 @@ o.rewrite_option = o.option --[[ -- Tuic username for local socks connect -o = s:option(Value, option_name("socks_username"), translate("TUIC UserName For Local Socks")) +o = s:option(Value, _n("socks_username"), translate("TUIC UserName For Local Socks")) o.rmempty = true o.default = "" o.rewrite_option = o.option -- Tuic Password for local socks connect -o = s:option(Value, option_name("socks_password"), translate("TUIC Password For Local Socks")) +o = s:option(Value, _n("socks_password"), translate("TUIC Password For Local Socks")) o.password = true o.rmempty = true o.default = "" o.rewrite_option = o.option --]] -o = s:option(Value, option_name("ip"), translate("Set the TUIC proxy server ip address")) +o = s:option(Value, _n("ip"), translate("Set the TUIC proxy server ip address")) o.datatype = "ipaddr" o.rmempty = true o.rewrite_option = o.option -o = s:option(ListValue, option_name("udp_relay_mode"), translate("UDP relay mode")) +o = s:option(ListValue, _n("udp_relay_mode"), translate("UDP relay mode")) o:value("native", translate("native")) o:value("quic", translate("QUIC")) o.default = "native" o.rmempty = true o.rewrite_option = o.option -o = s:option(ListValue, option_name("congestion_control"), translate("Congestion control algorithm")) +o = s:option(ListValue, _n("congestion_control"), translate("Congestion control algorithm")) o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) @@ -68,65 +68,65 @@ o.default = "cubic" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("heartbeat"), translate("Heartbeat interval(second)")) +o = s:option(Value, _n("heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("timeout"), translate("Timeout for establishing a connection to server(second)")) +o = s:option(Value, _n("timeout"), translate("Timeout for establishing a connection to server(second)")) o.datatype = "uinteger" o.default = "8" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("gc_interval"), translate("Garbage collection interval(second)")) +o = s:option(Value, _n("gc_interval"), translate("Garbage collection interval(second)")) o.datatype = "uinteger" o.default = "3" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("gc_lifetime"), translate("Garbage collection lifetime(second)")) +o = s:option(Value, _n("gc_lifetime"), translate("Garbage collection lifetime(second)")) o.datatype = "uinteger" o.default = "15" o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("send_window"), translate("TUIC send window")) +o = s:option(Value, _n("send_window"), translate("TUIC send window")) o.datatype = "uinteger" o.default = 20971520 o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("receive_window"), translate("TUIC receive window")) +o = s:option(Value, _n("receive_window"), translate("TUIC receive window")) o.datatype = "uinteger" o.default = 10485760 o.rmempty = true o.rewrite_option = o.option -o = s:option(Value, option_name("max_package_size"), translate("TUIC Maximum packet size the socks5 server can receive from external, in bytes")) +o = s:option(Value, _n("max_package_size"), translate("TUIC Maximum packet size the socks5 server can receive from external, in bytes")) o.datatype = "uinteger" o.default = 1500 o.rmempty = true o.rewrite_option = o.option --Tuic settings for the local inbound socks5 server -o = s:option(Flag, option_name("dual_stack"), translate("Set if the listening socket should be dual-stack")) +o = s:option(Flag, _n("dual_stack"), translate("Set if the listening socket should be dual-stack")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(Flag, option_name("disable_sni"), translate("Disable SNI")) +o = s:option(Flag, _n("disable_sni"), translate("Disable SNI")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(Flag, option_name("zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) +o = s:option(Flag, _n("zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 o.rmempty = true o.rewrite_option = o.option -o = s:option(DynamicList, option_name("tls_alpn"), translate("TLS ALPN")) +o = s:option(DynamicList, _n("tls_alpn"), translate("TLS ALPN")) o.rmempty = true o.rewrite_option = o.option diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua index ced7374418..81c8c3fcc2 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua @@ -10,7 +10,7 @@ local type_name = "Hysteria2" local option_prefix = "hysteria2_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,31 +18,31 @@ end s.fields["type"]:value(type_name, "Hysteria2") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("obfs"), translate("Obfs Password")) +o = s:option(Value, _n("obfs"), translate("Obfs Password")) o.rewrite_option = o.option -o = s:option(Value, option_name("auth_password"), translate("Auth Password")) +o = s:option(Value, _n("auth_password"), translate("Auth Password")) o.password = true o.rewrite_option = o.option -o = s:option(Flag, option_name("udp"), translate("UDP")) +o = s:option(Flag, _n("udp"), translate("UDP")) o.default = "1" o.rewrite_option = o.option -o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("up_mbps"), translate("Max upload Mbps")) o.rewrite_option = o.option -o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("down_mbps"), translate("Max download Mbps")) o.rewrite_option = o.option -o = s:option(Flag, option_name("ignoreClientBandwidth"), translate("ignoreClientBandwidth")) +o = s:option(Flag, _n("ignoreClientBandwidth"), translate("ignoreClientBandwidth")) o.default = "0" o.rewrite_option = o.option -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" o.validate = function(self, value, t) if value and value ~= "" then @@ -55,7 +55,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" o.validate = function(self, value, t) if value and value ~= "" then @@ -68,7 +68,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua index ac0c315450..2de2865f3d 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua @@ -10,7 +10,7 @@ local type_name = "Xray" local option_prefix = "xray_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -26,7 +26,7 @@ local header_type_list = { s.fields["type"]:value(type_name, "Xray") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("vmess", "Vmess") o:value("vless", "VLESS") o:value("http", "HTTP") @@ -35,91 +35,91 @@ o:value("shadowsocks", "Shadowsocks") o:value("trojan", "Trojan") o:value("dokodemo-door", "dokodemo-door") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end end return value end -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("d_protocol"), translate("Destination protocol")) +o = s:option(ListValue, _n("d_protocol"), translate("Destination protocol")) o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("d_address"), translate("Destination address")) -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o = s:option(Value, _n("d_address"), translate("Destination address")) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("d_port"), translate("Destination port")) +o = s:option(Value, _n("d_port"), translate("Destination port")) o.datatype = "port" -o:depends({ [option_name("protocol")] = "dokodemo-door" }) +o:depends({ [_n("protocol")] = "dokodemo-door" }) -o = s:option(Value, option_name("decryption"), translate("Encrypt Method")) +o = s:option(Value, _n("decryption"), translate("Encrypt Method")) o.default = "none" -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("x_ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("x_ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(x_ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("iv_check"), translate("IV Check")) -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o = s:option(Flag, _n("iv_check"), translate("IV Check")) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(ListValue, option_name("ss_network"), translate("Transport")) +o = s:option(ListValue, _n("ss_network"), translate("Transport")) o.default = "tcp,udp" o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(Flag, option_name("udp_forward"), translate("UDP Forward")) +o = s:option(Flag, _n("udp_forward"), translate("UDP Forward")) o.default = "1" o.rmempty = false -o:depends({ [option_name("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "socks" }) -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "raw" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then - local reality = s.fields[option_name("reality")] and s.fields[option_name("reality")]:formvalue(t) or nil + local reality = s.fields[_n("reality")] and s.fields[_n("reality")]:formvalue(t) or nil if reality and reality == "1" then return value end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -127,32 +127,32 @@ o.validate = function(self, value, t) return value end end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ REALITY部分 ]] -- -o = s:option(Flag, option_name("reality"), translate("REALITY")) +o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Value, option_name("reality_private_key"), translate("Private Key")) -o:depends({ [option_name("reality")] = true }) +o = s:option(Value, _n("reality_private_key"), translate("Private Key")) +o:depends({ [_n("reality")] = true }) -o = s:option(DynamicList, option_name("reality_shortId"), translate("Short Id")) -o:depends({ [option_name("reality")] = true }) +o = s:option(DynamicList, _n("reality_shortId"), translate("Short Id")) +o:depends({ [_n("reality")] = true }) -o = s:option(Value, option_name("reality_dest"), translate("Dest")) +o = s:option(Value, _n("reality_dest"), translate("Dest")) o.default = "google.com:443" -o:depends({ [option_name("reality")] = true }) +o:depends({ [_n("reality")] = true }) -o = s:option(Value, option_name("reality_serverNames"), translate("serverNames")) -o:depends({ [option_name("reality")] = true }) +o = s:option(Value, _n("reality_serverNames"), translate("serverNames")) +o:depends({ [_n("reality")] = true }) -o = s:option(ListValue, option_name("alpn"), translate("alpn")) +o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "h2,http/1.1" o:value("h3") o:value("h2") @@ -160,18 +160,18 @@ o:value("h3,h2") o:value("http/1.1") o:value("h2,http/1.1") o:value("h3,h2,http/1.1") -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) --- o = s:option(Value, option_name("minversion"), translate("minversion")) +-- o = s:option(Value, _n("minversion"), translate("minversion")) -- o.default = "1.3" -- o:value("1.3") ---o:depends({ [option_name("tls")] = true }) +--o:depends({ [_n("tls")] = true }) -- [[ TLS部分 ]] -- -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -183,9 +183,9 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -197,7 +197,7 @@ o.validate = function(self, value, t) return nil end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("raw", "RAW") o:value("mkcp", "mKCP") o:value("ws", "WebSocket") @@ -207,157 +207,157 @@ o:value("quic", "QUIC") o:value("grpc", "gRPC") o:value("httpupgrade", "HttpUpgrade") o:value("xhttp", "XHTTP") -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) +o:depends({ [_n("transport")] = "ws" }) -- [[ HttpUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HttpUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HttpUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HttpUpgrade Path")) +o = s:option(Value, _n("httpupgrade_path"), translate("HttpUpgrade Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "httpupgrade" }) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ SplitHTTP部分 ]]-- -o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) -o:depends({ [option_name("transport")] = "xhttp" }) +o = s:option(Value, _n("xhttp_host"), translate("XHTTP Host")) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path")) +o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_maxuploadsize"), translate("maxUploadSize")) +o = s:option(Value, _n("xhttp_maxuploadsize"), translate("maxUploadSize")) o.default = "1000000" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(Value, option_name("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads")) +o = s:option(Value, _n("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads")) o.default = "10" -o:depends({ [option_name("transport")] = "xhttp" }) +o:depends({ [_n("transport")] = "xhttp" }) -- [[ HTTP/2部分 ]]-- -o = s:option(Value, option_name("h2_host"), translate("HTTP/2 Host")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host")) +o:depends({ [_n("transport")] = "h2" }) -o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path")) -o:depends({ [option_name("transport")] = "h2" }) +o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path")) +o:depends({ [_n("transport")] = "h2" }) -- [[ TCP部分 ]]-- -- TCP伪装 -o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("tcp_guise"), translate("Camouflage Type")) o:value("none", "none") o:value("http", "http") -o:depends({ [option_name("transport")] = "raw" }) +o:depends({ [_n("transport")] = "raw" }) -- HTTP域名 -o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_host"), translate("HTTP Host")) +o:depends({ [_n("tcp_guise")] = "http" }) -- HTTP路径 -o = s:option(DynamicList, option_name("tcp_guise_http_path"), translate("HTTP Path")) -o:depends({ [option_name("tcp_guise")] = "http" }) +o = s:option(DynamicList, _n("tcp_guise_http_path"), translate("HTTP Path")) +o:depends({ [_n("tcp_guise")] = "http" }) -- [[ mKCP部分 ]]-- -o = s:option(ListValue, option_name("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +o = s:option(ListValue, _n("mkcp_guise"), translate("Camouflage Type"), translate('
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_mtu"), translate("KCP MTU")) +o = s:option(Value, _n("mkcp_mtu"), translate("KCP MTU")) o.default = "1350" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_tti"), translate("KCP TTI")) +o = s:option(Value, _n("mkcp_tti"), translate("KCP TTI")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) +o = s:option(Value, _n("mkcp_uplinkCapacity"), translate("KCP uplinkCapacity")) o.default = "5" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) +o = s:option(Value, _n("mkcp_downlinkCapacity"), translate("KCP downlinkCapacity")) o.default = "20" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Flag, option_name("mkcp_congestion"), translate("KCP Congestion")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Flag, _n("mkcp_congestion"), translate("KCP Congestion")) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_readBufferSize"), translate("KCP readBufferSize")) +o = s:option(Value, _n("mkcp_readBufferSize"), translate("KCP readBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) +o = s:option(Value, _n("mkcp_writeBufferSize"), translate("KCP writeBufferSize")) o.default = "1" -o:depends({ [option_name("transport")] = "mkcp" }) +o:depends({ [_n("transport")] = "mkcp" }) -o = s:option(Value, option_name("mkcp_seed"), translate("KCP Seed")) -o:depends({ [option_name("transport")] = "mkcp" }) +o = s:option(Value, _n("mkcp_seed"), translate("KCP Seed")) +o:depends({ [_n("transport")] = "mkcp" }) -- [[ DomainSocket部分 ]]-- -o = s:option(Value, option_name("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) -o:depends({ [option_name("transport")] = "ds" }) +o = s:option(Value, _n("ds_path"), "Path", translate("A legal file path. This file must not exist before running.")) +o:depends({ [_n("transport")] = "ds" }) -- [[ QUIC部分 ]]-- -o = s:option(ListValue, option_name("quic_security"), translate("Encrypt Method")) +o = s:option(ListValue, _n("quic_security"), translate("Encrypt Method")) o:value("none") o:value("aes-128-gcm") o:value("chacha20-poly1305") -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(Value, option_name("quic_key"), translate("Encrypt Method") .. translate("Key")) -o:depends({ [option_name("transport")] = "quic" }) +o = s:option(Value, _n("quic_key"), translate("Encrypt Method") .. translate("Key")) +o:depends({ [_n("transport")] = "quic" }) -o = s:option(ListValue, option_name("quic_guise"), translate("Camouflage Type")) +o = s:option(ListValue, _n("quic_guise"), translate("Camouflage Type")) for a, t in ipairs(header_type_list) do o:value(t) end -o:depends({ [option_name("transport")] = "quic" }) +o:depends({ [_n("transport")] = "quic" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -o = s:option(Flag, option_name("acceptProxyProtocol"), translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used.")) +o = s:option(Flag, _n("acceptProxyProtocol"), translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used.")) o.default = "0" -- [[ Fallback部分 ]]-- -o = s:option(Flag, option_name("fallback"), translate("Fallback")) -o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "raw" }) -o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "raw" }) +o = s:option(Flag, _n("fallback"), translate("Fallback")) +o:depends({ [_n("protocol")] = "vless", [_n("transport")] = "raw" }) +o:depends({ [_n("protocol")] = "trojan", [_n("transport")] = "raw" }) --[[ -o = s:option(Value, option_name("fallback_alpn"), "Fallback alpn") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_alpn"), "Fallback alpn") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_path"), "Fallback path") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_path"), "Fallback path") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_dest"), "Fallback dest") -o:depends({ [option_name("fallback")] = true }) +o = s:option(Value, _n("fallback_dest"), "Fallback dest") +o:depends({ [_n("fallback")] = true }) -o = s:option(Value, option_name("fallback_xver"), "Fallback xver") +o = s:option(Value, _n("fallback_xver"), "Fallback xver") o.default = 0 -o:depends({ [option_name("fallback")] = true }) +o:depends({ [_n("fallback")] = true }) ]]-- -o = s:option(DynamicList, option_name("fallback_list"), "Fallback", translate("dest,path")) -o:depends({ [option_name("fallback")] = true }) +o = s:option(DynamicList, _n("fallback_list"), "Fallback", translate("dest,path")) +o:depends({ [_n("fallback")] = true }) -o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o = s:option(Flag, _n("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o.default = "0" -o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) +o = s:option(Flag, _n("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) o.default = "0" local nodes_table = {} @@ -370,46 +370,45 @@ for k, e in ipairs(api.get_valid_nodes()) do end end -o = s:option(ListValue, option_name("outbound_node"), translate("outbound node")) -o:value("nil", translate("Close")) +o = s:option(ListValue, _n("outbound_node"), translate("outbound node")) +o:value("", translate("Close")) o:value("_socks", translate("Custom Socks")) o:value("_http", translate("Custom HTTP")) o:value("_iface", translate("Custom Interface")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end -o.default = "nil" -o = s:option(Value, option_name("outbound_node_address"), translate("Address (Support Domain Name)")) -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o = s:option(Value, _n("outbound_node_address"), translate("Address (Support Domain Name)")) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_port"), translate("Port")) +o = s:option(Value, _n("outbound_node_port"), translate("Port")) o.datatype = "port" -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_username"), translate("Username")) -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o = s:option(Value, _n("outbound_node_username"), translate("Username")) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_password"), translate("Password")) +o = s:option(Value, _n("outbound_node_password"), translate("Password")) o.password = true -o:depends({ [option_name("outbound_node")] = "_socks"}) -o:depends({ [option_name("outbound_node")] = "_http"}) +o:depends({ [_n("outbound_node")] = "_socks"}) +o:depends({ [_n("outbound_node")] = "_http"}) -o = s:option(Value, option_name("outbound_node_iface"), translate("Interface")) +o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("outbound_node")] = "_iface"}) +o:depends({ [_n("outbound_node")] = "_iface"}) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "warning" o:value("debug") o:value("info") o:value("warning") o:value("error") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua index 638460af85..61856ca1e1 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua @@ -14,7 +14,7 @@ local type_name = "sing-box" local option_prefix = "singbox_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -27,7 +27,7 @@ local ss_method_list = { s.fields["type"]:value(type_name, "Sing-Box") -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) o:value("mixed", "Mixed") o:value("socks", "Socks") o:value("http", "HTTP") @@ -47,166 +47,166 @@ if singbox_tags:find("with_quic") then end o:value("direct", "Direct") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end end return value end -o:depends({ [option_name("protocol")] = "mixed" }) -o:depends({ [option_name("protocol")] = "socks" }) -o:depends({ [option_name("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "mixed" }) +o:depends({ [_n("protocol")] = "socks" }) +o:depends({ [_n("protocol")] = "http" }) -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "naive" }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "naive" }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("auth")] = true }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "tuic" }) if singbox_tags:find("with_quic") then - o = s:option(Value, option_name("hysteria_up_mbps"), translate("Max upload Mbps")) + o = s:option(Value, _n("hysteria_up_mbps"), translate("Max upload Mbps")) o.default = "100" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_down_mbps"), translate("Max download Mbps")) + o = s:option(Value, _n("hysteria_down_mbps"), translate("Max download Mbps")) o.default = "100" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_obfs"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_obfs"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(ListValue, option_name("hysteria_auth_type"), translate("Auth Type")) + o = s:option(ListValue, _n("hysteria_auth_type"), translate("Auth Type")) o:value("disable", translate("Disable")) o:value("string", translate("STRING")) o:value("base64", translate("BASE64")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "string"}) - o:depends({ [option_name("protocol")] = "hysteria", [option_name("hysteria_auth_type")] = "base64"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "string"}) + o:depends({ [_n("protocol")] = "hysteria", [_n("hysteria_auth_type")] = "base64"}) - o = s:option(Value, option_name("hysteria_recv_window_conn"), translate("QUIC stream receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_conn"), translate("QUIC stream receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_recv_window_client"), translate("QUIC connection receive window")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_recv_window_client"), translate("QUIC connection receive window")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_max_conn_client"), translate("QUIC concurrent bidirectional streams")) + o = s:option(Value, _n("hysteria_max_conn_client"), translate("QUIC concurrent bidirectional streams")) o.default = "1024" - o:depends({ [option_name("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Flag, _n("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) + o:depends({ [_n("protocol")] = "hysteria" }) - o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "hysteria" }) + o = s:option(Value, _n("hysteria_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "hysteria" }) end if singbox_tags:find("with_quic") then - o = s:option(ListValue, option_name("tuic_congestion_control"), translate("Congestion control algorithm")) + o = s:option(ListValue, _n("tuic_congestion_control"), translate("Congestion control algorithm")) o.default = "cubic" o:value("bbr", translate("BBR")) o:value("cubic", translate("CUBIC")) o:value("new_reno", translate("New Reno")) - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Flag, option_name("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) + o = s:option(Flag, _n("tuic_zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake")) o.default = 0 - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_heartbeat"), translate("Heartbeat interval(second)")) + o = s:option(Value, _n("tuic_heartbeat"), translate("Heartbeat interval(second)")) o.datatype = "uinteger" o.default = "3" - o:depends({ [option_name("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "tuic" }) - o = s:option(Value, option_name("tuic_alpn"), translate("QUIC TLS ALPN")) - o:depends({ [option_name("protocol")] = "tuic" }) + o = s:option(Value, _n("tuic_alpn"), translate("QUIC TLS ALPN")) + o:depends({ [_n("protocol")] = "tuic" }) end if singbox_tags:find("with_quic") then - o = s:option(Flag, option_name("hysteria2_ignore_client_bandwidth"), translate("Commands the client to use the BBR flow control algorithm")) + o = s:option(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Commands the client to use the BBR flow control algorithm")) o.default = 0 - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_up_mbps"), translate("Max upload Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2", [option_name("hysteria2_ignore_client_bandwidth")] = false }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) + o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_ignore_client_bandwidth")] = false }) - o = s:option(Value, option_name("hysteria2_down_mbps"), translate("Max download Mbps")) - o:depends({ [option_name("protocol")] = "hysteria2", [option_name("hysteria2_ignore_client_bandwidth")] = false }) + o = s:option(Value, _n("hysteria2_down_mbps"), translate("Max download Mbps")) + o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_ignore_client_bandwidth")] = false }) - o = s:option(ListValue, option_name("hysteria2_obfs_type"), translate("Obfs Type")) + o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_obfs_password"), translate("Obfs Password")) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(Value, option_name("hysteria2_auth_password"), translate("Auth Password")) + o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true - o:depends({ [option_name("protocol")] = "hysteria2"}) + o:depends({ [_n("protocol")] = "hysteria2"}) end -o = s:option(ListValue, option_name("d_protocol"), translate("Destination protocol")) +o = s:option(ListValue, _n("d_protocol"), translate("Destination protocol")) o:value("tcp", "TCP") o:value("udp", "UDP") o:value("tcp,udp", "TCP,UDP") -o:depends({ [option_name("protocol")] = "direct" }) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("d_address"), translate("Destination address")) -o:depends({ [option_name("protocol")] = "direct" }) +o = s:option(Value, _n("d_address"), translate("Destination address")) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("d_port"), translate("Destination port")) +o = s:option(Value, _n("d_port"), translate("Destination port")) o.datatype = "port" -o:depends({ [option_name("protocol")] = "direct" }) +o:depends({ [_n("protocol")] = "direct" }) -o = s:option(Value, option_name("decryption"), translate("Encrypt Method")) +o = s:option(Value, _n("decryption"), translate("Encrypt Method")) o.default = "none" -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("ss_method"), translate("Encrypt Method")) o.rewrite_option = "method" for a, t in ipairs(ss_method_list) do o:value(t) end -o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) -o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "tuic" }) -o = s:option(ListValue, option_name("flow"), translate("flow")) +o = s:option(ListValue, _n("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "vless" }) -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then - local reality = s.fields[option_name("reality")] and s.fields[option_name("reality")]:formvalue(t) or nil + local reality = s.fields[_n("reality")] and s.fields[_n("reality")]:formvalue(t) or nil if reality and reality == "1" then return value end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -214,45 +214,45 @@ o.validate = function(self, value, t) return value end end -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "http" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) if singbox_tags:find("with_reality_server") then -- [[ REALITY部分 ]] -- - o = s:option(Flag, option_name("reality"), translate("REALITY")) + o = s:option(Flag, _n("reality"), translate("REALITY")) o.default = 0 - o:depends({ [option_name("protocol")] = "http", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "vmess", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true }) - o:depends({ [option_name("protocol")] = "trojan", [option_name("tls")] = true }) + o:depends({ [_n("protocol")] = "http", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "vmess", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true }) + o:depends({ [_n("protocol")] = "trojan", [_n("tls")] = true }) - o = s:option(Value, option_name("reality_private_key"), translate("Private Key")) - o:depends({ [option_name("reality")] = true }) + o = s:option(Value, _n("reality_private_key"), translate("Private Key")) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_shortId"), translate("Short Id")) - o:depends({ [option_name("reality")] = true }) + o = s:option(Value, _n("reality_shortId"), translate("Short Id")) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_handshake_server"), translate("Handshake Server")) + o = s:option(Value, _n("reality_handshake_server"), translate("Handshake Server")) o.default = "google.com" - o:depends({ [option_name("reality")] = true }) + o:depends({ [_n("reality")] = true }) - o = s:option(Value, option_name("reality_handshake_server_port"), translate("Handshake Server Port")) + o = s:option(Value, _n("reality_handshake_server_port"), translate("Handshake Server Port")) o.datatype = "port" o.default = "443" - o:depends({ [option_name("reality")] = true }) + o:depends({ [_n("reality")] = true }) end -- [[ TLS部分 ]] -- -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -264,13 +264,13 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true, [option_name("reality")] = false }) -o:depends({ [option_name("protocol")] = "naive" }) -o:depends({ [option_name("protocol")] = "hysteria" }) -o:depends({ [option_name("protocol")] = "tuic" }) -o:depends({ [option_name("protocol")] = "hysteria2" }) +o:depends({ [_n("tls")] = true, [_n("reality")] = false }) +o:depends({ [_n("protocol")] = "naive" }) +o:depends({ [_n("protocol")] = "hysteria" }) +o:depends({ [_n("protocol")] = "tuic" }) +o:depends({ [_n("protocol")] = "hysteria2" }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -283,19 +283,19 @@ o.validate = function(self, value, t) end if singbox_tags:find("with_ech") then - o = s:option(Flag, option_name("ech"), translate("ECH")) + o = s:option(Flag, _n("ech"), translate("ECH")) o.default = "0" - o:depends({ [option_name("tls")] = true, [option_name("flow")] = "", [option_name("reality")] = false }) - o:depends({ [option_name("protocol")] = "naive" }) - o:depends({ [option_name("protocol")] = "hysteria" }) - o:depends({ [option_name("protocol")] = "tuic" }) - o:depends({ [option_name("protocol")] = "hysteria2" }) + o:depends({ [_n("tls")] = true, [_n("flow")] = "", [_n("reality")] = false }) + o:depends({ [_n("protocol")] = "naive" }) + o:depends({ [_n("protocol")] = "hysteria" }) + o:depends({ [_n("protocol")] = "tuic" }) + o:depends({ [_n("protocol")] = "hysteria2" }) - o = s:option(TextValue, option_name("ech_key"), translate("ECH Key")) + o = s:option(TextValue, _n("ech_key"), translate("ECH Key")) o.default = "" o.rows = 5 o.wrap = "off" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) o.validate = function(self, value) value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n") value = value:gsub("^%s*\n", "") @@ -305,80 +305,80 @@ if singbox_tags:find("with_ech") then return value end - o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) + o = s:option(Flag, _n("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) - o = s:option(Flag, option_name("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) + o = s:option(Flag, _n("dynamic_record_sizing_disabled"), translate("Disable adaptive sizing of TLS records")) o.default = "0" - o:depends({ [option_name("ech")] = true }) + o:depends({ [_n("ech")] = true }) end -o = s:option(ListValue, option_name("transport"), translate("Transport")) +o = s:option(ListValue, _n("transport"), translate("Transport")) o:value("tcp", "TCP") o:value("http", "HTTP") o:value("ws", "WebSocket") o:value("httpupgrade", "HTTPUpgrade") o:value("quic", "QUIC") o:value("grpc", "gRPC") -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ HTTP部分 ]]-- -o = s:option(Value, option_name("http_host"), translate("HTTP Host")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_host"), translate("HTTP Host")) +o:depends({ [_n("transport")] = "http" }) -o = s:option(Value, option_name("http_path"), translate("HTTP Path")) -o:depends({ [option_name("transport")] = "http" }) +o = s:option(Value, _n("http_path"), translate("HTTP Path")) +o:depends({ [_n("transport")] = "http" }) -- [[ WebSocket部分 ]]-- -o = s:option(Value, option_name("ws_host"), translate("WebSocket Host")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_host"), translate("WebSocket Host")) +o:depends({ [_n("transport")] = "ws" }) -o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) -o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, _n("ws_path"), translate("WebSocket Path")) +o:depends({ [_n("transport")] = "ws" }) -- [[ HTTPUpgrade部分 ]]-- -o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_host"), translate("HTTPUpgrade Host")) +o:depends({ [_n("transport")] = "httpupgrade" }) -o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path")) -o:depends({ [option_name("transport")] = "httpupgrade" }) +o = s:option(Value, _n("httpupgrade_path"), translate("HTTPUpgrade Path")) +o:depends({ [_n("transport")] = "httpupgrade" }) -- [[ gRPC部分 ]]-- -o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") -o:depends({ [option_name("transport")] = "grpc" }) +o = s:option(Value, _n("grpc_serviceName"), "ServiceName") +o:depends({ [_n("transport")] = "grpc" }) -- [[ Mux ]]-- -o = s:option(Flag, option_name("mux"), translate("Mux")) +o = s:option(Flag, _n("mux"), translate("Mux")) o.rmempty = false -o:depends({ [option_name("protocol")] = "vmess" }) -o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "shadowsocks" }) -o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [_n("protocol")] = "vmess" }) +o:depends({ [_n("protocol")] = "vless", [_n("flow")] = "" }) +o:depends({ [_n("protocol")] = "shadowsocks" }) +o:depends({ [_n("protocol")] = "trojan" }) -- [[ TCP Brutal ]]-- -o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o = s:option(Flag, _n("tcpbrutal"), translate("TCP Brutal")) o.default = 0 -o:depends({ [option_name("mux")] = true }) +o:depends({ [_n("mux")] = true }) -o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o = s:option(Value, _n("tcpbrutal_up_mbps"), translate("Max upload Mbps")) o.default = "10" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o = s:option(Value, _n("tcpbrutal_down_mbps"), translate("Max download Mbps")) o.default = "50" -o:depends({ [option_name("tcpbrutal")] = true }) +o:depends({ [_n("tcpbrutal")] = true }) -o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) +o = s:option(Flag, _n("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o.default = "0" -o = s:option(Flag, option_name("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) +o = s:option(Flag, _n("accept_lan"), translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) o.default = "0" local nodes_table = {} @@ -391,46 +391,45 @@ for k, e in ipairs(api.get_valid_nodes()) do end end -o = s:option(ListValue, option_name("outbound_node"), translate("outbound node")) -o:value("nil", translate("Close")) +o = s:option(ListValue, _n("outbound_node"), translate("outbound node")) +o:value("", translate("Close")) o:value("_socks", translate("Custom Socks")) o:value("_http", translate("Custom HTTP")) o:value("_iface", translate("Custom Interface")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end -o.default = "nil" -o = s:option(Value, option_name("outbound_node_address"), translate("Address (Support Domain Name)")) -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o = s:option(Value, _n("outbound_node_address"), translate("Address (Support Domain Name)")) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_port"), translate("Port")) +o = s:option(Value, _n("outbound_node_port"), translate("Port")) o.datatype = "port" -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_username"), translate("Username")) -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o = s:option(Value, _n("outbound_node_username"), translate("Username")) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_password"), translate("Password")) +o = s:option(Value, _n("outbound_node_password"), translate("Password")) o.password = true -o:depends({ [option_name("outbound_node")] = "_socks" }) -o:depends({ [option_name("outbound_node")] = "_http" }) +o:depends({ [_n("outbound_node")] = "_socks" }) +o:depends({ [_n("outbound_node")] = "_http" }) -o = s:option(Value, option_name("outbound_node_iface"), translate("Interface")) +o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) o.default = "eth1" -o:depends({ [option_name("outbound_node")] = "_iface" }) +o:depends({ [_n("outbound_node")] = "_iface" }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "info" o:value("debug") o:value("info") o:value("warn") o:value("error") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua index 287a8181ca..82cd0524f0 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/socks.lua @@ -10,7 +10,7 @@ local type_name = "Socks" local option_prefix = "socks_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,14 +18,14 @@ end s.fields["type"]:value(type_name, "Socks") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Flag, option_name("auth"), translate("Auth")) +o = s:option(Flag, _n("auth"), translate("Auth")) o.validate = function(self, value, t) if value and value == "1" then - local user_v = s.fields[option_name("username")] and s.fields[option_name("username")]:formvalue(t) or "" - local pass_v = s.fields[option_name("password")] and s.fields[option_name("password")]:formvalue(t) or "" + local user_v = s.fields[_n("username")] and s.fields[_n("username")]:formvalue(t) or "" + local pass_v = s.fields[_n("password")] and s.fields[_n("password")]:formvalue(t) or "" if user_v == "" or pass_v == "" then return nil, translate("Username and Password must be used together!") end @@ -33,14 +33,14 @@ o.validate = function(self, value, t) return value end -o = s:option(Value, option_name("username"), translate("Username")) -o:depends({ [option_name("auth")] = true }) +o = s:option(Value, _n("username"), translate("Username")) +o:depends({ [_n("auth")] = true }) -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o:depends({ [option_name("auth")] = true }) +o:depends({ [_n("auth")] = true }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua index 45e1d0728c..63ed44c55e 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss-rust.lua @@ -10,7 +10,7 @@ local type_name = "SS-Rust" local option_prefix = "ssrust_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -24,23 +24,23 @@ local ssrust_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks Rust")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssrust_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua index d46238a5f3..1d6b7c3c51 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ss.lua @@ -10,7 +10,7 @@ local type_name = "SS" local option_prefix = "ss_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -27,23 +27,23 @@ local ss_encrypt_method_list = { s.fields["type"]:value(type_name, translate("Shadowsocks")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ss_encrypt_method_list) do o:value(t) end -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua index 2a281a9ad1..a6ba4fb9af 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ssr.lua @@ -10,7 +10,7 @@ local type_name = "SSR" local option_prefix = "ssr_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -37,37 +37,37 @@ local ssr_obfs_list = { s.fields["type"]:value(type_name, translate("ShadowsocksR")) -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(Value, option_name("password"), translate("Password")) +o = s:option(Value, _n("password"), translate("Password")) o.password = true -o = s:option(ListValue, option_name("method"), translate("Encrypt Method")) +o = s:option(ListValue, _n("method"), translate("Encrypt Method")) for a, t in ipairs(ssr_encrypt_method_list) do o:value(t) end -o = s:option(ListValue, option_name("protocol"), translate("Protocol")) +o = s:option(ListValue, _n("protocol"), translate("Protocol")) for a, t in ipairs(ssr_protocol_list) do o:value(t) end -o = s:option(Value, option_name("protocol_param"), translate("Protocol_param")) +o = s:option(Value, _n("protocol_param"), translate("Protocol_param")) -o = s:option(ListValue, option_name("obfs"), translate("Obfs")) +o = s:option(ListValue, _n("obfs"), translate("Obfs")) for a, t in ipairs(ssr_obfs_list) do o:value(t) end -o = s:option(Value, option_name("obfs_param"), translate("Obfs_param")) +o = s:option(Value, _n("obfs_param"), translate("Obfs_param")) -o = s:option(Value, option_name("timeout"), translate("Connection Timeout")) +o = s:option(Value, _n("timeout"), translate("Connection Timeout")) o.datatype = "uinteger" o.default = 300 -o = s:option(Flag, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), "TCP " .. translate("Fast Open")) o.default = "0" -o = s:option(Flag, option_name("udp_forward"), translate("UDP Forward")) +o = s:option(Flag, _n("udp_forward"), translate("UDP Forward")) o.default = "1" o.rmempty = false -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" o.rmempty = false diff --git a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua index 05cafa8219..21bbad114e 100644 --- a/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua +++ b/small/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua @@ -10,7 +10,7 @@ local type_name = "Trojan-Plus" local option_prefix = "trojan_plus_" -local function option_name(name) +local function _n(name) return option_prefix .. name end @@ -18,15 +18,15 @@ end s.fields["type"]:value(type_name, "Trojan-Plus") -o = s:option(Value, option_name("port"), translate("Listen Port")) +o = s:option(Value, _n("port"), translate("Listen Port")) o.datatype = "port" -o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password")) +o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password")) for i = 1, 3 do o:value(api.gen_uuid(1)) end -o = s:option(Flag, option_name("tls"), translate("TLS")) +o = s:option(Flag, _n("tls"), translate("TLS")) o.default = 0 o.validate = function(self, value, t) if value then @@ -35,8 +35,8 @@ o.validate = function(self, value, t) return nil, translate("Original Trojan only supported 'tls', please choose 'tls'.") end if value == "1" then - local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or "" - local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or "" + local ca = s.fields[_n("tls_certificateFile")] and s.fields[_n("tls_certificateFile")]:formvalue(t) or "" + local key = s.fields[_n("tls_keyFile")] and s.fields[_n("tls_keyFile")]:formvalue(t) or "" if ca == "" or key == "" then return nil, translate("Public key and Private key path can not be empty!") end @@ -45,9 +45,9 @@ o.validate = function(self, value, t) end end -o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") +o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem") o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -59,9 +59,9 @@ o.validate = function(self, value, t) return nil end -o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") +o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key") o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) o.validate = function(self, value, t) if value and value ~= "" then if not nixio.fs.access(value) then @@ -73,36 +73,36 @@ o.validate = function(self, value, t) return nil end -o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket")) +o = s:option(Flag, _n("tls_sessionTicket"), translate("Session Ticket")) o.default = "0" -o:depends({ [option_name("tls")] = true }) +o:depends({ [_n("tls")] = true }) -o = s:option(Flag, option_name("tcp_fast_open"), translate("TCP Fast Open")) +o = s:option(Flag, _n("tcp_fast_open"), translate("TCP Fast Open")) o.default = "0" -o = s:option(Flag, option_name("remote_enable"), translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray/Xray WebSocket and more.")) +o = s:option(Flag, _n("remote_enable"), translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray/Xray WebSocket and more.")) o.default = "1" o.rmempty = false -o = s:option(Value, option_name("remote_address"), translate("Remote Address")) +o = s:option(Value, _n("remote_address"), translate("Remote Address")) o.default = "127.0.0.1" -o:depends({ [option_name("remote_enable")] = true }) +o:depends({ [_n("remote_enable")] = true }) -o = s:option(Value, option_name("remote_port"), translate("Remote Port")) +o = s:option(Value, _n("remote_port"), translate("Remote Port")) o.datatype = "port" o.default = "80" -o:depends({ [option_name("remote_enable")] = true }) +o:depends({ [_n("remote_enable")] = true }) -o = s:option(Flag, option_name("log"), translate("Log")) +o = s:option(Flag, _n("log"), translate("Log")) o.default = "1" -o = s:option(ListValue, option_name("loglevel"), translate("Log Level")) +o = s:option(ListValue, _n("loglevel"), translate("Log Level")) o.default = "2" o:value("0", "all") o:value("1", "info") o:value("2", "warn") o:value("3", "error") o:value("4", "fatal") -o:depends({ [option_name("log")] = true }) +o:depends({ [_n("log")] = true }) api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/small/luci-app-passwall/luasrc/passwall/api.lua b/small/luci-app-passwall/luasrc/passwall/api.lua index 61c0a0f8b7..4ff4773de7 100644 --- a/small/luci-app-passwall/luasrc/passwall/api.lua +++ b/small/luci-app-passwall/luasrc/passwall/api.lua @@ -364,6 +364,26 @@ function get_domain_from_url(url) return url end +function get_node_name(node_id) + local e + if type(node_id) == "table" then + e = node_id + else + e = uci:get_all(appname, node_id) + end + if e then + if e.type and e.remarks then + if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt" or e.protocol == "_iface") then + local type = e.type + if type == "sing-box" then type = "Sing-Box" end + local remark = "%s:[%s] " % {type .. " " .. i18n.translatef(e.protocol), e.remarks} + return remark + end + end + end + return "" +end + function get_valid_nodes() local show_node_info = uci_get_type("global_other", "show_node_info") or "0" local nodes = {} diff --git a/small/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/small/luci-app-passwall/luasrc/passwall/util_sing-box.lua index e651389992..4ce25bc901 100644 --- a/small/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/small/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -20,7 +20,7 @@ end function gen_outbound(flag, node, tag, proxy_table) local result = nil - if node and node ~= "nil" then + if node then local node_id = node[".name"] if tag == nil then tag = node_id @@ -46,7 +46,7 @@ function gen_outbound(flag, node, tag, proxy_table) "127.0.0.1", --bind new_port, --socks port config_file, --config file - (proxy_tag and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port + (proxy_tag and relay_port) and tostring(relay_port) or "" --relay port ) ) ) @@ -56,7 +56,7 @@ function gen_outbound(flag, node, tag, proxy_table) port = new_port } else - if proxy_tag and proxy_tag ~= "nil" then + if proxy_tag then node.detour = proxy_tag end end @@ -679,7 +679,7 @@ function gen_config_server(node) } } - if node.outbound_node and node.outbound_node ~= "nil" then + if node.outbound_node then local outbound = nil if node.outbound_node == "_iface" and node.outbound_node_iface then outbound = { @@ -905,7 +905,7 @@ function gen_config(var) end if node.chain_proxy == "1" and node.preproxy_node then - if outbound["_flag_proxy_tag"] and outbound["_flag_proxy_tag"] ~= "nil" then + if outbound["_flag_proxy_tag"] then --Ignore else local preproxy_node = uci:get_all(appname, node.preproxy_node) @@ -951,7 +951,7 @@ function gen_config(var) local function gen_shunt_node(rule_name, _node_id) if not rule_name then return nil, nil end - if not _node_id then _node_id = node[rule_name] or "nil" end + if not _node_id then _node_id = node[rule_name] end local rule_outboundTag if _node_id == "_direct" then rule_outboundTag = "direct" @@ -959,7 +959,7 @@ function gen_config(var) rule_outboundTag = "block" elseif _node_id == "_default" and rule_name ~= "default" then rule_outboundTag = "default" - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil if socks_node then @@ -976,7 +976,7 @@ function gen_config(var) rule_outboundTag = _outbound.tag end end - elseif _node_id ~= "nil" then + elseif _node_id then local _node = uci:get_all(appname, _node_id) if not _node then return nil, nil end @@ -1180,7 +1180,7 @@ function gen_config(var) rule.domain_regex = #domain_table.domain_regex > 0 and domain_table.domain_regex or nil rule.geosite = #domain_table.geosite > 0 and domain_table.geosite or nil - if outboundTag and outboundTag ~= "nil" then + if outboundTag then table.insert(dns_domain_rules, api.clone(domain_table)) end end @@ -1476,7 +1476,7 @@ function gen_config(var) tag = "block" }) for index, value in ipairs(config.outbounds) do - if (not value["_flag_proxy_tag"] or value["_flag_proxy_tag"] == "nil") and not value.detour and value["_id"] and value.server and value.server_port then + if not value["_flag_proxy_tag"] and not value.detour and value["_id"] and value.server and value.server_port then sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list")) end for k, v in pairs(config.outbounds[index]) do diff --git a/small/luci-app-passwall/luasrc/passwall/util_xray.lua b/small/luci-app-passwall/luasrc/passwall/util_xray.lua index 0a2a663a74..57d392b4e8 100644 --- a/small/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/small/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -48,7 +48,7 @@ end function gen_outbound(flag, node, tag, proxy_table) local result = nil - if node and node ~= "nil" then + if node then local node_id = node[".name"] if tag == nil then tag = node_id @@ -82,7 +82,7 @@ function gen_outbound(flag, node, tag, proxy_table) "127.0.0.1", --bind new_port, --socks port config_file, --config file - (proxy_tag and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port + (proxy_tag and relay_port) and tostring(relay_port) or "" --relay port ) )) node = {} @@ -95,7 +95,7 @@ function gen_outbound(flag, node, tag, proxy_table) else if node.flow == "xtls-rprx-vision" then else - if proxy_tag and proxy_tag ~= "nil" then + if proxy_tag then node.proxySettings = { tag = proxy_tag, transportLayer = true @@ -404,7 +404,7 @@ function gen_config_server(node) } } - if node.outbound_node and node.outbound_node ~= "nil" then + if node.outbound_node then local outbound = nil if node.outbound_node == "_iface" and node.outbound_node_iface then outbound = { @@ -735,7 +735,7 @@ function gen_config(var) -- fallback node local fallback_node_tag = nil local fallback_node_id = _node.fallback_node - if fallback_node_id == "" or fallback_node_id == "nil" then fallback_node_id = nil end + if not fallback_node_id or fallback_node_id == "" then fallback_node_id = nil end if fallback_node_id then local is_new_node = true for _, outbound in ipairs(outbounds) do @@ -784,7 +784,7 @@ function gen_config(var) local last_insert_outbound if node.chain_proxy == "1" and node.preproxy_node then - if outbound["_flag_proxy_tag"] and outbound["_flag_proxy_tag"] ~= "nil" then + if outbound["_flag_proxy_tag"] then --Ignore else local preproxy_node = uci:get_all(appname, node.preproxy_node) @@ -846,7 +846,7 @@ function gen_config(var) return "blackhole", nil elseif _node_id == "_default" then return "default", nil - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil local socks_tag @@ -1396,7 +1396,7 @@ function gen_config(var) end for index, value in ipairs(config.outbounds) do - if (not value["_flag_proxy_tag"] or value["_flag_proxy_tag"] == "nil") and value["_id"] and value.server and value.server_port then + if not value["_flag_proxy_tag"] and value["_id"] and value.server and value.server_port then sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list")) end for k, v in pairs(config.outbounds[index]) do diff --git a/small/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm b/small/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm new file mode 100644 index 0000000000..76a1ff2340 --- /dev/null +++ b/small/luci-app-passwall/luasrc/view/passwall/cbi/hidevalue.htm @@ -0,0 +1,3 @@ +
" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>" style="display: none !important"> + " /> +
diff --git a/small/luci-app-passwall/luasrc/view/passwall/global/footer.htm b/small/luci-app-passwall/luasrc/view/passwall/global/footer.htm index 5a7a518f07..82a381f678 100644 --- a/small/luci-app-passwall/luasrc/view/passwall/global/footer.htm +++ b/small/luci-app-passwall/luasrc/view/passwall/global/footer.htm @@ -53,13 +53,13 @@ local api = require "luci.passwall.api" var dom_id = dom.id.split(cbi_id).join(cbi_id.split("-").join(".")).split("cbi.").join("cbid.") var node_select = document.getElementsByName(dom_id)[0]; var node_select_value = node_select.value; - if (node_select_value && node_select_value != "nil" && node_select_value.indexOf("_default") != 0 && node_select_value.indexOf("_direct") != 0 && node_select_value.indexOf("_blackhole") != 0) { + if (node_select_value && node_select_value != "" && node_select_value.indexOf("_default") != 0 && node_select_value.indexOf("_direct") != 0 && node_select_value.indexOf("_blackhole") != 0) { if (global_id != null && node_select_value.indexOf("tcp") == 0) { var d = global_id + "-tcp_node"; d = d.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), "."); var dom = document.getElementsByName(d)[0]; var _node_select_value = dom.value; - if (_node_select_value && _node_select_value != "nil") { + if (_node_select_value && _node_select_value != "") { node_select_value = _node_select_value; } } @@ -117,7 +117,7 @@ local api = require "luci.passwall.api" var dom_id = dom_id.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), "."); var node_select = document.getElementsByName(dom_id)[0]; var node_select_value = node_select.value; - if (node_select_value && node_select_value != "nil") { + if (node_select_value && node_select_value != "") { var v = document.getElementById(dom_id + "-" + node_select_value); if (v) { node_select.title = v.text; diff --git a/small/luci-app-passwall/po/zh-cn/passwall.po b/small/luci-app-passwall/po/zh-cn/passwall.po index c8a0ec1d80..a845a9a0d0 100644 --- a/small/luci-app-passwall/po/zh-cn/passwall.po +++ b/small/luci-app-passwall/po/zh-cn/passwall.po @@ -673,17 +673,32 @@ msgstr "单位:秒" msgid "Units:minutes" msgstr "单位:分钟" -msgid "Open and close automatically" -msgstr "定时自动开关" +msgid "stop automatically mode" +msgstr "定时关闭模式" -msgid "Automatically turn off time" -msgstr "自动关闭时间" +msgid "stop Time(Every day)" +msgstr "关闭时间(每天)" -msgid "Automatically turn on time" -msgstr "自动开启时间" +msgid "stop Interval(Hour)" +msgstr "关闭间隔(小时)" -msgid "Automatically restart time" -msgstr "自动重启时间" +msgid "start automatically mode" +msgstr "定时开启模式" + +msgid "start Time(Every day)" +msgstr "开启时间(每天)" + +msgid "start Interval(Hour)" +msgstr "开启间隔(小时)" + +msgid "restart automatically mode" +msgstr "定时重启模式" + +msgid "restart Time(Every day)" +msgstr "重启时间(每天)" + +msgid "restart Interval(Hour)" +msgstr "重启间隔(小时)" msgid "Forwarding Settings" msgstr "转发配置" @@ -925,6 +940,9 @@ msgstr "每周日" msgid "hour" msgstr "小时" +msgid "Hour" +msgstr "小时" + msgid "Location of V2ray/Xray asset" msgstr "V2ray/Xray 资源文件目录" diff --git a/small/luci-app-passwall/root/usr/share/passwall/0_default_config b/small/luci-app-passwall/root/usr/share/passwall/0_default_config index 8348217933..551c824f96 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/0_default_config +++ b/small/luci-app-passwall/root/usr/share/passwall/0_default_config @@ -2,8 +2,6 @@ config global option enabled '0' option socks_enabled '0' - option tcp_node 'nil' - option udp_node 'nil' option tcp_node_socks_port '1070' option filter_proxy_ipv6 '1' option dns_shunt 'chinadns-ng' @@ -32,7 +30,6 @@ config global_haproxy option balancing_enable '0' config global_delay - option auto_on '0' option start_daemon '1' option start_delay '60' @@ -102,7 +99,7 @@ config nodes 'myshunt' option Streaming '_default' option Proxy '_default' option Direct '_direct' - option default_node 'nil' + option default_node '_direct' option domainStrategy 'IPOnDemand' config shunt_rules 'DirectGame' diff --git a/small/luci-app-passwall/root/usr/share/passwall/app.sh b/small/luci-app-passwall/root/usr/share/passwall/app.sh index 40b657cd68..14aa4e445a 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/app.sh @@ -707,7 +707,7 @@ run_socks() { ;; esac - eval node_${node}_socks_port=$socks_port + set_cache_var "node_${node}_socks_port" "${socks_port}" # http to socks [ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && { @@ -755,7 +755,7 @@ run_redir() { } } [ "$bind" != "127.0.0.1" ] && echolog "${PROTO}节点:[$remarks],监听端口:$local_port" - eval ${PROTO}_NODE_PORT=$port + set_cache_var "${PROTO}_NODE_PORT" "${port}" case "$PROTO" in UDP) @@ -856,7 +856,7 @@ run_redir() { } [ "$TCP_UDP" = "1" ] && { UDP_REDIR_PORT=$local_port - UDP_NODE="nil" + unset UDP_NODE _flag="TCP_UDP" _args="${_args} udp_redir_port=${UDP_REDIR_PORT}" config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") @@ -932,7 +932,7 @@ run_redir() { } [ "$TCP_UDP" = "1" ] && { UDP_REDIR_PORT=$local_port - UDP_NODE="nil" + unset UDP_NODE _flag="TCP_UDP" _args="${_args} udp_redir_port=${UDP_REDIR_PORT}" config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") @@ -974,7 +974,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE } local loglevel=$(config_t_get global trojan_loglevel "2") lua $UTIL_TROJAN gen_config -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel $lua_tproxy_arg > $config_file @@ -989,7 +989,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="-u" } lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port $lua_tproxy_arg > $config_file @@ -1001,7 +1001,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE lua_mode_arg="-mode tcp_and_udp" } lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port $lua_mode_arg $lua_tproxy_arg > $config_file @@ -1023,7 +1023,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="${_extra_param} -local_udp_redir_port $local_port" } lua $UTIL_SS gen_config -node $node ${_extra_param} > $config_file @@ -1044,7 +1044,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g") UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE _extra_param="${_extra_param} -local_udp_redir_port $local_port" } _extra_param="${_extra_param} -tcp_proxy_way $tcp_proxy_way" @@ -1057,7 +1057,7 @@ run_redir() { [ "$TCP_UDP" = "1" ] && { _flag="TCP_UDP" UDP_REDIR_PORT=$TCP_REDIR_PORT - UDP_NODE="nil" + unset UDP_NODE } local _socks_tproxy="" [ "$tcp_proxy_way" = "tproxy" ] && _socks_tproxy="1" @@ -1085,13 +1085,13 @@ run_redir() { esac unset tcp_node_socks_flag tcp_node_http_flag [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && echo "${node}" >> $TMP_PATH/direct_node_list - return 0 + [ -n "${redir_port}" ] && set_cache_var "node_${node}_${PROTO}_redir_port" "${local_port}" } start_redir() { local proto=${1} eval node=\$${proto}_NODE - if [ "$node" != "nil" ]; then + if [ -n "$node" ]; then TYPE=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') local config_file="${proto}.json" local log_file="${proto}.log" @@ -1099,7 +1099,12 @@ start_redir() { local port=$(echo $(get_new_port $current_port $proto)) eval ${proto}_REDIR=$port run_redir node=$node proto=${proto} bind=0.0.0.0 local_port=$port config_file=$config_file log_file=$log_file - set_cache_var "GLOBAL_${proto}_node" "$node" + set_cache_var "ACL_GLOBAL_${proto}_node" "${node}" + set_cache_var "ACL_GLOBAL_${proto}_redir_port" "${port}" + [ "$TCP_UDP" = "1" ] && { + set_cache_var "ACL_GLOBAL_UDP_node" "${node}" + set_cache_var "ACL_GLOBAL_UDP_redir_port" "${port}" + } else [ "${proto}" = "UDP" ] && [ "$TCP_UDP" = "1" ] && return echolog "${proto}节点没有选择或为空,不代理${proto}。" @@ -1114,8 +1119,8 @@ start_socks() { for id in $ids; do local enabled=$(config_n_get $id enabled 0) [ "$enabled" == "0" ] && continue - local node=$(config_n_get $id node nil) - [ "$node" == "nil" ] && continue + local node=$(config_n_get $id node) + [ -z "$node" ] && continue local bind_local=$(config_n_get $id bind_local 0) local bind="0.0.0.0" [ "$bind_local" = "1" ] && bind="127.0.0.1" @@ -1206,23 +1211,41 @@ start_crontab() { return } - auto_on=$(config_t_get global_delay auto_on 0) - if [ "$auto_on" = "1" ]; then - time_off=$(config_t_get global_delay time_off) - time_on=$(config_t_get global_delay time_on) - time_restart=$(config_t_get global_delay time_restart) - [ -z "$time_off" -o "$time_off" != "nil" ] && { - echo "0 $time_off * * * /etc/init.d/$CONFIG stop" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_off 点关闭服务。" - } - [ -z "$time_on" -o "$time_on" != "nil" ] && { - echo "0 $time_on * * * /etc/init.d/$CONFIG start" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_on 点开启服务。" - } - [ -z "$time_restart" -o "$time_restart" != "nil" ] && { - echo "0 $time_restart * * * /etc/init.d/$CONFIG restart" >>/etc/crontabs/root - echolog "配置定时任务:每天 $time_restart 点重启服务。" - } + stop_week_mode=$(config_t_get global_delay stop_week_mode) + stop_time_mode=$(config_t_get global_delay stop_time_mode) + if [ -n "$stop_week_mode" ]; then + local t="0 $stop_time_mode * * $stop_week_mode" + [ "$stop_week_mode" = "7" ] && t="0 $stop_time_mode * * *" + if [ "$stop_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG stop > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动关闭服务。" + fi + start_week_mode=$(config_t_get global_delay start_week_mode) + start_time_mode=$(config_t_get global_delay start_time_mode) + if [ -n "$start_week_mode" ]; then + local t="0 $start_time_mode * * $start_week_mode" + [ "$start_week_mode" = "7" ] && t="0 $start_time_mode * * *" + if [ "$start_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG start > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动开启服务。" + fi + restart_week_mode=$(config_t_get global_delay restart_week_mode) + restart_time_mode=$(config_t_get global_delay restart_time_mode) + if [ -n "$restart_week_mode" ]; then + local t="0 $restart_time_mode * * $restart_week_mode" + [ "$restart_week_mode" = "7" ] && t="0 $restart_time_mode * * *" + if [ "$restart_week_mode" = "8" ]; then + update_loop=1 + else + echo "$t /etc/init.d/$CONFIG restart > /dev/null 2>&1 &" >>/etc/crontabs/root + fi + echolog "配置定时任务:自动重启服务。" fi autoupdate=$(config_t_get global_rules auto_update) @@ -1695,198 +1718,221 @@ acl_app() { [ ! -z "${source_list}" ] && echo -e "${source_list}" | sed '/^$/d' > ${acl_path}/source_list use_global_config=${use_global_config:-0} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} - use_direct_list=${use_direct_list:-1} - use_proxy_list=${use_proxy_list:-1} - use_block_list=${use_block_list:-1} - use_gfw_list=${use_gfw_list:-1} - chn_list=${chn_list:-direct} - tcp_proxy_mode=${tcp_proxy_mode:-proxy} - udp_proxy_mode=${udp_proxy_mode:-proxy} - filter_proxy_ipv6=${filter_proxy_ipv6:-0} - dnsmasq_filter_proxy_ipv6=${filter_proxy_ipv6} - dns_shunt=${dns_shunt:-dnsmasq} - dns_mode=${dns_mode:-dns2socks} - remote_dns=${remote_dns:-1.1.1.1} - use_default_dns=${use_default_dns:-direct} - [ "$dns_mode" = "sing-box" ] && { - [ "$v2ray_dns_mode" = "doh" ] && remote_dns=${remote_dns_doh:-https://1.1.1.1/dns-query} - } - [ "${use_global_config}" = "1" ] && { tcp_node="default" udp_node="default" } + tcp_no_redir_ports=${tcp_no_redir_ports:-${TCP_NO_REDIR_PORTS}} + udp_no_redir_ports=${udp_no_redir_ports:-${UDP_NO_REDIR_PORTS}} + if [ "$tcp_no_redir_ports" == "1:65535" ] && [ "$udp_no_redir_ports" == "1:65535" ]; then + unset use_global_config + unset tcp_node + unset udp_node + else + use_direct_list=${use_direct_list:-1} + use_proxy_list=${use_proxy_list:-1} + use_block_list=${use_block_list:-1} + use_gfw_list=${use_gfw_list:-1} + chn_list=${chn_list:-direct} + tcp_proxy_mode=${tcp_proxy_mode:-proxy} + udp_proxy_mode=${udp_proxy_mode:-proxy} + filter_proxy_ipv6=${filter_proxy_ipv6:-0} + dnsmasq_filter_proxy_ipv6=${filter_proxy_ipv6} + dns_shunt=${dns_shunt:-dnsmasq} + dns_mode=${dns_mode:-dns2socks} + remote_dns=${remote_dns:-1.1.1.1} + use_default_dns=${use_default_dns:-direct} + [ "$dns_mode" = "sing-box" ] && { + [ "$v2ray_dns_mode" = "doh" ] && remote_dns=${remote_dns_doh:-https://1.1.1.1/dns-query} + } + fi - [ "$tcp_node" != "nil" ] && { + [ -n "$tcp_node" ] && { + local GLOBAL_TCP_NODE=$(get_cache_var "ACL_GLOBAL_TCP_node") + echolog "${GLOBAL_TCP_NODE}" + [ -n "${GLOBAL_TCP_NODE}" ] && GLOBAL_TCP_redir_port=$(get_cache_var "ACL_GLOBAL_TCP_redir_port") if [ "$tcp_node" = "default" ]; then - tcp_node=$TCP_NODE - tcp_port=$TCP_REDIR_PORT + if [ -n "${GLOBAL_TCP_NODE}" ]; then + set_cache_var "ACL_${sid}_tcp_node" "${GLOBAL_TCP_NODE}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${GLOBAL_TCP_redir_port}" + set_cache_var "ACL_${sid}_dns_port" "${GLOBAL_DNSMASQ_PORT}" + set_cache_var "ACL_${sid}_tcp_default" "1" + else + echolog " - 全局节点未启用,跳过【${remarks}】" + fi else - [ "$(config_get_type $tcp_node nil)" = "nodes" ] && { - run_dns() { - local _dns_port - [ -n $1 ] && _dns_port=$1 - [ -z ${_dns_port} ] && { - dns_port=$(get_new_port $(expr $dns_port + 1)) - _dns_port=$dns_port - if [ "$dns_mode" = "dns2socks" ]; then - run_dns2socks flag=acl_${sid} socks_address=127.0.0.1 socks_port=$socks_port listen_address=0.0.0.0 listen_port=${_dns_port} dns=$remote_dns cache=1 - elif [ "$dns_mode" = "sing-box" -o "$dns_mode" = "xray" ]; then - config_file=$TMP_ACL_PATH/${tcp_node}_SOCKS_${socks_port}_DNS.json - [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} - local type=${dns_mode} - [ "${dns_mode}" = "sing-box" ] && type="singbox" - dnsmasq_filter_proxy_ipv6=0 - run_${type} flag=acl_${sid} type=$dns_mode dns_socks_address=127.0.0.1 dns_socks_port=$socks_port dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh="${remote_dns_doh}" remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY} config_file=$config_file - fi - eval node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)=${_dns_port} - } - - [ "$dns_shunt" = "chinadns-ng" ] && [ -n "$(first_type chinadns-ng)" ] && { - chinadns_ng_min=2024.04.13 - chinadns_ng_now=$(chinadns-ng -V | grep -i "ChinaDNS-NG " | awk '{print $2}') - if [ $(check_ver "$chinadns_ng_now" "$chinadns_ng_min") = 1 ]; then - echolog " * 注意:当前 ChinaDNS-NG 版本为[ $chinadns_ng_now ],请更新到[ $chinadns_ng_min ]或以上版本,否则 DNS 有可能无法正常工作!" - fi - - [ "$filter_proxy_ipv6" = "1" ] && dnsmasq_filter_proxy_ipv6=0 - chinadns_port=$(expr $chinadns_port + 1) - _china_ng_listen="127.0.0.1#${chinadns_port}" - - _chinadns_local_dns=$(IFS=','; set -- $LOCAL_DNS; [ "${1%%[#:]*}" = "127.0.0.1" ] && echo "$1" || ([ -n "$2" ] && echo "$1,$2" || echo "$1")) - _direct_dns_mode=$(config_t_get global direct_dns_mode "auto") - case "${_direct_dns_mode}" in - udp) - _chinadns_local_dns=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g') - ;; - tcp) - _chinadns_local_dns="tcp://$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')" - ;; - dot) - if [ "$(chinadns-ng -V | grep -i wolfssl)" != "nil" ]; then - _chinadns_local_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12") - fi - ;; - esac - - run_chinadns_ng \ - _flag="$sid" \ - _listen_port=${chinadns_port} \ - _dns_local=${_chinadns_local_dns} \ - _dns_trust=127.0.0.1#${_dns_port} \ - _no_ipv6_trust=${filter_proxy_ipv6} \ - _use_direct_list=${use_direct_list} \ - _use_proxy_list=${use_proxy_list} \ - _use_block_list=${use_block_list} \ - _gfwlist=${use_gfw_list} \ - _chnlist=${chn_list} \ - _default_mode=${tcp_proxy_mode} \ - _default_tag=${chinadns_ng_default_tag:-smart} \ - _no_logic_log=1 \ - _tcp_node=${tcp_node} - - use_default_dns="chinadns_ng" - } - - dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1)) - local dnsmasq_conf=${acl_path}/dnsmasq.conf - local dnsmasq_conf_path=${acl_path}/dnsmasq.d - lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG ${sid} -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ - -LISTEN_PORT ${dnsmasq_port} -DEFAULT_DNS $DEFAULT_DNS -LOCAL_DNS $LOCAL_DNS \ - -USE_DIRECT_LIST "${use_direct_list}" -USE_PROXY_LIST "${use_proxy_list}" -USE_BLOCK_LIST "${use_block_list}" -USE_GFW_LIST "${use_gfw_list}" -CHN_LIST "${chn_list}" \ - -TUN_DNS "127.0.0.1#${_dns_port}" -REMOTE_FAKEDNS 0 -USE_DEFAULT_DNS "${use_default_dns:-direct}" -CHINADNS_DNS ${_china_ng_listen:-0} \ - -TCP_NODE $tcp_node -DEFAULT_PROXY_MODE ${tcp_proxy_mode} -NO_PROXY_IPV6 ${dnsmasq_filter_proxy_ipv6:-0} -NFTFLAG ${nftflag:-0} \ - -NO_LOGIC_LOG 1 - ln_run "$(first_type dnsmasq)" "dnsmasq_${sid}" "/dev/null" -C ${dnsmasq_conf} -x ${acl_path}/dnsmasq.pid - set_cache_var "ACL_${sid}_dns_port" "${dnsmasq_port}" - eval node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)=${dnsmasq_port} - } - _redir_port=$(eval echo \${node_${tcp_node}_redir_port}) - _socks_port=$(eval echo \${node_${tcp_node}_socks_port}) - if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then - socks_port=${_socks_port} - tcp_port=${_redir_port} - _dnsmasq_port=$(eval echo \${node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)}) - if [ -z "${_dnsmasq_port}" ]; then - _dns_port=$(eval echo \${node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)}) - run_dns ${_dns_port} - else - [ -n "${_dnsmasq_port}" ] && set_cache_var "ACL_${sid}_dns_port" "${_dnsmasq_port}" - fi + [ "$(config_get_type $tcp_node)" = "nodes" ] && { + if [ -n "${GLOBAL_TCP_NODE}" ] && [ "$tcp_node" = "${GLOBAL_TCP_NODE}" ]; then + set_cache_var "ACL_${sid}_tcp_node" "${GLOBAL_TCP_NODE}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${GLOBAL_TCP_redir_port}" + set_cache_var "ACL_${sid}_dns_port" "${GLOBAL_DNSMASQ_PORT}" + set_cache_var "ACL_${sid}_tcp_default" "1" else - socks_port=$(get_new_port $(expr $socks_port + 1)) - eval node_${tcp_node}_socks_port=$socks_port - redir_port=$(get_new_port $(expr $redir_port + 1)) - eval node_${tcp_node}_redir_port=$redir_port - tcp_port=$redir_port - - local type=$(echo $(config_n_get $tcp_node type) | tr 'A-Z' 'a-z') - if [ -n "${type}" ] && ([ "${type}" = "sing-box" ] || [ "${type}" = "xray" ]); then - config_file="acl/${tcp_node}_TCP_${redir_port}.json" - _extra_param="socks_address=127.0.0.1 socks_port=$socks_port" - if [ "$dns_mode" = "sing-box" ] || [ "$dns_mode" = "xray" ]; then + run_dns() { + local _dns_port + [ -n $1 ] && _dns_port=$1 + [ -z ${_dns_port} ] && { dns_port=$(get_new_port $(expr $dns_port + 1)) _dns_port=$dns_port - config_file=$(echo $config_file | sed "s/TCP_/DNS_${_dns_port}_TCP_/g") - remote_dns_doh=${remote_dns} - dnsmasq_filter_proxy_ipv6=0 - [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} - _extra_param="dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh=${remote_dns_doh} remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY}" - fi - [ "$udp_node" != "nil" ] && ([ "$udp_node" = "tcp" ] || [ "$udp_node" = "$tcp_node" ]) && { - config_file=$(echo $config_file | sed "s/TCP_/TCP_UDP_/g") - _extra_param="${_extra_param} udp_redir_port=$redir_port" + if [ "$dns_mode" = "dns2socks" ]; then + run_dns2socks flag=acl_${sid} socks_address=127.0.0.1 socks_port=$socks_port listen_address=0.0.0.0 listen_port=${_dns_port} dns=$remote_dns cache=1 + elif [ "$dns_mode" = "sing-box" -o "$dns_mode" = "xray" ]; then + config_file=$TMP_ACL_PATH/${tcp_node}_SOCKS_${socks_port}_DNS.json + [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} + local type=${dns_mode} + [ "${dns_mode}" = "sing-box" ] && type="singbox" + dnsmasq_filter_proxy_ipv6=0 + run_${type} flag=acl_${sid} type=$dns_mode dns_socks_address=127.0.0.1 dns_socks_port=$socks_port dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh="${remote_dns_doh}" remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY} config_file=$config_file + fi + set_cache_var "node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)" "${_dns_port}" } - config_file="$TMP_PATH/$config_file" - [ "${type}" = "sing-box" ] && type="singbox" - run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file + + [ "$dns_shunt" = "chinadns-ng" ] && [ -n "$(first_type chinadns-ng)" ] && { + chinadns_ng_min=2024.04.13 + chinadns_ng_now=$(chinadns-ng -V | grep -i "ChinaDNS-NG " | awk '{print $2}') + if [ $(check_ver "$chinadns_ng_now" "$chinadns_ng_min") = 1 ]; then + echolog " * 注意:当前 ChinaDNS-NG 版本为[ $chinadns_ng_now ],请更新到[ $chinadns_ng_min ]或以上版本,否则 DNS 有可能无法正常工作!" + fi + + [ "$filter_proxy_ipv6" = "1" ] && dnsmasq_filter_proxy_ipv6=0 + chinadns_port=$(expr $chinadns_port + 1) + _china_ng_listen="127.0.0.1#${chinadns_port}" + + _chinadns_local_dns=$(IFS=','; set -- $LOCAL_DNS; [ "${1%%[#:]*}" = "127.0.0.1" ] && echo "$1" || ([ -n "$2" ] && echo "$1,$2" || echo "$1")) + _direct_dns_mode=$(config_t_get global direct_dns_mode "auto") + case "${_direct_dns_mode}" in + udp) + _chinadns_local_dns=$(config_t_get global direct_dns_udp 223.5.5.5 | sed 's/:/#/g') + ;; + tcp) + _chinadns_local_dns="tcp://$(config_t_get global direct_dns_tcp 223.5.5.5 | sed 's/:/#/g')" + ;; + dot) + if [ "$(chinadns-ng -V | grep -i wolfssl)" != "nil" ]; then + _chinadns_local_dns=$(config_t_get global direct_dns_dot "tls://dot.pub@1.12.12.12") + fi + ;; + esac + + run_chinadns_ng \ + _flag="$sid" \ + _listen_port=${chinadns_port} \ + _dns_local=${_chinadns_local_dns} \ + _dns_trust=127.0.0.1#${_dns_port} \ + _no_ipv6_trust=${filter_proxy_ipv6} \ + _use_direct_list=${use_direct_list} \ + _use_proxy_list=${use_proxy_list} \ + _use_block_list=${use_block_list} \ + _gfwlist=${use_gfw_list} \ + _chnlist=${chn_list} \ + _default_mode=${tcp_proxy_mode} \ + _default_tag=${chinadns_ng_default_tag:-smart} \ + _no_logic_log=1 \ + _tcp_node=${tcp_node} + + use_default_dns="chinadns_ng" + } + + dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1)) + local dnsmasq_conf=${acl_path}/dnsmasq.conf + local dnsmasq_conf_path=${acl_path}/dnsmasq.d + lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG ${sid} -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ + -LISTEN_PORT ${dnsmasq_port} -DEFAULT_DNS $DEFAULT_DNS -LOCAL_DNS $LOCAL_DNS \ + -USE_DIRECT_LIST "${use_direct_list}" -USE_PROXY_LIST "${use_proxy_list}" -USE_BLOCK_LIST "${use_block_list}" -USE_GFW_LIST "${use_gfw_list}" -CHN_LIST "${chn_list}" \ + -TUN_DNS "127.0.0.1#${_dns_port}" -REMOTE_FAKEDNS 0 -USE_DEFAULT_DNS "${use_default_dns:-direct}" -CHINADNS_DNS ${_china_ng_listen:-0} \ + -TCP_NODE $tcp_node -DEFAULT_PROXY_MODE ${tcp_proxy_mode} -NO_PROXY_IPV6 ${dnsmasq_filter_proxy_ipv6:-0} -NFTFLAG ${nftflag:-0} \ + -NO_LOGIC_LOG 1 + ln_run "$(first_type dnsmasq)" "dnsmasq_${sid}" "/dev/null" -C ${dnsmasq_conf} -x ${acl_path}/dnsmasq.pid + set_cache_var "ACL_${sid}_dns_port" "${dnsmasq_port}" + set_cache_var "node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)" "${dnsmasq_port}" + } + _redir_port=$(get_cache_var "node_${tcp_node}_redir_port") + _socks_port=$(get_cache_var "node_${tcp_node}_socks_port") + if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then + socks_port=${_socks_port} + tcp_port=${_redir_port} + _dnsmasq_port=$(get_cache_var "node_${tcp_node}_$(echo -n "${tcp_proxy_mode}${remote_dns}" | md5sum | cut -d " " -f1)") + if [ -z "${_dnsmasq_port}" ]; then + _dns_port=$(get_cache_var "node_${tcp_node}_$(echo -n "${remote_dns}" | md5sum | cut -d " " -f1)") + run_dns ${_dns_port} + else + [ -n "${_dnsmasq_port}" ] && set_cache_var "ACL_${sid}_dns_port" "${_dnsmasq_port}" + fi else - config_file="acl/${tcp_node}_SOCKS_${socks_port}.json" - run_socks flag=$tcp_node node=$tcp_node bind=127.0.0.1 socks_port=$socks_port config_file=$config_file - local log_file=$TMP_ACL_PATH/ipt2socks_${tcp_node}_${redir_port}.log - log_file="/dev/null" - run_ipt2socks flag=acl_${tcp_node} tcp_tproxy=${is_tproxy} local_port=$redir_port socks_address=127.0.0.1 socks_port=$socks_port log_file=$log_file + socks_port=$(get_new_port $(expr $socks_port + 1)) + set_cache_var "node_${tcp_node}_socks_port" "${socks_port}" + redir_port=$(get_new_port $(expr $redir_port + 1)) + set_cache_var "node_${tcp_node}_redir_port" "${redir_port}" + tcp_port=$redir_port + + local type=$(echo $(config_n_get $tcp_node type) | tr 'A-Z' 'a-z') + if [ -n "${type}" ] && ([ "${type}" = "sing-box" ] || [ "${type}" = "xray" ]); then + config_file="acl/${tcp_node}_TCP_${redir_port}.json" + _extra_param="socks_address=127.0.0.1 socks_port=$socks_port" + if [ "$dns_mode" = "sing-box" ] || [ "$dns_mode" = "xray" ]; then + dns_port=$(get_new_port $(expr $dns_port + 1)) + _dns_port=$dns_port + config_file=$(echo $config_file | sed "s/TCP_/DNS_${_dns_port}_TCP_/g") + remote_dns_doh=${remote_dns} + dnsmasq_filter_proxy_ipv6=0 + [ "$dns_mode" = "xray" ] && [ "$v2ray_dns_mode" = "tcp+doh" ] && remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} + _extra_param="dns_listen_port=${_dns_port} remote_dns_protocol=${v2ray_dns_mode} remote_dns_tcp_server=${remote_dns} remote_dns_doh=${remote_dns_doh} remote_dns_query_strategy=${DNS_QUERY_STRATEGY} dns_client_ip=${dns_client_ip} dns_query_strategy=${DNS_QUERY_STRATEGY}" + fi + [ -n "$udp_node" ] && ([ "$udp_node" = "tcp" ] || [ "$udp_node" = "$tcp_node" ]) && { + config_file=$(echo $config_file | sed "s/TCP_/TCP_UDP_/g") + _extra_param="${_extra_param} udp_redir_port=$redir_port" + } + config_file="$TMP_PATH/$config_file" + [ "${type}" = "sing-box" ] && type="singbox" + run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file + else + config_file="acl/${tcp_node}_SOCKS_${socks_port}.json" + run_socks flag=$tcp_node node=$tcp_node bind=127.0.0.1 socks_port=$socks_port config_file=$config_file + local log_file=$TMP_ACL_PATH/ipt2socks_${tcp_node}_${redir_port}.log + log_file="/dev/null" + run_ipt2socks flag=acl_${tcp_node} tcp_tproxy=${is_tproxy} local_port=$redir_port socks_address=127.0.0.1 socks_port=$socks_port log_file=$log_file + fi + run_dns ${_dns_port} fi - run_dns ${_dns_port} + set_cache_var "ACL_${sid}_tcp_node" "${tcp_node}" + set_cache_var "ACL_${sid}_tcp_redir_port" "${redir_port}" fi - set_cache_var "ACL_${sid}_tcp_node" "${tcp_node}" } fi - set_cache_var "ACL_${sid}_tcp_port" "${tcp_port}" } - [ "$udp_node" != "nil" ] && { - [ "$udp_node" = "tcp" ] && udp_node=$tcp_node + [ -n "$udp_node" ] && { if [ "$udp_node" = "default" ]; then - if [ "$TCP_UDP" = "0" ] && [ "$UDP_NODE" = "nil" ]; then - udp_node="nil" - unset udp_port - elif [ "$TCP_UDP" = "1" ] && [ "$udp_node" = "nil" ]; then - udp_node=$TCP_NODE - udp_port=$TCP_REDIR_PORT + local GLOBAL_UDP_NODE=$(get_cache_var "ACL_GLOBAL_UDP_node") + [ -n "${GLOBAL_UDP_NODE}" ] && GLOBAL_UDP_redir_port=$(get_cache_var "ACL_GLOBAL_UDP_redir_port") + if [ -n "${GLOBAL_UDP_NODE}" ]; then + set_cache_var "ACL_${sid}_udp_node" "${GLOBAL_UDP_NODE}" + set_cache_var "ACL_${sid}_udp_redir_port" "${GLOBAL_UDP_redir_port}" + set_cache_var "ACL_${sid}_udp_default" "1" else - udp_node=$UDP_NODE - udp_port=$UDP_REDIR_PORT + echolog " - 全局节点未启用,跳过【${remarks}】" fi - elif [ "$udp_node" = "$tcp_node" ]; then - udp_node=$tcp_node - udp_port=$tcp_port + elif [ "$udp_node" = "tcp" ]; then + udp_node=$(get_cache_var "ACL_${sid}_tcp_node") + udp_port=$(get_cache_var "ACL_${sid}_tcp_port") + set_cache_var "ACL_${sid}_udp_node" "${udp_node}" + set_cache_var "ACL_${sid}_udp_redir_port" "${udp_port}" else - [ "$(config_get_type $udp_node nil)" = "nodes" ] && { - if [ "$udp_node" = "$UDP_NODE" ]; then - udp_port=$UDP_REDIR_PORT + [ "$(config_get_type $udp_node)" = "nodes" ] && { + if [ -n "${GLOBAL_UDP_NODE}" ] && [ "$udp_node" = "${GLOBAL_UDP_NODE}" ]; then + set_cache_var "ACL_${sid}_udp_node" "${GLOBAL_UDP_NODE}" + set_cache_var "ACL_${sid}_udp_redir_port" "${GLOBAL_UDP_redir_port}" + set_cache_var "ACL_${sid}_udp_default" "1" else - _redir_port=$(eval echo \${node_${udp_node}_redir_port}) - _socks_port=$(eval echo \${node_${udp_node}_socks_port}) + _redir_port=$(get_cache_var "node_${udp_node}_redir_port") + _socks_port=$(get_cache_var "node_${udp_node}_socks_port") if [ -n "${_socks_port}" ] && [ -n "${_redir_port}" ]; then socks_port=${_socks_port} udp_port=${_redir_port} else socks_port=$(get_new_port $(expr $socks_port + 1)) - eval node_${udp_node}_socks_port=$socks_port + set_cache_var "node_${udp_node}_socks_port" "${socks_port}" redir_port=$(get_new_port $(expr $redir_port + 1)) - eval node_${udp_node}_redir_port=$redir_port + set_cache_var "node_${udp_node}_redir_port" "${redir_port}" udp_port=$redir_port local type=$(echo $(config_n_get $udp_node type) | tr 'A-Z' 'a-z') @@ -1904,12 +1950,12 @@ acl_app() { fi fi set_cache_var "ACL_${sid}_udp_node" "${udp_node}" + set_cache_var "ACL_${sid}_udp_redir_port" "${redir_port}" fi } fi - set_cache_var "ACL_${sid}_udp_port" "${udp_port}" } - unset enabled sid remarks sources interface use_global_config tcp_node udp_node use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode filter_proxy_ipv6 dns_mode remote_dns v2ray_dns_mode remote_dns_doh dns_client_ip + unset enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports use_global_config tcp_node udp_node use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode filter_proxy_ipv6 dns_mode remote_dns v2ray_dns_mode remote_dns_doh dns_client_ip unset _ip _mac _iprange _ipset _ip_or_mac source_list tcp_port udp_port config_file _extra_param unset _china_ng_listen _chinadns_local_dns _direct_dns_mode chinadns_ng_default_tag dnsmasq_filter_proxy_ipv6 done @@ -2013,9 +2059,9 @@ stop() { ENABLED=$(config_t_get global enabled 0) SOCKS_ENABLED=$(config_t_get global socks_enabled 0) TCP_REDIR_PORT=1041 -TCP_NODE=$(config_t_get global tcp_node nil) +TCP_NODE=$(config_t_get global tcp_node) UDP_REDIR_PORT=1051 -UDP_NODE=$(config_t_get global udp_node nil) +UDP_NODE=$(config_t_get global udp_node) TCP_UDP=0 if [ "$UDP_NODE" == "tcp" ]; then UDP_NODE=$TCP_NODE @@ -2024,8 +2070,8 @@ elif [ "$UDP_NODE" == "$TCP_NODE" ]; then TCP_UDP=1 fi [ "$ENABLED" == 1 ] && { - [ "$TCP_NODE" != "nil" ] && [ "$(config_get_type $TCP_NODE nil)" != "nil" ] && ENABLED_DEFAULT_ACL=1 - [ "$UDP_NODE" != "nil" ] && [ "$(config_get_type $UDP_NODE nil)" != "nil" ] && ENABLED_DEFAULT_ACL=1 + [ -n "$TCP_NODE" ] && [ "$(config_get_type $TCP_NODE)" == "nodes" ] && ENABLED_DEFAULT_ACL=1 + [ -n "$UDP_NODE" ] && [ "$(config_get_type $UDP_NODE)" == "nodes" ] && ENABLED_DEFAULT_ACL=1 } ENABLED_ACLS=$(config_t_get global acl_enable 0) [ "$ENABLED_ACLS" == 1 ] && { diff --git a/small/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua b/small/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua index 60e847dd81..704ffe83ad 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua @@ -307,8 +307,8 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end diff --git a/small/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua b/small/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua index 55153806fb..18d01d14b3 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua @@ -119,7 +119,6 @@ end function copy_instance(var) local LISTEN_PORT = var["-LISTEN_PORT"] - local DNSMASQ_CONF = var["-DNSMASQ_CONF"] local conf_lines = {} local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do @@ -127,14 +126,19 @@ function copy_instance(var) if line:find("passwall") then filter = true end if line:find("ubus") then filter = true end if line:find("dhcp") then filter = true end - if line:find("server") then filter = true end - if line:find("port") then filter = true end + if line:find("server=") == 1 then filter = true end + if line:find("port=") == 1 then filter = true end + if line:find("address=") == 1 or (line:find("server=") == 1 and line:find("/")) then filter = nil end if not filter then tinsert(conf_lines, line) end end tinsert(conf_lines, "port=" .. LISTEN_PORT) + if var["-return_table"] == "1" then + return conf_lines + end if #conf_lines > 0 then + local DNSMASQ_CONF = var["-DNSMASQ_CONF"] local conf_out = io.open(DNSMASQ_CONF, "a") conf_out:write(table.concat(conf_lines, "\n")) conf_out:close() @@ -498,8 +502,8 @@ function add_rule(var) local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end @@ -615,19 +619,7 @@ function add_rule(var) local conf_lines = {} if LISTEN_PORT then --Copy dnsmasq instance - local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") - for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do - local filter - if line:find("passwall") then filter = true end - if line:find("ubus") then filter = true end - if line:find("dhcp") then filter = true end - if line:find("server") then filter = true end - if line:find("port") then filter = true end - if not filter then - tinsert(conf_lines, line) - end - end - tinsert(conf_lines, "port=" .. LISTEN_PORT) + conf_lines = copy_instance({["-LISTEN_PORT"] = LISTEN_PORT, ["-return_table"] = "1"}) else --Modify the default dnsmasq service end diff --git a/small/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua b/small/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua index 06b54e77e9..17f891803a 100644 --- a/small/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua @@ -450,8 +450,8 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then local t = uci:get_all(appname, TCP_NODE) local default_node_id = t["default_node"] or "_direct" uci:foreach(appname, "shunt_rules", function(s) - local _node_id = t[s[".name"]] or "nil" - if _node_id ~= "nil" and _node_id ~= "_blackhole" then + local _node_id = t[s[".name"]] + if _node_id and _node_id ~= "_blackhole" then if _node_id == "_default" then _node_id = default_node_id end diff --git a/small/luci-app-passwall/root/usr/share/passwall/iptables.sh b/small/luci-app-passwall/root/usr/share/passwall/iptables.sh index 826297bf82..c5d23bac72 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -198,8 +198,6 @@ load_acl() { udp_proxy_drop_ports=${udp_proxy_drop_ports:-default} tcp_redir_ports=${tcp_redir_ports:-default} udp_redir_ports=${udp_redir_ports:-default} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} use_direct_list=${use_direct_list:-1} use_proxy_list=${use_proxy_list:-1} use_block_list=${use_block_list:-1} @@ -215,25 +213,17 @@ load_acl() { [ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS [ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node") + [ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node") - [ -n "$(get_cache_var "ACL_${sid}_tcp_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_port") - [ -n "$(get_cache_var "ACL_${sid}_udp_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_port") + [ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port") + [ -n "$tcp_node" ] && tcp_node_remark=$(config_n_get $tcp_node remarks) + [ -n "$udp_node" ] && udp_node_remark=$(config_n_get $udp_node remarks) use_shunt_tcp=0 use_shunt_udp=0 - [ "$tcp_node" != "nil" ] && { - tcp_node_remark=$(config_n_get $tcp_node remarks) - [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 - } - [ "$udp_node" != "nil" ] && { - udp_node_remark=$(config_n_get $udp_node remarks) - [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 - } - [ "$udp_node" == "tcp" ] && { - udp_node_remark=$tcp_node_remark - use_shunt_udp=$use_shunt_tcp - } + [ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 + [ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 [ "${use_global_config}" = "1" ] && { tcp_node_remark=$(config_n_get $TCP_NODE remarks) @@ -503,7 +493,7 @@ load_acl() { local DNS_REDIRECT [ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53 - if ([ "$TCP_NODE" != "nil" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then [ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT} else [ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT} @@ -566,7 +556,7 @@ load_acl() { # 加载TCP默认代理模式 if [ -n "${TCP_PROXY_MODE}" ]; then - [ "$TCP_NODE" != "nil" ] && { + [ -n "$TCP_NODE" ] && { msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]" if [ -n "${is_tproxy}" ]; then msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})" @@ -619,7 +609,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})" $ipt_m -A PSW $(comment "默认") -p udp -d $FAKE_IP -j PSW_RULE @@ -686,7 +676,7 @@ filter_server_port() { filter_node() { local node=${1} local stream=${2} - if [ -n "$node" ] && [ "$node" != "nil" ]; then + if [ -n "$node" ]; then local address=$(config_n_get $node address) local port=$(config_n_get $node port) [ -z "$address" ] && [ -z "$port" ] && { @@ -736,12 +726,12 @@ add_firewall_rule() { local USE_PROXY_LIST_ALL=${USE_PROXY_LIST} local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST} local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST} - local _TCP_NODE=$(config_t_get global tcp_node nil) - local _UDP_NODE=$(config_t_get global udp_node nil) + local _TCP_NODE=$(config_t_get global tcp_node) + local _UDP_NODE=$(config_t_get global udp_node) local USE_GEOVIEW=$(config_t_get global_rules enable_geoview) - [ "$_TCP_NODE" != "nil" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 - [ "$_UDP_NODE" != "nil" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 + [ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 + [ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 [ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do @@ -1012,7 +1002,7 @@ add_firewall_rule() { ip -6 rule add fwmark 1 table 100 ip -6 route add local ::/0 dev lo table 100 - [ "$TCP_UDP" = "1" ] && [ "$UDP_NODE" = "nil" ] && UDP_NODE=$TCP_NODE + [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE [ "$ENABLED_DEFAULT_ACL" == 1 ] && { local ipt_tmp=$ipt_n @@ -1046,7 +1036,7 @@ add_firewall_rule() { fi } - if ([ "$TCP_NODE" != "nil" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then [ -n "$DNS_REDIRECT_PORT" ] && { $ipt_n -A OUTPUT $(comment "PSW") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT $ip6t_n -A OUTPUT $(comment "PSW") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT 2>/dev/null @@ -1078,7 +1068,7 @@ add_firewall_rule() { } # 加载路由器自身代理 TCP - if [ "$TCP_NODE" != "nil" ]; then + if [ -n "$TCP_NODE" ]; then _proxy_tcp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then @@ -1156,7 +1146,7 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then diff --git a/small/luci-app-passwall/root/usr/share/passwall/nftables.sh b/small/luci-app-passwall/root/usr/share/passwall/nftables.sh index 27ff6638e2..4cf6f6ea74 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/nftables.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/nftables.sh @@ -258,8 +258,6 @@ load_acl() { udp_proxy_drop_ports=${udp_proxy_drop_ports:-default} tcp_redir_ports=${tcp_redir_ports:-default} udp_redir_ports=${udp_redir_ports:-default} - tcp_node=${tcp_node:-nil} - udp_node=${udp_node:-nil} use_direct_list=${use_direct_list:-1} use_proxy_list=${use_proxy_list:-1} use_block_list=${use_block_list:-1} @@ -275,25 +273,17 @@ load_acl() { [ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS [ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node") + [ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node") - [ -n "$(get_cache_var "ACL_${sid}_tcp_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_port") - [ -n "$(get_cache_var "ACL_${sid}_udp_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_port") + [ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port") [ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port") + [ -n "$tcp_node" ] && tcp_node_remark=$(config_n_get $tcp_node remarks) + [ -n "$udp_node" ] && udp_node_remark=$(config_n_get $udp_node remarks) use_shunt_tcp=0 use_shunt_udp=0 - [ "$tcp_node" != "nil" ] && { - tcp_node_remark=$(config_n_get $tcp_node remarks) - [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 - } - [ "$udp_node" != "nil" ] && { - udp_node_remark=$(config_n_get $udp_node remarks) - [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 - } - [ "$udp_node" == "tcp" ] && { - udp_node_remark=$tcp_node_remark - use_shunt_udp=$use_shunt_tcp - } + [ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1 + [ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1 [ "${use_global_config}" = "1" ] && { tcp_node_remark=$(config_n_get $TCP_NODE remarks) @@ -556,7 +546,7 @@ load_acl() { local DNS_REDIRECT [ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53 - if ([ "$TCP_NODE" != "nil" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then [ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT} else [ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT} @@ -621,7 +611,7 @@ load_acl() { # 加载TCP默认代理模式 if [ -n "${TCP_PROXY_MODE}" ]; then - [ "$TCP_NODE" != "nil" ] && { + [ -n "$TCP_NODE" ] && { msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]" if [ -n "${is_tproxy}" ]; then msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})" @@ -679,7 +669,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})" nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ip daddr $FAKE_IP counter jump PSW_RULE comment \"默认\"" @@ -753,7 +743,7 @@ filter_server_port() { filter_node() { local node=${1} local stream=${2} - if [ -n "$node" ] && [ "$node" != "nil" ]; then + if [ -n "$node" ]; then local address=$(config_n_get $node address) local port=$(config_n_get $node port) [ -z "$address" ] && [ -z "$port" ] && { @@ -811,12 +801,12 @@ add_firewall_rule() { local USE_PROXY_LIST_ALL=${USE_PROXY_LIST} local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST} local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST} - local _TCP_NODE=$(config_t_get global tcp_node nil) - local _UDP_NODE=$(config_t_get global udp_node nil) + local _TCP_NODE=$(config_t_get global tcp_node) + local _UDP_NODE=$(config_t_get global udp_node) local USE_GEOVIEW=$(config_t_get global_rules enable_geoview) - [ "$_TCP_NODE" != "nil" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 - [ "$_UDP_NODE" != "nil" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 + [ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1 + [ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1 [ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do @@ -1077,7 +1067,7 @@ add_firewall_rule() { ip -6 route add local ::/0 dev lo table 100 } - [ "$TCP_UDP" = "1" ] && [ "$UDP_NODE" = "nil" ] && UDP_NODE=$TCP_NODE + [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE [ "$ENABLED_DEFAULT_ACL" == 1 ] && { msg="【路由器本机】," @@ -1104,7 +1094,7 @@ add_firewall_rule() { fi } - if ([ "$TCP_NODE" != "nil" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ "$UDP_NODE" != "nil" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then + if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then [ -n "$DNS_REDIRECT_PORT" ] && { nft "add rule $NFTABLE_NAME nat_output ip protocol udp oif lo udp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW\"" nft "add rule $NFTABLE_NAME nat_output ip protocol tcp oif lo tcp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW\"" @@ -1136,7 +1126,7 @@ add_firewall_rule() { } # 加载路由器自身代理 TCP - if [ "$TCP_NODE" != "nil" ]; then + if [ -n "$TCP_NODE" ]; then _proxy_tcp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then @@ -1219,7 +1209,7 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ "$UDP_NODE" != "nil" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then diff --git a/small/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh b/small/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh index a7d403fa7a..60ff4b4133 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh @@ -61,8 +61,8 @@ test_proxy() { test_node() { local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { local _tmp_port=$(/usr/share/${CONFIG}/app.sh get_new_port 61080 tcp,udp) /usr/share/${CONFIG}/app.sh run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json local curlx="socks5h://127.0.0.1:${_tmp_port}" @@ -101,7 +101,7 @@ test_auto_switch() { fi #检测主节点是否能使用 - if [ "$restore_switch" == "1" ] && [ "$main_node" != "nil" ] && [ "$now_node" != "$main_node" ]; then + if [ "$restore_switch" == "1" ] && [ -n "$main_node" ] && [ "$now_node" != "$main_node" ]; then test_node ${main_node} [ $? -eq 0 ] && { #主节点正常,切换到主节点 @@ -159,7 +159,7 @@ start() { LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}_socks_auto_switch_${id}.lock LOG_EVENT_FILTER=$(uci -q get "${CONFIG}.global[0].log_event_filter" 2>/dev/null) LOG_EVENT_CMD=$(uci -q get "${CONFIG}.global[0].log_event_cmd" 2>/dev/null) - main_node=$(config_n_get $id node nil) + main_node=$(config_n_get $id node) socks_port=$(config_n_get $id port 0) delay=$(config_n_get $id autoswitch_testing_time 30) sleep 5s @@ -167,8 +167,8 @@ start() { retry_num=$(config_n_get $id autoswitch_retry_num 1) restore_switch=$(config_n_get $id autoswitch_restore_switch 0) probe_url=$(config_n_get $id autoswitch_probe_url "https://www.google.com/generate_204") - backup_node=$(config_n_get $id autoswitch_backup_node nil) - while [ -n "$backup_node" -a "$backup_node" != "nil" ]; do + backup_node=$(config_n_get $id autoswitch_backup_node) + while [ -n "$backup_node" ]; do [ -f "$LOCK_FILE" ] && { sleep 6s continue diff --git a/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 227e7ad703..d2ba44f244 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/small/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -264,7 +264,7 @@ do currentNode = _node_id and uci:get_all(appname, _node_id) or nil, remarks = "分流" .. e.remarks .. "节点", set = function(o, server) - if not server then server = "nil" end + if not server then server = "" end uci:set(appname, node_id, e[".name"], server) o.newNodeId = server end @@ -1263,10 +1263,10 @@ local function truncate_nodes(add_from) if config.currentNode and config.currentNode.add_mode == "2" then if add_from then if config.currentNode.add_from and config.currentNode.add_from == add_from then - config.set(config, "nil") + config.set(config, "") end else - config.set(config, "nil") + config.set(config, "") end if config.id then uci:delete(appname, config.id) @@ -1400,7 +1400,7 @@ local function select_node(nodes, config) config.set(config, server) end else - config.set(config, "nil") + config.set(config, "") end end diff --git a/small/luci-app-passwall/root/usr/share/passwall/tasks.sh b/small/luci-app-passwall/root/usr/share/passwall/tasks.sh index 2597a4170f..49760e9ff7 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/tasks.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/tasks.sh @@ -30,6 +30,33 @@ do if [ "$CFG_UPDATE_INT" -ne 0 ]; then + stop_week_mode=$(config_t_get global_delay stop_week_mode) + stop_interval_mode=$(config_t_get global_delay stop_interval_mode) + stop_interval_mode=$(expr "$stop_interval_mode" \* 60) + if [ -n "$stop_week_mode" ]; then + [ "$stop_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$stop_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG stop > /dev/null 2>&1 & + } + fi + + start_week_mode=$(config_t_get global_delay start_week_mode) + start_interval_mode=$(config_t_get global_delay start_interval_mode) + start_interval_mode=$(expr "$start_interval_mode" \* 60) + if [ -n "$start_week_mode" ]; then + [ "$start_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$start_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG start > /dev/null 2>&1 & + } + fi + + restart_week_mode=$(config_t_get global_delay restart_week_mode) + restart_interval_mode=$(config_t_get global_delay restart_interval_mode) + restart_interval_mode=$(expr "$restart_interval_mode" \* 60) + if [ -n "$restart_week_mode" ]; then + [ "$restart_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$restart_interval_mode")" -eq 0 ] && /etc/init.d/$CONFIG restart > /dev/null 2>&1 & + } + fi + autoupdate=$(config_t_get global_rules auto_update) weekupdate=$(config_t_get global_rules week_update) hourupdate=$(config_t_get global_rules interval_update) diff --git a/small/luci-app-passwall/root/usr/share/passwall/test.sh b/small/luci-app-passwall/root/usr/share/passwall/test.sh index 7752a26502..1f596e9292 100755 --- a/small/luci-app-passwall/root/usr/share/passwall/test.sh +++ b/small/luci-app-passwall/root/usr/share/passwall/test.sh @@ -56,8 +56,8 @@ test_proxy() { url_test_node() { result=0 local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { if [ "${_type}" == "socks" ]; then local _address=$(config_n_get ${node_id} address) local _port=$(config_n_get ${node_id} port) @@ -85,8 +85,8 @@ url_test_node() { test_node() { local node_id=$1 - local _type=$(echo $(config_n_get ${node_id} type nil) | tr 'A-Z' 'a-z') - [ "${_type}" != "nil" ] && { + local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') + [ -n "${_type}" ] && { if [ "${_type}" == "socks" ]; then local _address=$(config_n_get ${node_id} address) local _port=$(config_n_get ${node_id} port) diff --git a/small/luci-app-passwall2/Makefile b/small/luci-app-passwall2/Makefile index 29fe817222..2ec6533cf3 100644 --- a/small/luci-app-passwall2/Makefile +++ b/small/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=24.12.16 +PKG_VERSION:=24.12.19 PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ diff --git a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index 3b266a42cd..bf77992e9c 100644 --- a/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/small/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -94,6 +94,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then m:set(shunt_node_id, option, value) end end + local function get_remove(shunt_node_id, option) + return function(self, section) + m:del(shunt_node_id, option) + end + end if #normal_list > 0 then for k, v in pairs(shunt_list) do local vid = v.id @@ -148,8 +153,8 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, node_option, string.format('* %s', api.url("shunt_rules", id), e.remarks)) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) - o.default = "" o:value("", translate("Close")) o:value("_default", translate("Default")) o:value("_direct", translate("Direct Connection")) @@ -158,7 +163,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* %s', e.remarks .. " " .. translate("Preproxy"))) pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag") pt.write = get_write(v.id, id .. "_proxy_tag") - pt.default = "" + pt.remove = get_remove(v.id, id .. "_proxy_tag") pt:value("", translate("Close")) pt:value("main", translate("Preproxy Node")) for k1, v1 in pairs(socks_list) do @@ -181,6 +186,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default"))) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:depends("node", v.id) o.default = "_direct" o:value("_direct", translate("Direct Connection")) @@ -202,6 +208,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o.cfgvalue = get_cfgvalue(v.id, id) o.write = get_write(v.id, id) + o.remove = get_remove(v.id, id) o:value("", translate("Close")) o:value("main", translate("Preproxy Node")) for k1, v1 in pairs(normal_list) do diff --git a/small/luci-app-passwall2/luasrc/passwall2/api.lua b/small/luci-app-passwall2/luasrc/passwall2/api.lua index 7a1b85a403..a5939ed7f4 100644 --- a/small/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/small/luci-app-passwall2/luasrc/passwall2/api.lua @@ -207,6 +207,28 @@ function repeat_exist(table, value) return false end +function remove(...) + for index, value in ipairs({...}) do + if value and #value > 0 and value ~= "/" then + sys.call(string.format("rm -rf %s", value)) + end + end +end + +function is_install(package) + if package and #package > 0 then + local file_path = "/usr/lib/opkg/info" + local file_ext = ".control" + local has = sys.call("[ -d " .. file_path .. " ]") + if has == 0 then + file_path = "/lib/apk/packages" + file_ext = ".list" + end + return sys.call(string.format('[ -s "%s/%s%s" ]', file_path, package, file_ext)) == 0 + end + return false +end + function get_args(arg) local var = {} for i, arg_k in pairs(arg) do diff --git a/small/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/small/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 95c1851c98..2fbdd68807 100644 --- a/small/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/small/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -950,7 +950,7 @@ function gen_config(var) rule_outboundTag = "block" elseif _node_id == "_default" and rule_name ~= "default" then rule_outboundTag = "default" - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil if socks_node then diff --git a/small/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/small/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 5f94df0420..981998fa95 100644 --- a/small/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/small/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -848,7 +848,7 @@ function gen_config(var) return "blackhole", nil elseif _node_id == "_default" then return "default", nil - elseif _node_id:find("Socks_") then + elseif _node_id and _node_id:find("Socks_") then local socks_id = _node_id:sub(1 + #"Socks_") local socks_node = uci:get_all(appname, socks_id) or nil local socks_tag diff --git a/small/luci-app-passwall2/root/usr/share/passwall2/app.sh b/small/luci-app-passwall2/root/usr/share/passwall2/app.sh index 3ebe1e57e1..3ea4c2fde8 100755 --- a/small/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/small/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -991,73 +991,33 @@ start_haproxy() { [ "$(config_t_get global_haproxy balancing_enable 0)" != "1" ] && return haproxy_path=$TMP_PATH/haproxy haproxy_conf="config.cfg" - lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS} + lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS:-${AUTO_DNS}} ln_run "$(first_type haproxy)" haproxy "/dev/null" -f "${haproxy_path}/${haproxy_conf}" } -run_ipset_dns_server() { - if [ -n "$(first_type chinadns-ng)" ]; then - run_ipset_chinadns_ng $@ - else - run_ipset_dnsmasq $@ - fi -} - -gen_dnsmasq_items() { - local dnss settype setnames outf ipsetoutf - eval_set_val $@ - - awk -v dnss="${dnss}" -v settype="${settype}" -v setnames="${setnames}" -v outf="${outf}" -v ipsetoutf="${ipsetoutf}" ' - BEGIN { - if(outf == "") outf="/dev/stdout"; - if(ipsetoutf == "") ipsetoutf=outf; - split(dnss, dns, ","); setdns=length(dns)>0; setlist=length(setnames)>0; - if(setdns) for(i in dns) if(length(dns[i])==0) delete dns[i]; - fail=1; - } - ! /^$/&&!/^#/ { - fail=0 - if(setdns) for(i in dns) printf("server=/.%s/%s\n", $0, dns[i]) >>outf; - if(setlist) printf("%s=/.%s/%s\n", settype, $0, setnames) >>ipsetoutf; - } - END {fflush(outf); close(outf); fflush(ipsetoutf); close(ipsetoutf); exit(fail);} - ' -} - run_copy_dnsmasq() { local flag listen_port tun_dns eval_set_val $@ local dnsmasq_conf=$TMP_ACL_PATH/$flag/dnsmasq.conf local dnsmasq_conf_path=$TMP_ACL_PATH/$flag/dnsmasq.d mkdir -p $dnsmasq_conf_path - [ -s "/tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID}" ] && { - cp -r /tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID} $dnsmasq_conf - sed -i "/passwall2/d" $dnsmasq_conf - sed -i "/ubus/d" $dnsmasq_conf - sed -i "/dhcp/d" $dnsmasq_conf - sed -i "/port=/d" $dnsmasq_conf - sed -i "/server=/d" $dnsmasq_conf - } - local set_type="ipset" - [ "${nftflag}" = "1" ] && { - set_type="nftset" - local setflag_4="4#inet#passwall2#" - local setflag_6="6#inet#passwall2#" - } - cat <<-EOF >> $dnsmasq_conf - port=${listen_port} - conf-dir=${dnsmasq_conf_path} - server=${tun_dns} - no-poll - no-resolv - EOF - awk '!seen[$0]++' $dnsmasq_conf > /tmp/dnsmasq.tmp && mv /tmp/dnsmasq.tmp $dnsmasq_conf - node_servers=$(uci show "${CONFIG}" | grep -E "(.address=|.download_address=)" | cut -d "'" -f 2) - hosts_foreach "node_servers" host_from_url | grep '[a-zA-Z]$' | sort -u | grep -v "engage.cloudflareclient.com" | gen_dnsmasq_items settype="${set_type}" setnames="${setflag_4}passwall2_vpslist,${setflag_6}passwall2_vpslist6" dnss="${LOCAL_DNS:-${AUTO_DNS}}" outf="${dnsmasq_conf_path}/10-vpslist_host.conf" ipsetoutf="${dnsmasq_conf_path}/ipset.conf" + lua $APP_PATH/helper_dnsmasq.lua copy_instance -LISTEN_PORT ${listen_port} -DNSMASQ_CONF ${dnsmasq_conf} + lua $APP_PATH/helper_dnsmasq.lua add_rule -FLAG "${flag}" -TMP_DNSMASQ_PATH ${dnsmasq_conf_path} -DNSMASQ_CONF_FILE ${dnsmasq_conf} \ + -DEFAULT_DNS ${AUTO_DNS} -LOCAL_DNS ${LOCAL_DNS:-${AUTO_DNS}} -TUN_DNS ${tun_dns} \ + -NFTFLAG ${nftflag:-0} \ + -NO_LOGIC_LOG ${NO_LOGIC_LOG:-0} ln_run "$(first_type dnsmasq)" "dnsmasq_${flag}" "/dev/null" -C $dnsmasq_conf -x $TMP_ACL_PATH/$flag/dnsmasq.pid set_cache_var "ACL_${flag}_dns_port" "${listen_port}" } +run_ipset_dns_server() { + if [ -n "$(first_type chinadns-ng)" ]; then + run_ipset_chinadns_ng $@ + else + run_ipset_dnsmasq $@ + fi +} + run_ipset_chinadns_ng() { local listen_port server_dns ipset nftset config_file eval_set_val $@ diff --git a/small/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua b/small/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua new file mode 100644 index 0000000000..9e93b68ef7 --- /dev/null +++ b/small/luci-app-passwall2/root/usr/share/passwall2/helper_dnsmasq.lua @@ -0,0 +1,355 @@ +local api = require "luci.passwall2.api" +local appname = "passwall2" +local uci = api.uci +local sys = api.sys +local fs = api.fs +local datatypes = api.datatypes +local TMP = {} + +local function tinsert(table_name, val) + if table_name and type(table_name) == "table" then + if not TMP[table_name] then + TMP[table_name] = {} + end + if TMP[table_name][val] then + return false + end + table.insert(table_name, val) + TMP[table_name][val] = true + return true + end + return false +end + +local function backup_servers() + local DNSMASQ_DNS = uci:get("dhcp", "@dnsmasq[0]", "server") + if DNSMASQ_DNS and #DNSMASQ_DNS > 0 then + uci:set(appname, "@global[0]", "dnsmasq_servers", DNSMASQ_DNS) + uci:commit(appname) + end +end + +local function restore_servers() + local dns_table = {} + local DNSMASQ_DNS = uci:get("dhcp", "@dnsmasq[0]", "server") + if DNSMASQ_DNS and #DNSMASQ_DNS > 0 then + for k, v in ipairs(DNSMASQ_DNS) do + tinsert(dns_table, v) + end + end + local OLD_SERVER = uci:get(appname, "@global[0]", "dnsmasq_servers") + if OLD_SERVER and #OLD_SERVER > 0 then + for k, v in ipairs(OLD_SERVER) do + tinsert(dns_table, v) + end + uci:delete(appname, "@global[0]", "dnsmasq_servers") + uci:commit(appname) + end + if dns_table and #dns_table > 0 then + uci:set_list("dhcp", "@dnsmasq[0]", "server", dns_table) + uci:commit("dhcp") + end +end + +function stretch() + local dnsmasq_server = uci:get("dhcp", "@dnsmasq[0]", "server") + local dnsmasq_noresolv = uci:get("dhcp", "@dnsmasq[0]", "noresolv") + local _flag + if dnsmasq_server and #dnsmasq_server > 0 then + for k, v in ipairs(dnsmasq_server) do + if not v:find("/") then + _flag = true + end + end + end + if not _flag and dnsmasq_noresolv == "1" then + uci:delete("dhcp", "@dnsmasq[0]", "noresolv") + local RESOLVFILE = "/tmp/resolv.conf.d/resolv.conf.auto" + local file = io.open(RESOLVFILE, "r") + if not file then + RESOLVFILE = "/tmp/resolv.conf.auto" + else + local size = file:seek("end") + file:close() + if size == 0 then + RESOLVFILE = "/tmp/resolv.conf.auto" + end + end + uci:set("dhcp", "@dnsmasq[0]", "resolvfile", RESOLVFILE) + uci:commit("dhcp") + end +end + +function restart(var) + local LOG = var["-LOG"] + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + if LOG == "1" then + api.log("重启 dnsmasq 服务") + end +end + +function logic_restart(var) + local LOG = var["-LOG"] + local DEFAULT_DNS = api.get_cache_var("DEFAULT_DNS") + if DEFAULT_DNS then + backup_servers() + --sys.call("sed -i '/list server/d' /etc/config/dhcp >/dev/null 2>&1") + local dns_table = {} + local dnsmasq_server = uci:get("dhcp", "@dnsmasq[0]", "server") + if dnsmasq_server and #dnsmasq_server > 0 then + for k, v in ipairs(dnsmasq_server) do + if v:find("/") then + tinsert(dns_table, v) + end + end + if dns_table and #dns_table > 0 then + uci:set_list("dhcp", "@dnsmasq[0]", "server", dns_table) + uci:commit("dhcp") + end + end + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + restore_servers() + else + sys.call("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + end + if LOG == "1" then + api.log("重启 dnsmasq 服务") + end +end + +function copy_instance(var) + local LISTEN_PORT = var["-LISTEN_PORT"] + local conf_lines = {} + local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')") + for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do + local filter + if line:find("passwall2") then filter = true end + if line:find("ubus") then filter = true end + if line:find("dhcp") then filter = true end + if line:find("server=") == 1 then filter = true end + if line:find("port=") == 1 then filter = true end + if line:find("address=") == 1 or (line:find("server=") == 1 and line:find("/")) then filter = nil end + if not filter then + tinsert(conf_lines, line) + end + end + tinsert(conf_lines, "port=" .. LISTEN_PORT) + if var["-return_table"] == "1" then + return conf_lines + end + if #conf_lines > 0 then + local DNSMASQ_CONF = var["-DNSMASQ_CONF"] + local conf_out = io.open(DNSMASQ_CONF, "a") + conf_out:write(table.concat(conf_lines, "\n")) + conf_out:write("\n") + conf_out:close() + end +end + +function add_rule(var) + local FLAG = var["-FLAG"] + local TMP_DNSMASQ_PATH = var["-TMP_DNSMASQ_PATH"] + local DNSMASQ_CONF_FILE = var["-DNSMASQ_CONF_FILE"] + local LISTEN_PORT = var["-LISTEN_PORT"] + local DEFAULT_DNS = var["-DEFAULT_DNS"] + local LOCAL_DNS = var["-LOCAL_DNS"] + local TUN_DNS = var["-TUN_DNS"] + local NO_LOGIC_LOG = var["-NO_LOGIC_LOG"] + local NFTFLAG = var["-NFTFLAG"] + local CACHE_PATH = api.CACHE_PATH + local CACHE_FLAG = "dnsmasq_" .. FLAG + local CACHE_DNS_PATH = CACHE_PATH .. "/" .. CACHE_FLAG + local CACHE_TEXT_FILE = CACHE_DNS_PATH .. ".txt" + + local list1 = {} + local excluded_domain = {} + local excluded_domain_str = "!" + + local function check_dns(domain, dns) + if domain == "" or domain:find("#") then + return false + end + if not dns then + return + end + for k,v in ipairs(list1[domain].dns) do + if dns == v then + return true + end + end + return false + end + + local function check_ipset(domain, ipset) + if domain == "" or domain:find("#") then + return false + end + if not ipset then + return + end + for k,v in ipairs(list1[domain].ipsets) do + if ipset == v then + return true + end + end + return false + end + + local function set_domain_dns(domain, dns) + if domain == "" or domain:find("#") then + return + end + if not dns then + return + end + if not list1[domain] then + list1[domain] = { + dns = {}, + ipsets = {} + } + end + for line in string.gmatch(dns, '[^' .. "," .. ']+') do + if not check_dns(domain, line) then + table.insert(list1[domain].dns, line) + end + end + end + + local function set_domain_ipset(domain, ipset) + if domain == "" or domain:find("#") then + return + end + if not ipset then + return + end + if not list1[domain] then + list1[domain] = { + dns = {}, + ipsets = {} + } + end + for line in string.gmatch(ipset, '[^' .. "," .. ']+') do + if not check_ipset(domain, line) then + table.insert(list1[domain].ipsets, line) + end + end + end + + local cache_text = "" + local nodes_address_md5 = sys.exec("echo -n $(uci show passwall2 | grep '\\.address') | md5sum") + local new_text = TMP_DNSMASQ_PATH .. DNSMASQ_CONF_FILE .. DEFAULT_DNS .. LOCAL_DNS .. TUN_DNS .. nodes_address_md5 .. NFTFLAG + if fs.access(CACHE_TEXT_FILE) then + for line in io.lines(CACHE_TEXT_FILE) do + cache_text = line + end + end + + if cache_text ~= new_text then + api.remove(CACHE_DNS_PATH .. "*") + end + + local dnsmasq_default_dns = TUN_DNS + + local setflag_4= (NFTFLAG == "1") and "4#inet#passwall2#" or "" + local setflag_6= (NFTFLAG == "1") and "6#inet#passwall2#" or "" + + if not fs.access(CACHE_DNS_PATH) then + fs.mkdir(CACHE_DNS_PATH) + + local fwd_dns + + --始终用国内DNS解析节点域名 + if true then + fwd_dns = LOCAL_DNS + uci:foreach(appname, "nodes", function(t) + local function process_address(address) + if address == "engage.cloudflareclient.com" then return end + if datatypes.hostname(address) then + set_domain_dns(address, fwd_dns) + set_domain_ipset(address, setflag_4 .. "passwall2_vpslist," .. setflag_6 .. "passwall2_vpslist6") + end + end + process_address(t.address) + process_address(t.download_address) + end) + end + + if list1 and next(list1) then + local server_out = io.open(CACHE_DNS_PATH .. "/001-server.conf", "a") + local ipset_out = io.open(CACHE_DNS_PATH .. "/ipset.conf", "a") + local set_name = "ipset" + if NFTFLAG == "1" then + set_name = "nftset" + end + for key, value in pairs(list1) do + if value.dns and #value.dns > 0 then + for i, dns in ipairs(value.dns) do + server_out:write(string.format("server=/.%s/%s", key, dns) .. "\n") + end + end + if value.ipsets and #value.ipsets > 0 then + local ipsets_str = "" + for i, ipset in ipairs(value.ipsets) do + ipsets_str = ipsets_str .. ipset .. "," + end + ipsets_str = ipsets_str:sub(1, #ipsets_str - 1) + ipset_out:write(string.format("%s=/.%s/%s", set_name, key, ipsets_str) .. "\n") + end + end + server_out:close() + ipset_out:close() + end + + local f_out = io.open(CACHE_TEXT_FILE, "a") + f_out:write(new_text) + f_out:close() + end + + if api.is_install("procd\\-ujail") then + fs.copyr(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) + else + api.remove(TMP_DNSMASQ_PATH) + fs.symlink(CACHE_DNS_PATH, TMP_DNSMASQ_PATH) + end + + if DNSMASQ_CONF_FILE ~= "nil" then + local conf_lines = {} + if LISTEN_PORT then + --Copy dnsmasq instance + conf_lines = copy_instance({["-LISTEN_PORT"] = LISTEN_PORT, ["-return_table"] = "1"}) + else + --Modify the default dnsmasq service + end + tinsert(conf_lines, string.format("conf-dir=%s", TMP_DNSMASQ_PATH)) + if dnsmasq_default_dns then + for s in string.gmatch(dnsmasq_default_dns, '[^' .. "," .. ']+') do + tinsert(conf_lines, string.format("server=%s", s)) + end + tinsert(conf_lines, "all-servers") + tinsert(conf_lines, "no-poll") + tinsert(conf_lines, "no-resolv") + + if FLAG == "default" then + api.set_cache_var("DEFAULT_DNS", DEFAULT_DNS) + end + end + if #conf_lines > 0 then + local conf_out = io.open(DNSMASQ_CONF_FILE, "a") + conf_out:write(table.concat(conf_lines, "\n")) + conf_out:close() + end + end +end + +_G.stretch = stretch +_G.restart = restart +_G.logic_restart = logic_restart +_G.copy_instance = copy_instance +_G.add_rule = add_rule + +if arg[1] then + local func =_G[arg[1]] + if func then + func(api.get_function_args(arg)) + end +end diff --git a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua index 2b91c2cf8b..ee288c8065 100644 --- a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua +++ b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -618,8 +618,7 @@ o:depends({type = "v2ray", v2ray_protocol = "socks"}) -- 传输协议 o = s:option(ListValue, "transport", translate("Transport")) -o:value("tcp", "TCP") -o:value("raw", "RAW") +o:value("raw", "RAW (TCP)") o:value("kcp", "mKCP") o:value("ws", "WebSocket") o:value("httpupgrade", "HTTPUpgrade") @@ -635,17 +634,9 @@ o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"}) o:depends({type = "v2ray", v2ray_protocol = "socks"}) o:depends({type = "v2ray", v2ray_protocol = "http"}) --- [[ TCP部分 ]]-- +-- [[ RAW部分 ]]-- -- TCP伪装 o = s:option(ListValue, "tcp_guise", translate("Camouflage Type")) -o:depends("transport", "tcp") -o:value("none", translate("None")) -o:value("http", "HTTP") -o.rmempty = true - --- [[ RAW部分 ]]-- --- RAW伪装 -o = s:option(ListValue, "raw_guise", translate("Camouflage Type")) o:depends("transport", "raw") o:value("none", translate("None")) o:value("http", "HTTP") @@ -654,13 +645,11 @@ o.rmempty = true -- HTTP域名 o = s:option(Value, "http_host", translate("HTTP Host")) o:depends("tcp_guise", "http") -o:depends("raw_guise", "http") o.rmempty = true -- HTTP路径 o = s:option(Value, "http_path", translate("HTTP Path")) o:depends("tcp_guise", "http") -o:depends("raw_guise", "http") o.rmempty = true -- [[ WS部分 ]]-- @@ -935,12 +924,15 @@ if is_finded("xray") then -- [[ XTLS ]]-- o = s:option(ListValue, "tls_flow", translate("Flow")) for _, v in ipairs(tls_flows) do - o:value(v, translate(v)) + if v == "none" then + o.default = "none" + o:value("none", translate("none")) + else + o:value(v, translate(v)) + end end o.rmempty = true - o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", tls = true}) o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", tls = true}) - o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", reality = true}) o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", reality = true}) -- [[ uTLS ]]-- diff --git a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua index 070fb5b9bf..956f8959d4 100644 --- a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua +++ b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua @@ -1,5 +1,6 @@ require "luci.ip" require "nixio.fs" +require "luci.sys" local m, s, o m = Map("shadowsocksr") @@ -140,4 +141,11 @@ o.remove = function(self, section, value) nixio.fs.writefile(netflixconf, "") end +if luci.sys.call('[ -f "/www/luci-static/resources/uci.js" ]') == 0 then + m.apply_on_parse = true + function m.on_apply(self) + luci.sys.call("/etc/init.d/shadowsocksr reload > /dev/null 2>&1 &") + end +end + return m diff --git a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua index d1850cca71..a7166abdbf 100644 --- a/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua +++ b/small/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua @@ -29,7 +29,7 @@ o:value("5", translate("Every Friday")) o:value("6", translate("Every Saturday")) o:value("0", translate("Every Sunday")) o.default = "*" -o.rmempty = false +o.rmempty = true o:depends("auto_update", "1") o = s:option(ListValue, "auto_update_day_time", translate("Update time (every day)")) @@ -37,7 +37,7 @@ for t = 0, 23 do o:value(t, t .. ":00") end o.default = 2 -o.rmempty = false +o.rmempty = true o:depends("auto_update", "1") o = s:option(ListValue, "auto_update_min_time", translate("Update Interval (min)")) @@ -45,7 +45,7 @@ for i = 0, 59 do o:value(i, i .. ":00") end o.default = 30 -o.rmempty = false +o.rmempty = true o:depends("auto_update", "1") o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL")) diff --git a/small/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm b/small/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm index 0e19670446..f3d9f15ae7 100644 --- a/small/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm +++ b/small/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm @@ -254,11 +254,12 @@ function import_ssr_url(btn, urlname, sid) { document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = ssm.port; document.getElementsByName('cbid.shadowsocksr.' + sid + '.alter_id')[0].value = ssm.aid; document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = ssm.id; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = ssm.net; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = + (ssm.net === "raw" || ssm.net === "tcp") ? "raw" : ssm.net; document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event); - if (ssm.net == "tcp") { + if (ssm.net === "raw" || ssm.net === "tcp") { if (ssm.type && ssm.type != "http") { - ssm.type = "none" + ssm.type = "none"; } else { document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = ssm.host; document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = ssm.path; @@ -294,8 +295,10 @@ function import_ssr_url(btn, urlname, sid) { document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].dispatchEvent(event); document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = ssm.sni || ssm.host; } + if (ssm.mux !== undefined) { document.getElementsByName('cbid.shadowsocksr.' + sid + '.mux')[0].checked = true; document.getElementsByName('cbid.shadowsocksr.' + sid + '.mux')[0].dispatchEvent(event); + } s.innerHTML = "<%:Import configuration information successfully.%>"; return false; case "vless": @@ -306,85 +309,98 @@ function import_ssr_url(btn, urlname, sid) { alert(e) return false; } - - document.getElementsByName('cbid.shadowsocksr.' + sid + '.alias')[0].value = url.hash ? decodeURIComponent(url.hash.slice(1)) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].value = "v2ray"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].dispatchEvent(event); - document.getElementsByName('cbid.shadowsocksr.' + sid + '.v2ray_protocol')[0].value = "vless"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.v2ray_protocol')[0].dispatchEvent(event); - document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = url.hostname; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = url.port || "80"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = url.username; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = - params.get("type") == "http" ? "h2" : - (params.get("type") == "raw" ? "raw" : - (params.get("type") || "tcp")); - document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event); - document.getElementsByName('cbid.shadowsocksr.' + sid + '.vless_encryption')[0].value = params.get("encryption") || "none"; + // Check if the elements exist before trying to modify them + function setElementValue(name, value) { + const element = document.getElementsByName(name)[0]; + if (element) { + if (element.type === "checkbox" || element.type === "radio") { + element.checked = value === true; + } else { + element.value = value; + } + } + } + function dispatchEventIfExists(name, event) { + const element = document.getElementsByName(name)[0]; + if (element) { + element.dispatchEvent(event); + } + } + setElementValue('cbid.shadowsocksr.' + sid + '.alias', url.hash ? decodeURIComponent(url.hash.slice(1)) : ""); + setElementValue('cbid.shadowsocksr.' + sid + '.type', "v2ray"); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.type', event); + setElementValue('cbid.shadowsocksr.' + sid + '.v2ray_protocol', "vless"); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.v2ray_protocol', event); + setElementValue('cbid.shadowsocksr.' + sid + '.server', url.hostname); + setElementValue('cbid.shadowsocksr.' + sid + '.server_port', url.port || "80"); + setElementValue('cbid.shadowsocksr.' + sid + '.vmess_id', url.username); + setElementValue('cbid.shadowsocksr.' + sid + '.transport', + params.get("type") === "http" ? "h2" : + (["tcp", "raw"].includes(params.get("type")) ? "raw" : + (params.get("type") || "tcp")) + ); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.transport', event); + setElementValue('cbid.shadowsocksr.' + sid + '.vless_encryption', params.get("encryption") || "none"); if ([ "tls", "xtls", "reality" ].includes(params.get("security"))) { - document.getElementsByName('cbid.shadowsocksr.' + sid + '.' + params.get("security"))[0].checked = true; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.' + params.get("security"))[0].dispatchEvent(event); + setElementValue('cbid.shadowsocksr.' + sid + '.' + params.get("security"), true); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.' + params.get("security"), event); if (params.get("security") === "reality") { - document.getElementsByName('cbid.shadowsocksr.' + sid + '.reality_publickey')[0].value = params.get("pbk") ? decodeURIComponent(params.get("pbk")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.reality_shortid')[0].value = params.get("sid") || ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.reality_spiderx')[0].value = params.get("spx") ? decodeURIComponent(params.get("spx")) : ""; + setElementValue('cbid.shadowsocksr.' + sid + '.reality_publickey', params.get("pbk") ? decodeURIComponent(params.get("pbk")) : ""); + setElementValue('cbid.shadowsocksr.' + sid + '.reality_shortid', params.get("sid") || ""); + setElementValue('cbid.shadowsocksr.' + sid + '.reality_spiderx', params.get("spx") ? decodeURIComponent(params.get("spx")) : ""); } - if (params.get("security") === "xtls") { - document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_flow')[0].value = params.get("flow") || ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_flow')[0].dispatchEvent(event); - } - document.getElementsByName('cbid.shadowsocksr.' + sid + '.fingerprint')[0].value = params.get("fp") || ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = params.get("sni") || ""; + setElementValue('cbid.shadowsocksr.' + sid + '.tls_flow', params.get("flow") || "none"); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tls_flow', event); + + setElementValue('cbid.shadowsocksr.' + sid + '.fingerprint', params.get("fp") || ""); + setElementValue('cbid.shadowsocksr.' + sid + '.tls_host', params.get("sni") || ""); } switch (params.get("type")) { case "ws": - if (params.get("security") !== "tls") - document.getElementsByName('cbid.shadowsocksr.' + sid + '.ws_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.ws_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "/"; + if (params.get("security") !== "tls") { + setElementValue('cbid.shadowsocksr.' + sid + '.ws_host', params.get("host") ? decodeURIComponent(params.get("host")) : ""); + } + setElementValue('cbid.shadowsocksr.' + sid + '.ws_path', params.get("path") ? decodeURIComponent(params.get("path")) : "/"); break; case "httpupgrade": - if (params.get("security") !== "tls") - document.getElementsByName('cbid.shadowsocksr.' + sid + '.httpupgrade_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.httpupgrade_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "/"; + if (params.get("security") !== "tls") { + setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_host', params.get("host") ? decodeURIComponent(params.get("host")) : ""); + } + setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_path', params.get("path") ? decodeURIComponent(params.get("path")) : "/"); break; case "splithttp": - if (params.get("security") !== "tls") - document.getElementsByName('cbid.shadowsocksr.' + sid + '.splithttp_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.splithttp_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "/"; + if (params.get("security") !== "tls") { + setElementValue('cbid.shadowsocksr.' + sid + '.splithttp_host', params.get("host") ? decodeURIComponent(params.get("host")) : ""); + } + setElementValue('cbid.shadowsocksr.' + sid + '.splithttp_path', params.get("path") ? decodeURIComponent(params.get("path")) : "/"); break; case "kcp": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_guise')[0].value = params.get("headerType") || "none"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.seed')[0].value = params.get("seed") || ""; + setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.get("headerType") || "none"); + setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.get("seed") || ""); break; case "http": /* this is non-standard, bullshit */ case "h2": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.h2_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.h2_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : ""; + setElementValue('cbid.shadowsocksr.' + sid + '.h2_host', params.get("host") ? decodeURIComponent(params.get("host")) : ""); + setElementValue('cbid.shadowsocksr.' + sid + '.h2_path', params.get("path") ? decodeURIComponent(params.get("path")) : ""); break; case "quic": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.quic_guise')[0].value = params.get("headerType") || "none"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.quic_security')[0].value = params.get("quicSecurity") || "none"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.quic_key')[0].value = params.get("key") || ""; + setElementValue('cbid.shadowsocksr.' + sid + '.quic_guise', params.get("headerType") || "none"); + setElementValue('cbid.shadowsocksr.' + sid + '.quic_security', params.get("quicSecurity") || "none"); + setElementValue('cbid.shadowsocksr.' + sid + '.quic_key', params.get("key") || ""); break; case "grpc": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.serviceName')[0].value = params.get("serviceName") || ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.grpc_mode')[0].value = params.get("mode") || "gun"; + setElementValue('cbid.shadowsocksr.' + sid + '.serviceName', params.get("serviceName") || ""); + setElementValue('cbid.shadowsocksr.' + sid + '.grpc_mode', params.get("mode") || "gun"); break; case "tcp": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.tcp_guise')[0].value = params.get("headerType") || "none"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.tcp_guise')[0].dispatchEvent(event); - if (params.get("headerType") === "http") { - document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : ""; - } case "raw": - document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].value = params.get("headerType") || "none"; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].dispatchEvent(event); + setElementValue('cbid.shadowsocksr.' + sid + '.tcp_guise', params.get("headerType") || "none"); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tcp_guise', event); if (params.get("headerType") === "http") { - document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : ""; + setElementValue('cbid.shadowsocksr.' + sid + '.http_host', params.get("host") ? decodeURIComponent(params.get("host")) : ""); + setElementValue('cbid.shadowsocksr.' + sid + '.http_path', params.get("path") ? decodeURIComponent(params.get("path")) : ""); } break; } diff --git a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index 569b462633..d80aac1525 100755 --- a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua @@ -28,7 +28,7 @@ function vmess_vless() alterId = (server.v2ray_protocol == "vmess" or not server.v2ray_protocol) and tonumber(server.alter_id) or nil, security = (server.v2ray_protocol == "vmess" or not server.v2ray_protocol) and server.security or nil, encryption = (server.v2ray_protocol == "vless") and server.vless_encryption or nil, - flow = ((server.xtls == '1') or (server.tls == '1') or (server.reality == '1')) and server.tls_flow or nil + flow = (((server.xtls == '1') or (server.tls == '1') or (server.reality == '1')) and server.tls_flow ~= "none") and server.tls_flow or nil } } } @@ -220,26 +220,15 @@ end fingerprint = server.fingerprint, serverName = server.tls_host } or nil, - tcpSettings = (server.transport == "tcp" and server.tcp_guise == "http") and { + rawSettings = (server.transport == "raw" or server.transport == "tcp") and { -- tcp header = { - type = server.tcp_guise, - request = { + type = server.tcp_guise or "none", + request = (server.tcp_guise == "http") and { -- request path = {server.http_path} or {"/"}, headers = {Host = {server.http_host} or {}} - } - } - } or nil, - rawSettings = (server.transport == "raw" and server.raw_guise == "http") and { - -- raw - header = { - type = server.raw_guise, - request = { - -- request - path = {server.http_path} or {"/"}, - headers = {Host = {server.http_host} or {}} - } + } or nil } } or nil, kcpSettings = (server.transport == "kcp") and { @@ -256,10 +245,7 @@ end } or nil, wsSettings = (server.transport == "ws") and (server.ws_path or server.ws_host or server.tls_host) and { -- ws - headers = (server.ws_host or server.tls_host) and { - -- headers - Host = server.ws_host or server.tls_host - } or nil, + Host = server.ws_host or server.tls_host or nil, path = server.ws_path, maxEarlyData = tonumber(server.ws_ed) or nil, earlyDataHeaderName = server.ws_ed_header or nil diff --git a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index ccdd8be7ad..0404be540b 100755 --- a/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/small/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -172,6 +172,9 @@ local function processData(szType, content) result.v2ray_protocol = 'vmess' result.server = info.add result.server_port = info.port + if info.net == "tcp" then + info.net = "raw" + end result.transport = info.net result.alter_id = info.aid result.vmess_id = info.id @@ -194,7 +197,7 @@ local function processData(szType, content) result.h2_host = info.host result.h2_path = info.path end - if info.net == 'tcp' then + if info.net == 'raw' or info.net == 'tcp' then if info.type and info.type ~= "http" then info.type = "none" end @@ -400,18 +403,12 @@ local function processData(szType, content) elseif result.transport == "grpc" then result.serviceName = params.serviceName result.grpc_mode = params.mode or "gun" - elseif result.transport == "tcp" then + elseif result.transport == "tcp" or result.transport == "raw" then result.tcp_guise = params.headerType or "none" if result.tcp_guise == "http" then result.tcp_host = params.host and UrlDecode(params.host) or nil result.tcp_path = params.path and UrlDecode(params.path) or nil end - elseif result.transport == "raw" then - result.raw_guise = params.headerType or "none" - if result.raw_guise == "http" then - result.tcp_host = params.host and UrlDecode(params.host) or nil - result.tcp_path = params.path and UrlDecode(params.path) or nil - end end end if not result.alias then diff --git a/small/v2ray-geodata/Makefile b/small/v2ray-geodata/Makefile index da56537aa6..330053e3d7 100644 --- a/small/v2ray-geodata/Makefile +++ b/small/v2ray-geodata/Makefile @@ -12,13 +12,13 @@ PKG_MAINTAINER:=Tianling Shen include $(INCLUDE_DIR)/package.mk -GEOIP_VER:=202412120057 +GEOIP_VER:=202412190056 GEOIP_FILE:=geoip.dat.$(GEOIP_VER) define Download/geoip URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/ URL_FILE:=geoip.dat FILE:=$(GEOIP_FILE) - HASH:=5a184de8e36b5b131e405eb1078856703c0727f097636529cbbe47f38f2fe92d + HASH:=b75b994afcbb82f0b417001c015fa64e832bb6e66faf3a69ad4e423c9b29a463 endef GEOSITE_VER:=20241210004721 diff --git a/small/xray-core/Makefile b/small/xray-core/Makefile index c36099d0ee..86e07cceb4 100644 --- a/small/xray-core/Makefile +++ b/small/xray-core/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xray-core -PKG_VERSION:=24.11.30 +PKG_VERSION:=24.12.18 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=1ed728cf32cf9227c73e1b3651465eb089c6d2f42367cf40df62c4ba0edfc765 +PKG_HASH:=3d8b4a161a263e7af7bb1a2690961da075d13f980acd806f5cd4e5c8338d7534 PKG_MAINTAINER:=Tianling Shen PKG_LICENSE:=MPL-2.0 diff --git a/v2raya/service/go.mod b/v2raya/service/go.mod index 10cb51009d..98256f5e9b 100644 --- a/v2raya/service/go.mod +++ b/v2raya/service/go.mod @@ -14,6 +14,7 @@ require ( github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 github.com/gin-contrib/cors v1.6.0 github.com/gin-gonic/gin v1.9.1 + github.com/go-leo/slicex v1.0.14 github.com/golang/protobuf v1.5.3 github.com/google/gopacket v1.1.19 github.com/gorilla/websocket v1.5.0 @@ -40,8 +41,8 @@ require ( github.com/v2rayA/v2rayA-lib4 v0.0.0-20230812094818-595f87cb2a49 github.com/vearutop/statigz v1.1.7 go.etcd.io/bbolt v1.3.8 - golang.org/x/net v0.23.0 - golang.org/x/sys v0.18.0 + golang.org/x/net v0.25.0 + golang.org/x/sys v0.28.0 google.golang.org/grpc v1.57.1 google.golang.org/protobuf v1.33.0 ) @@ -58,7 +59,6 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-leo/slicex v1.0.14 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -97,12 +97,13 @@ require ( gitlab.com/yawning/chacha20.git v0.0.0-20230427033715-7877545b1b37 // indirect go4.org/netipx v0.0.0-20230728184502-ec4c8b891b28 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.21.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/v2raya/service/go.sum b/v2raya/service/go.sum index 4154bcda8d..404dcddb3a 100644 --- a/v2raya/service/go.sum +++ b/v2raya/service/go.sum @@ -100,8 +100,8 @@ github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -296,25 +296,25 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190116161447-11f53e031339/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -335,22 +335,22 @@ golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/v2rayn/v2rayN/ServiceLib/Common/Utils.cs b/v2rayn/v2rayN/ServiceLib/Common/Utils.cs index c693791114..585951bb90 100644 --- a/v2rayn/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayn/v2rayN/ServiceLib/Common/Utils.cs @@ -710,7 +710,7 @@ namespace ServiceLib.Common public static string StartupPath() { - if (Utils.IsLinux() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1") + if (Utils.IsNonWindows() && Environment.GetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA") == "1") { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "v2rayN"); } @@ -838,6 +838,8 @@ namespace ServiceLib.Common public static bool IsOSX() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + public static bool IsNonWindows() => !RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + public static string GetExeName(string name) { return IsWindows() ? $"{name}.exe" : name; diff --git a/v2rayn/v2rayN/ServiceLib/Global.cs b/v2rayn/v2rayN/ServiceLib/Global.cs index 89fb435fe1..7436effbd1 100644 --- a/v2rayn/v2rayN/ServiceLib/Global.cs +++ b/v2rayn/v2rayN/ServiceLib/Global.cs @@ -76,7 +76,7 @@ public const int MaxPort = 65536; public const string DelayUnit = ""; public const string SpeedUnit = ""; - public const int MinFontSize = 10; + public const int MinFontSize = 8; public const string RebootAs = "rebootas"; public const string AvaAssets = "avares://v2rayN/Assets/"; diff --git a/v2rayn/v2rayN/ServiceLib/Handler/AppHandler.cs b/v2rayn/v2rayN/ServiceLib/Handler/AppHandler.cs index c8e31186f1..31cb8b2e4a 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/AppHandler.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/AppHandler.cs @@ -46,7 +46,7 @@ public bool InitApp() { - if (Utils.IsLinux() && Utils.HasWritePermission() == false) + if (Utils.IsNonWindows() && Utils.HasWritePermission() == false) { Environment.SetEnvironmentVariable("V2RAYN_LOCAL_APPLICATION_DATA", "1", EnvironmentVariableTarget.Process); } diff --git a/v2rayn/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayn/v2rayN/ServiceLib/Handler/CoreHandler.cs index 60c7175a99..5dc62332da 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/CoreHandler.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -24,7 +24,7 @@ namespace ServiceLib.Handler Environment.SetEnvironmentVariable("V2RAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("XRAY_LOCATION_ASSET", Utils.GetBinPath(""), EnvironmentVariableTarget.Process); - if (Utils.IsLinux() || Utils.IsOSX()) + if (Utils.IsNonWindows()) { var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(); foreach (var it in coreInfo) @@ -221,7 +221,7 @@ namespace ServiceLib.Handler { return _config.TunModeItem.EnableTun && eCoreType == ECoreType.sing_box - && (Utils.IsLinux() || Utils.IsOSX()) + && (Utils.IsNonWindows()) //&& _config.TunModeItem.LinuxSudoPwd.IsNotEmpty() ; } diff --git a/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs b/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs index 6f19ffc867..410b899718 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingOSX.cs @@ -16,9 +16,9 @@ /// private static readonly List LstTypes = ["setwebproxy", "setsecurewebproxy", "setsocksfirewallproxy"]; - public static async Task SetProxy(string host, int port) + public static async Task SetProxy(string host, int port, string exceptions) { - var lstCmd = GetSetCmds(host, port); + var lstCmd = GetSetCmds(host, port, exceptions); await ExecCmd(lstCmd); } @@ -42,7 +42,7 @@ } } - private static List GetSetCmds(string host, int port) + private static List GetSetCmds(string host, int port, string exceptions) { List lstCmd = []; foreach (var interf in LstInterface) @@ -52,7 +52,17 @@ lstCmd.Add(new CmdItem() { Cmd = "networksetup", - Arguments = [$"-{type}", interf, host, (type.Contains("socks") ? (port - 1) : port).ToString()] + Arguments = [$"-{type}", interf, host, port.ToString()] + }); + } + if (exceptions.IsNotEmpty()) + { + List args = [$"-setproxybypassdomains", interf]; + args.AddRange(exceptions.Split(',')); + lstCmd.Add(new CmdItem() + { + Cmd = "networksetup", + Arguments = args }); } } diff --git a/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs b/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs index 06b1b5275b..3275b6d059 100644 --- a/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs +++ b/v2rayn/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs @@ -32,7 +32,7 @@ break; case ESysProxyType.ForcedChange when Utils.IsOSX(): - await ProxySettingOSX.SetProxy(Global.Loopback, port); + await ProxySettingOSX.SetProxy(Global.Loopback, port, exceptions); break; case ESysProxyType.ForcedClear when Utils.IsWindows(): diff --git a/v2rayn/v2rayN/ServiceLib/ServiceLib.csproj b/v2rayn/v2rayN/ServiceLib/ServiceLib.csproj index 26affe013e..6906cb4ee9 100644 --- a/v2rayn/v2rayN/ServiceLib/ServiceLib.csproj +++ b/v2rayn/v2rayN/ServiceLib/ServiceLib.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 7.4.0 + 7.4.1 diff --git a/v2rayn/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs b/v2rayn/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs index dcfc122e17..f4e31c0996 100644 --- a/v2rayn/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs +++ b/v2rayn/v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs @@ -262,7 +262,7 @@ namespace ServiceLib.ViewModels FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : ""); } - if (Utils.IsLinux() || Utils.IsOSX()) + if (Utils.IsNonWindows()) { var filesList = (new DirectoryInfo(toPath)).GetFiles().Select(u => u.FullName).ToList(); foreach (var file in filesList) diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml b/v2rayn/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml index bf7440e6b0..aaeec2c53a 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml +++ b/v2rayn/v2rayN/v2rayN.Desktop/Assets/GlobalStyles.axaml @@ -6,18 +6,18 @@ \ No newline at end of file diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml b/v2rayn/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml index 849bd0ce52..896b86d676 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml @@ -8,7 +8,7 @@ xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" Title="{x:Static resx:ResUI.menuServers}" Width="900" - Height="700" + Height="600" x:DataType="vms:AddServerViewModel" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml b/v2rayn/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml index 0138fe7a3c..0dca292675 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml @@ -50,7 +50,7 @@ diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml b/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml index ed2f3c7a5c..227ba0bd57 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml @@ -105,7 +105,7 @@ @@ -143,13 +143,12 @@ @@ -34,7 +33,6 @@ diff --git a/v2rayn/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml b/v2rayn/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml index fe079f48b4..fce4d7b489 100644 --- a/v2rayn/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml +++ b/v2rayn/v2rayN/v2rayN.Desktop/Views/SubSettingWindow.axaml @@ -8,8 +8,8 @@ xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" Title="{x:Static resx:ResUI.menuSubSetting}" - Width="1000" - Height="700" + Width="900" + Height="600" x:DataType="vms:SubSettingViewModel" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" diff --git a/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs b/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs index e0671eb05a..cf51234991 100644 --- a/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs +++ b/v2rayn/v2rayN/v2rayN/Views/ProfilesView.xaml.cs @@ -1,7 +1,6 @@ using MaterialDesignThemes.Wpf; using ReactiveUI; using Splat; -using System; using System.Reactive.Disposables; using System.Windows; using System.Windows.Controls; @@ -342,10 +341,7 @@ namespace v2rayN.Views } if (item.Name.ToLower().StartsWith("to")) { - if (!_config.GuiItem.EnableStatistics) - { - item2.Visibility = Visibility.Hidden; - } + item2.Visibility = _config.GuiItem.EnableStatistics ? Visibility.Visible : Visibility.Hidden; } } } diff --git a/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml b/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml index e6157f340a..35644516a6 100644 --- a/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml +++ b/v2rayn/v2rayN/v2rayN/Views/StatusBarView.xaml @@ -27,7 +27,7 @@ @@ -38,7 +38,7 @@ 0) { + if (proxyDomain.isNotEmpty()) { servers.add( V2rayConfig.DnsBean.ServersBean( address = remoteDns.first(), @@ -347,7 +348,7 @@ object V2rayConfigManager { val directDomain = userRule2Domain(TAG_DIRECT) val isCnRoutingMode = directDomain.contains(GEOSITE_CN) val geoipCn = arrayListOf(GEOIP_CN) - if (directDomain.size > 0) { + if (directDomain.isNotEmpty()) { servers.add( V2rayConfig.DnsBean.ServersBean( address = domesticDns.first(), @@ -369,9 +370,23 @@ object V2rayConfigManager { ) } + //User DNS hosts + try { + val userHosts = MmkvManager.decodeSettingsString(AppConfig.PREF_DNS_HOSTS) + if (userHosts.isNotNullEmpty()) { + var userHostsMap = userHosts?.split(",") + ?.filter { it.isNotEmpty() } + ?.filter { it.contains(":") } + ?.associate { it.split(":").let { (k, v) -> k to v } } + if (userHostsMap != null) hosts.putAll(userHostsMap) + } + } catch (e: Exception) { + e.printStackTrace() + } + //block dns val blkDomain = userRule2Domain(TAG_BLOCKED) - if (blkDomain.size > 0) { + if (blkDomain.isNotEmpty()) { hosts.putAll(blkDomain.map { it to LOOPBACK }) } diff --git a/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt b/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt index ae6e2c223e..099019489c 100644 --- a/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt +++ b/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt @@ -60,6 +60,7 @@ class SettingsActivity : BaseActivity() { private val socksPort by lazy { findPreference(AppConfig.PREF_SOCKS_PORT) } private val remoteDns by lazy { findPreference(AppConfig.PREF_REMOTE_DNS) } private val domesticDns by lazy { findPreference(AppConfig.PREF_DOMESTIC_DNS) } + private val dnsHosts by lazy { findPreference(AppConfig.PREF_DNS_HOSTS) } private val delayTestUrl by lazy { findPreference(AppConfig.PREF_DELAY_TEST_URL) } private val mode by lazy { findPreference(AppConfig.PREF_MODE) } @@ -152,6 +153,11 @@ class SettingsActivity : BaseActivity() { domesticDns?.summary = if (nval == "") AppConfig.DNS_DIRECT else nval true } + dnsHosts?.setOnPreferenceChangeListener { _, any -> + val nval = any as String + dnsHosts?.summary = nval + true + } delayTestUrl?.setOnPreferenceChangeListener { _, any -> val nval = any as String delayTestUrl?.summary = if (nval == "") AppConfig.DelayTestUrl else nval @@ -194,6 +200,7 @@ class SettingsActivity : BaseActivity() { socksPort?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_SOCKS_PORT, AppConfig.PORT_SOCKS) remoteDns?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_REMOTE_DNS, AppConfig.DNS_PROXY) domesticDns?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_DOMESTIC_DNS, AppConfig.DNS_DIRECT) + dnsHosts?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_DNS_HOSTS) delayTestUrl?.summary = MmkvManager.decodeSettingsString(AppConfig.PREF_DELAY_TEST_URL, AppConfig.DelayTestUrl) initSharedPreference() diff --git a/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt b/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt index 8dc50d58a8..b0533f02d7 100644 --- a/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt +++ b/v2rayng/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt @@ -31,6 +31,7 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application AppConfig.PREF_VPN_DNS, AppConfig.PREF_REMOTE_DNS, AppConfig.PREF_DOMESTIC_DNS, + AppConfig.PREF_DNS_HOSTS, AppConfig.PREF_DELAY_TEST_URL, AppConfig.PREF_LOCAL_DNS_PORT, AppConfig.PREF_SOCKS_PORT, diff --git a/v2rayng/V2rayNG/app/src/main/res/values-ar/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-ar/strings.xml index 90971ed355..e2bbb68d71 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-ar/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-ar/strings.xml @@ -180,6 +180,9 @@ DNS المحلي (اختياري) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + True delay test url (http/https) Url diff --git a/v2rayng/V2rayNG/app/src/main/res/values-bn/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-bn/strings.xml index 8fa5e255b1..59e686796f 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-bn/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-bn/strings.xml @@ -180,6 +180,9 @@ ঘরোয়া DNS (ঐচ্ছিক) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + সঠিক বিলম্ব পরীক্ষা ইউআরএল (http/https) ইউআরএল diff --git a/v2rayng/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml index df25e71a04..4c4b840fba 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml @@ -180,6 +180,9 @@ DNS منی (اختیاری) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + آدرس اینترنتی آزمایش تئخیر واقعی (http/https) نشۊوی اینترنتی diff --git a/v2rayng/V2rayNG/app/src/main/res/values-fa/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-fa/strings.xml index 5edd0074d7..bf6dd89b45 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -178,6 +178,9 @@ DNS داخلی (اختیاری) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + آدرس اینترنتی آزمایش تاخیر واقعی کانفیگ ها (HTTP/HTTPS) URL diff --git a/v2rayng/V2rayNG/app/src/main/res/values-ru/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-ru/strings.xml index 50ce531090..b04d6ab8b0 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -179,6 +179,9 @@ Внутренняя DNS (необязательно) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + Сервис проверки времени отклика (HTTP/HTTPS) URL diff --git a/v2rayng/V2rayNG/app/src/main/res/values-vi/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-vi/strings.xml index 66528e360c..c7cd80e410 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-vi/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-vi/strings.xml @@ -179,6 +179,9 @@ DNS nội địa (Không bắt buộc) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + URL kiểm tra độ trễ thực (HTTP / HTTPS) URL diff --git a/v2rayng/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index e16e58a2ea..d0f3df993b 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -176,6 +176,9 @@ 境内DNS (可选) DNS + DNS hosts (格式: 域名:地址,…) + domain:address,… + 真连接延迟测试网址 (http/https) Url diff --git a/v2rayng/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index 8f728f79da..b4305157a4 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -175,8 +175,8 @@ VPN DNS (僅支援 IPv4/v6) - 國內 DNS (可選) - DNS + DNS hosts (格式: 網域:位址,…) + domain:address,… 真連線延遲測試網址 (http/https) Url diff --git a/v2rayng/V2rayNG/app/src/main/res/values/strings.xml b/v2rayng/V2rayNG/app/src/main/res/values/strings.xml index 708f98e224..7f0ca85cb8 100644 --- a/v2rayng/V2rayNG/app/src/main/res/values/strings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/values/strings.xml @@ -182,6 +182,9 @@ Domestic DNS (Optional) DNS + DNS hosts (Format: domain:address,…) + domain:address,… + True delay test url (http/https) Url diff --git a/v2rayng/V2rayNG/app/src/main/res/xml/pref_settings.xml b/v2rayng/V2rayNG/app/src/main/res/xml/pref_settings.xml index 7821c1125f..f4cd757794 100644 --- a/v2rayng/V2rayNG/app/src/main/res/xml/pref_settings.xml +++ b/v2rayng/V2rayNG/app/src/main/res/xml/pref_settings.xml @@ -190,6 +190,11 @@ android:summary="@string/summary_pref_domestic_dns" android:title="@string/title_pref_domestic_dns" /> + + A V2Ray client for Android, support Xray core and v2fly core

+ +

Telegram Channel

+ +

github_2dust

+ +

Usage

+ +

Geoip and Geosite

+ +
    +
  • geoip.dat and geosite.dat files are in Android/data/com.v2ray.ang/files/assets (path may differ on some Android device)
  • +
  • download feature will get enhanced version in this repo (Note it need a working proxy)
  • +
  • latest official domain list and ip list can be imported manually
  • +
  • possible to use third party dat file in the same folder, like h2y
  • +
+ +

More in our wiki

+ +

Development guide

+ +

Android project under V2rayNG folder can be compiled directly in Android Studio, or using Gradle wrapper. But the v2ray core inside the aar is (probably) outdated. +The aar can be compiled from the Golang project AndroidLibV2rayLite or AndroidLibXrayLite. +For a quick start, read guide for Go Mobile and Makefiles for Go Developers

+ +

v2rayNG can run on Android Emulators. For WSA, VPN permission need to be granted via +appops set [package name] ACTIVATE_VPN allow

diff --git a/v2rayng/fastlane/metadata/android/en-US/images/icon.png b/v2rayng/fastlane/metadata/android/en-US/images/icon.png new file mode 100644 index 0000000000..03a4ce8a4a Binary files /dev/null and b/v2rayng/fastlane/metadata/android/en-US/images/icon.png differ diff --git a/v2rayng/fastlane/metadata/android/en-US/short_description.txt b/v2rayng/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 0000000000..38a05c70c7 --- /dev/null +++ b/v2rayng/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +A V2Ray client for Android, support Xray core and v2fly core diff --git a/v2rayng/fastlane/metadata/android/en-US/title.txt b/v2rayng/fastlane/metadata/android/en-US/title.txt new file mode 100644 index 0000000000..84cf2a177f --- /dev/null +++ b/v2rayng/fastlane/metadata/android/en-US/title.txt @@ -0,0 +1 @@ +v2rayNG