Repository navigation
v3.0.0
3.0.0
⚠️ Breaking change
Model layer regenerated from the official sing-box JSON Schema
- The hand-written flat sing-box models (
outbound.dart/inbound.dart/dns.dart/route.dart/tls.dart/log.dart/experimental.dart/sing_box.dartunderlib/src/data/models/singbox/) have been removed. The public API now comes exclusively from the schema-generated model layer (gen/), re-exported through the package barrel — class namesOutbound/Inbound/SingBox/DNS/RouteOptions/Ruleetc. stay the same, so existingimport 'package:flutter_sing_box/flutter_sing_box.dart'keeps working OutboundandInboundare now sealed class hierarchies discriminated bytype(SelectorOutbound,VlessOutbound,Hysteria2Inbound, …). Code that accessed flat fields on the base class (e.g. a group'soutboundslist) must switch on the concrete subtype instead;fromJsonpicks the subtype by itstypediscriminator- Unknown-type tolerance: unrecognized
outbound/inboundtypes deserialize intoUnknownOutbound/UnknownInboundwhich pass their raw JSON through untouched (round-trip safe); unmodeled top-level sections ofSingBox(e.g.ntp) are likewise preserved on read and merged back on write - Renames aligned with the schema:
Dns→DNS,Route→RouteOptions,Log→LogOptions,Experimental→ExperimentalOptions;Tls/Utls/Reality/Transport/Multiplexare replaced by the granular generated options classes (OutboundTLSOptions,OutboundUTLSOptions,V2RayTransport, …)
Transport-type constant renames
OutboundTransportType:webSocket→ws,gRPC→grpc,httpUpgrade→httpupgrade— the constant values are unchanged, only the Dart identifiers
Features
Clash subscription transport options
ClashProxynow parsesws-opts/grpc-opts/http-opts/h2-opts, and the Clash → sing-box conversion maps them to transport settings: ws path / headers / early data (max-early-data+early-data-header-name) /v2ray-http-upgrade(httpupgrade form), gRPC service name, HTTP method / path / headers (mihomo rotates the path list per connection — the first entry is used), and h2 host / path lists
Clash snell proxies
ClashProxynow parsespsk/version/reuse/obfs-opts(snell fields), and the Clash → sing-box conversion emitsSnellOutbound— mappingobfs-opts.mode/obfs-opts.hosttoobfs_mode/obfs_host,udptonetwork, and passingreusethrough- Snell version 5 downgrades to version 4 (same as mihomo: v5 servers are backward-compatible with v4 clients, the downgrade happens before the reuse/UDP checks); a missing
version(mihomo defaults to the legacy v1 protocol) and versions 1-3 have no schema counterpart and are skipped (same policy as socks5-over-TLS);versionaccepts both int and string YAML spellings; the Clashportshop syntax has no sing-box equivalent (server_portsis not in the snell schema branch) and is ignored
Default subscription User-Agent
SubscribeUserAgent— the default User-Agent builder for subscription requests — is now exported as part of the package's public API- The built string is simplified to the core identifiers
sing-box/<version> mihomo/1.19.32 v2ray/5.22.0; the previously spoofed third-party client identifiers (clash-verge / ClashMetaForAndroid / ClashForWindows) are dropped
Model layer fidelity & subscription parsing
- Open-map types from the schema (e.g.
HTTPHeader) are modeled as key-passthrough classes — every entry survivesfromJson/toJsonround-trips, so WebSocketHostheaders on vless / vmess CDN nodes are preserved - Outbound acceptance when parsing subscriptions now derives from the generated model registry instead of a hand-maintained 11-type allow-list: every modeled type passes (block stays excluded — deprecated by sing-box), unmodeled types are still silently dropped
OutboundTypegainssocks/http/shadowTLS/snell/blockconstants
Dependencies
- Remove the unused
equatabledependency - The upstream core LICENSE files bundled under
assets/windows/are dropped from the package (the package's own top-level LICENSE stays)