@@ -96,6 +96,7 @@ func prepareOutputDirs() error {
9696 "config/batches/sni_clash" ,
9797 "config/tcp-pass" ,
9898 "config/tcp-pass-sni" ,
99+ "config/reality" ,
99100 "config/countries" ,
100101 "config/farg" ,
101102 "config/farg/protocols" ,
@@ -209,13 +210,33 @@ func writeOutputFiles(results []configResult, tcpFailedLines []string) {
209210
210211 writeBatchFiles (all , allClash , allClashNames , allSNI , allSNIClash , allSNIClashNames )
211212 writeTCPPassFiles (tcpFailedLines )
213+ writeRealityFiles (results )
212214 writeFargFiles (results )
213215 writePattFiles (results )
214216
215217 // ── Per-country output files ───────────────────────────────────────────────
216218 writeCountryFiles (byCountryV2ray , byCountryClash , countryCounts )
217219}
218220
221+ func isVlessReality (line string ) bool {
222+ if ! strings .HasPrefix (line , "vless://" ) {
223+ return false
224+ }
225+ qIdx := strings .Index (line , "?" )
226+ hashIdx := strings .Index (line , "#" )
227+ if qIdx == - 1 {
228+ return false
229+ }
230+ query := line [qIdx + 1 : hashIdx ]
231+ for _ , part := range strings .Split (query , "&" ) {
232+ kv := strings .SplitN (part , "=" , 2 )
233+ if len (kv ) == 2 && kv [0 ] == "security" && kv [1 ] == "reality" {
234+ return true
235+ }
236+ }
237+ return false
238+ }
239+
219240func isWSTransport (line , proto string ) bool {
220241 switch proto {
221242 case "vmess" :
@@ -1500,6 +1521,37 @@ func detectProto(line string) string {
15001521 return ""
15011522}
15021523
1524+ // ── writeRealityFiles ────────────────────────────────────────────────────────
1525+
1526+ func writeRealityFiles (results []configResult ) {
1527+ const fallbackName = "@DeltaKroneckerGithub"
1528+ var v2rayLines []string
1529+ var clashEntries []string
1530+ var clashNames []string
1531+
1532+ for _ , r := range results {
1533+ if r .proto != "vless" || ! isVlessReality (r .line ) {
1534+ continue
1535+ }
1536+ named := renameTo (r .line , r .proto , fallbackName )
1537+ v2rayLines = append (v2rayLines , named )
1538+ cname := generateUniqueName (fallbackName )
1539+ if entry , ok := configToClashYAML (r .line , r .proto , cname ); ok {
1540+ clashEntries = append (clashEntries , entry )
1541+ clashNames = append (clashNames , cname )
1542+ }
1543+ }
1544+
1545+ if len (v2rayLines ) == 0 {
1546+ return
1547+ }
1548+ writeFile ("config/reality/reality.txt" , v2rayLines )
1549+ if gClash .simple != "" && len (clashEntries ) > 0 {
1550+ writeClashConfigSimple ("config/reality/reality.yaml" , clashEntries , clashNames )
1551+ }
1552+ fmt .Printf (" Reality: wrote %d vless reality configs\n " , len (v2rayLines ))
1553+ }
1554+
15031555// ── writeOnlyTCPPassFiles ────────────────────────────────────────────────────
15041556// Writes configs that passed TCP ping but failed xray validation
15051557// into 10000-line batches under config/tcp-pass/ and config/tcp-pass-sni/
@@ -1539,6 +1591,19 @@ func writeTCPPassFiles(lines []string) {
15391591 }
15401592 fmt .Printf (" TCP-Pass: wrote %d configs into %d files\n " , total , numBatches )
15411593
1594+ // write reality-only txt (no yaml)
1595+ var realityLines []string
1596+ for _ , line := range lines {
1597+ proto := detectProto (line )
1598+ if proto == "vless" && isVlessReality (line ) {
1599+ realityLines = append (realityLines , renameTo (line , proto , fixedName ))
1600+ }
1601+ }
1602+ if len (realityLines ) > 0 {
1603+ writeFile ("config/tcp-pass/reality.txt" , realityLines )
1604+ fmt .Printf (" TCP-Pass Reality: wrote %d vless reality configs\n " , len (realityLines ))
1605+ }
1606+
15421607 // write SNI batches
15431608 if len (sniNamed ) > 0 {
15441609 sniTotal := len (sniNamed )
0 commit comments