| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import fs from "fs"
- import path from "path"
- const proxies = fs
- .readFileSync("links.txt", "utf8")
- .toString()
- .split("\n")
- .map(proxy => proxy.trim())
- .filter(i => !!i)
- .map(proxy => {
- return new URL(proxy)
- })
- const configTemplate = fs
- .readFileSync(path.resolve("config", "template.yaml"), "utf8")
- .toString()
- ;["RCS-ZA", "RCS-US", "RCS-TR"].forEach((country, index) => {
- let arg1 = proxies
- .filter(proxy => proxy.hash.replace("#", "").startsWith(country))
- .map((proxy, i) => {
- return ` - {name: ${proxy.hash.replace("#", "")}, server: ${
- proxy.hostname
- }, port: ${
- proxy.port
- }, reality-opts: {public-key: ${proxy.searchParams.get(
- "pbk"
- )}, short-id: ${proxy.searchParams.get(
- "sid"
- )}}, client-fingerprint: chrome, type: vless, uuid: ${
- proxy.username
- }, tls: true, tfo: false, skip-cert-verify: false, servername: yahoo.com, network: tcp}`
- })
- .join("\n")
- let arg2 = ["192.168.10", "192.168.11", "192.168.12"]
- .map((ip, index) => {
- return [...Array(200).keys()]
- .map(
- i =>
- ` - SRC-IP-CIDR,${ip}.${i + 50}/32,${country}-IPWEB-${
- i + index * 200 + 1
- }`
- )
- .join("\n")
- })
- .join("\n")
- fs.writeFileSync(
- path.resolve("dist", `${country}.yaml`),
- configTemplate.replace("${1}", arg1).replace("${2}", arg2)
- )
- })
|