73 lines
No EOL
1.5 KiB
TypeScript
73 lines
No EOL
1.5 KiB
TypeScript
import express from 'express';
|
|
import type { SingBoxConfig } from './types';
|
|
|
|
|
|
const app = express()
|
|
const port = 3000
|
|
|
|
app.get('/', async (req, res) => {
|
|
const sb_config: SingBoxConfig = {
|
|
log: {
|
|
disabled: false,
|
|
level: 'trace',
|
|
output: 'logs.txt',
|
|
timestamp: true
|
|
},
|
|
dns: {
|
|
servers: [ {
|
|
type: "tcp",
|
|
tag: "cloudflare",
|
|
|
|
server: "1.1.1.1",
|
|
server_port: 53,
|
|
} ],
|
|
strategy: 'prefer_ipv4',
|
|
},
|
|
ntp: { enabled: false },
|
|
certificate: { },
|
|
endpoints: [],
|
|
inbounds: [
|
|
{
|
|
type: "hysteria2",
|
|
tag: "isterichka",
|
|
|
|
listen: "0.0.0.0",
|
|
listen_port: 1080,
|
|
|
|
users: [
|
|
{
|
|
name: 'admin',
|
|
password: 'admin'
|
|
}
|
|
],
|
|
tls: {
|
|
"enabled": true,
|
|
"server_name": "mr.penis",
|
|
"certificate_path": "./certificate.pem",
|
|
"key_path": "./privatekey.pem"
|
|
}
|
|
}
|
|
],
|
|
outbounds: [
|
|
{
|
|
type: "direct",
|
|
tag: "DIRECT"
|
|
},
|
|
{
|
|
type: "block",
|
|
tag: "BLOCK"
|
|
}
|
|
],
|
|
route: {},
|
|
services: undefined,
|
|
experimental: undefined
|
|
}
|
|
|
|
await Bun.write("output.json", JSON.stringify(sb_config))
|
|
|
|
res.send("Written")
|
|
})
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Example app listening on port ${port}`)
|
|
}) |