mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
feat: Add LAN allowed and disallowed IP configurations (#861)
This commit is contained in:
@@ -80,6 +80,8 @@ type Inbound struct {
|
||||
VmessConfig string `json:"vmess-config"`
|
||||
Authentication []string `json:"authentication"`
|
||||
SkipAuthPrefixes []netip.Prefix `json:"skip-auth-prefixes"`
|
||||
LanAllowedIPs []netip.Prefix `json:"lan-allowed-ips"`
|
||||
LanDisAllowedIPs []netip.Prefix `json:"lan-disallowed-ips"`
|
||||
AllowLan bool `json:"allow-lan"`
|
||||
BindAddress string `json:"bind-address"`
|
||||
InboundTfo bool `json:"inbound-tfo"`
|
||||
@@ -289,6 +291,8 @@ type RawConfig struct {
|
||||
InboundMPTCP bool `yaml:"inbound-mptcp"`
|
||||
Authentication []string `yaml:"authentication" json:"authentication"`
|
||||
SkipAuthPrefixes []netip.Prefix `yaml:"skip-auth-prefixes"`
|
||||
LanAllowedIPs []netip.Prefix `yaml:"lan-allowed-ips"`
|
||||
LanDisAllowedIPs []netip.Prefix `yaml:"lan-disallowed-ips"`
|
||||
AllowLan bool `yaml:"allow-lan" json:"allow-lan"`
|
||||
BindAddress string `yaml:"bind-address" json:"bind-address"`
|
||||
Mode T.TunnelMode `yaml:"mode" json:"mode"`
|
||||
@@ -387,6 +391,7 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) {
|
||||
rawCfg := &RawConfig{
|
||||
AllowLan: false,
|
||||
BindAddress: "*",
|
||||
LanAllowedIPs: []netip.Prefix{netip.MustParsePrefix("0.0.0.0/0"), netip.MustParsePrefix("::/0")},
|
||||
IPv6: true,
|
||||
Mode: T.Rule,
|
||||
GeoAutoUpdate: false,
|
||||
@@ -647,6 +652,8 @@ func parseGeneral(cfg *RawConfig) (*General, error) {
|
||||
VmessConfig: cfg.VmessConfig,
|
||||
AllowLan: cfg.AllowLan,
|
||||
SkipAuthPrefixes: cfg.SkipAuthPrefixes,
|
||||
LanAllowedIPs: cfg.LanAllowedIPs,
|
||||
LanDisAllowedIPs: cfg.LanDisAllowedIPs,
|
||||
BindAddress: cfg.BindAddress,
|
||||
InboundTfo: cfg.InboundTfo,
|
||||
InboundMPTCP: cfg.InboundMPTCP,
|
||||
|
||||
Reference in New Issue
Block a user