Reject removed legacy inbound fields instead of silently ignoring

This commit is contained in:
世界
2026-03-21 17:09:34 +08:00
parent 1e57c06295
commit 6913b11e0a
2 changed files with 10 additions and 0 deletions

View File

@@ -44,6 +44,12 @@ func (h *Inbound) UnmarshalJSONContext(ctx context.Context, content []byte) erro
if err != nil {
return err
}
if listenWrapper, isListen := options.(ListenOptionsWrapper); isListen {
//nolint:staticcheck
if listenWrapper.TakeListenOptions().InboundOptions != (InboundOptions{}) {
return E.New("legacy inbound fields are deprecated in sing-box 1.11.0 and removed in sing-box 1.13.0, checkout migration: https://sing-box.sagernet.org/migration/#migrate-legacy-inbound-fields-to-rule-actions")
}
}
h.Options = options
return nil
}

View File

@@ -67,6 +67,10 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
if options.GSO {
return nil, E.New("GSO option in tun is deprecated in sing-box 1.11.0 and removed in sing-box 1.12.0")
}
//nolint:staticcheck
if options.InboundOptions != (option.InboundOptions{}) {
return nil, E.New("legacy inbound fields are deprecated in sing-box 1.11.0 and removed in sing-box 1.13.0, checkout migration: https://sing-box.sagernet.org/migration/#migrate-legacy-inbound-fields-to-rule-actions")
}
address := options.Address
inet4Address := common.Filter(address, func(it netip.Prefix) bool {