Skip to content

v3.0.0

Choose a tag to compare

@github-actions github-actions released this 07 Oct 12:17
· 15 commits to main since this release

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.dart under lib/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 names Outbound / Inbound / SingBox / DNS / RouteOptions / Rule etc. stay the same, so existing import 'package:flutter_sing_box/flutter_sing_box.dart' keeps working
  • Outbound and Inbound are now sealed class hierarchies discriminated by type (SelectorOutbound, VlessOutbound, Hysteria2Inbound, …). Code that accessed flat fields on the base class (e.g. a group's outbounds list) must switch on the concrete subtype instead; fromJson picks the subtype by its type discriminator
  • Unknown-type tolerance: unrecognized outbound / inbound types deserialize into UnknownOutbound / UnknownInbound which pass their raw JSON through untouched (round-trip safe); unmodeled top-level sections of SingBox (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 / Multiplex are 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

  • ClashProxy now parses ws-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

  • ClashProxy now parses psk / version / reuse / obfs-opts (snell fields), and the Clash → sing-box conversion emits SnellOutbound — mapping obfs-opts.mode / obfs-opts.host to obfs_mode / obfs_host, udp to network, and passing reuse through
  • 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); version accepts both int and string YAML spellings; the Clash ports hop syntax has no sing-box equivalent (server_ports is 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 survives fromJson / toJson round-trips, so WebSocket Host headers 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
  • OutboundType gains socks / http / shadowTLS / snell / block constants

Dependencies

  • Remove the unused equatable dependency
  • The upstream core LICENSE files bundled under assets/windows/ are dropped from the package (the package's own top-level LICENSE stays)