first commit
This commit is contained in:
commit
8eb4fcf055
100 changed files with 28695 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
18
.github/workflows/npm-publish.yml
vendored
Normal file
18
.github/workflows/npm-publish.yml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
name: Publish to npm
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
publish-npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- run: bun install
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: bun publish --access public
|
||||
env:
|
||||
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# dependencies (bun install)
|
||||
node_modules
|
||||
|
||||
# output
|
||||
out
|
||||
dist
|
||||
*.tgz
|
||||
|
||||
# code coverage
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# logs
|
||||
logs
|
||||
_.log
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# caches
|
||||
.eslintcache
|
||||
.cache
|
||||
.direnv
|
||||
*.tsbuildinfo
|
||||
|
||||
# IDEs
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
24
LICENCE
Normal file
24
LICENCE
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <https://unlicense.org>
|
||||
23
README.md
Normal file
23
README.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# XTLS SDK
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
A TypeScript SDK for interacting with [Xray Core](https://github.com/XTLS/Xray-core) via gRPC API.
|
||||
|
||||
Example:
|
||||
|
||||
```ts
|
||||
import { XrayClient } from '@ruject/xray-core';
|
||||
|
||||
const client = new XrayClient('127.0.0.1', '10000');
|
||||
const req = await client.handler.addVmessUser({
|
||||
email: 'test@example.com',
|
||||
level: 0,
|
||||
tag: 'vmess-in'
|
||||
});
|
||||
console.log(req.isOk)
|
||||
```
|
||||
372
bun.lock
Normal file
372
bun.lock
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 1,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "@remnawave/xtls-sdk",
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.10.2",
|
||||
"@ruject/xray-core": "^0.1.0",
|
||||
"nice-grpc": "^2.1.14",
|
||||
"protobufjs": "^8.0.0",
|
||||
"tar": "^7.5.2",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
||||
"@typescript-eslint/parser": "^8.52.0",
|
||||
"eslint": "9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-n": "^17.23.1",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"prettier": "^3.7.4",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"@bufbuild/protobuf": ["@bufbuild/protobuf@2.10.2", "", {}, "sha512-uFsRXwIGyu+r6AMdz+XijIIZJYpoWeYzILt5yZ2d3mCjQrWUTVpVD9WL/jZAbvp+Ed04rOhrsk7FiTcEDseB5A=="],
|
||||
|
||||
"@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="],
|
||||
|
||||
"@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
|
||||
|
||||
"@eslint/config-array": ["@eslint/config-array@0.21.1", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.2" } }, "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA=="],
|
||||
|
||||
"@eslint/config-helpers": ["@eslint/config-helpers@0.4.2", "", { "dependencies": { "@eslint/core": "^0.17.0" } }, "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw=="],
|
||||
|
||||
"@eslint/core": ["@eslint/core@0.17.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ=="],
|
||||
|
||||
"@eslint/eslintrc": ["@eslint/eslintrc@3.3.3", "", { "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" } }, "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ=="],
|
||||
|
||||
"@eslint/js": ["@eslint/js@9.39.2", "", {}, "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA=="],
|
||||
|
||||
"@eslint/object-schema": ["@eslint/object-schema@2.1.7", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="],
|
||||
|
||||
"@eslint/plugin-kit": ["@eslint/plugin-kit@0.4.1", "", { "dependencies": { "@eslint/core": "^0.17.0", "levn": "^0.4.1" } }, "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA=="],
|
||||
|
||||
"@grpc/grpc-js": ["@grpc/grpc-js@1.14.3", "", { "dependencies": { "@grpc/proto-loader": "^0.8.0", "@js-sdsl/ordered-map": "^4.4.2" } }, "sha512-Iq8QQQ/7X3Sac15oB6p0FmUg/klxQvXLeileoqrTRGJYLV+/9tubbr9ipz0GKHjmXVsgFPo/+W+2cA8eNcR+XA=="],
|
||||
|
||||
"@grpc/proto-loader": ["@grpc/proto-loader@0.8.0", "", { "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", "protobufjs": "^7.5.3", "yargs": "^17.7.2" }, "bin": { "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" } }, "sha512-rc1hOQtjIWGxcxpb9aHAfLpIctjEnsDehj0DAiVfBlmT84uvR0uUtN2hEi/ecvWVjXUGf5qPF4qEgiLOx1YIMQ=="],
|
||||
|
||||
"@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="],
|
||||
|
||||
"@humanfs/node": ["@humanfs/node@0.16.7", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="],
|
||||
|
||||
"@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],
|
||||
|
||||
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],
|
||||
|
||||
"@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="],
|
||||
|
||||
"@js-sdsl/ordered-map": ["@js-sdsl/ordered-map@4.4.2", "", {}, "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw=="],
|
||||
|
||||
"@pkgr/core": ["@pkgr/core@0.2.9", "", {}, "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA=="],
|
||||
|
||||
"@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="],
|
||||
|
||||
"@protobufjs/base64": ["@protobufjs/base64@1.1.2", "", {}, "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="],
|
||||
|
||||
"@protobufjs/codegen": ["@protobufjs/codegen@2.0.4", "", {}, "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="],
|
||||
|
||||
"@protobufjs/eventemitter": ["@protobufjs/eventemitter@1.1.0", "", {}, "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="],
|
||||
|
||||
"@protobufjs/fetch": ["@protobufjs/fetch@1.1.0", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" } }, "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ=="],
|
||||
|
||||
"@protobufjs/float": ["@protobufjs/float@1.0.2", "", {}, "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="],
|
||||
|
||||
"@protobufjs/inquire": ["@protobufjs/inquire@1.1.0", "", {}, "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="],
|
||||
|
||||
"@protobufjs/path": ["@protobufjs/path@1.1.2", "", {}, "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="],
|
||||
|
||||
"@protobufjs/pool": ["@protobufjs/pool@1.1.0", "", {}, "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="],
|
||||
|
||||
"@protobufjs/utf8": ["@protobufjs/utf8@1.1.0", "", {}, "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="],
|
||||
|
||||
"@ruject/xray-core": ["@ruject/xray-core@0.1.0", "", { "dependencies": { "@bufbuild/protobuf": "^2.10.2", "nice-grpc": "^2.1.14", "protobufjs": "^8.0.0", "tar": "^7.5.2" } }, "sha512-GVoy+BjOU05l2WuHdBP/mCLqmX3fyIv7hmhOw16oHeMO3f+WDSLzkOiRsMuNbwDaDcVOh+y2xoF4ArAm4Z3IEQ=="],
|
||||
|
||||
"@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
|
||||
|
||||
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
|
||||
|
||||
"@types/node": ["@types/node@25.0.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA=="],
|
||||
|
||||
"@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.52.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/type-utils": "8.52.0", "@typescript-eslint/utils": "8.52.0", "@typescript-eslint/visitor-keys": "8.52.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.52.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-okqtOgqu2qmZJ5iN4TWlgfF171dZmx2FzdOv2K/ixL2LZWDStL8+JgQerI2sa8eAEfoydG9+0V96m7V+P8yE1Q=="],
|
||||
|
||||
"@typescript-eslint/parser": ["@typescript-eslint/parser@8.52.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/types": "8.52.0", "@typescript-eslint/typescript-estree": "8.52.0", "@typescript-eslint/visitor-keys": "8.52.0", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg=="],
|
||||
|
||||
"@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.52.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.52.0", "@typescript-eslint/types": "^8.52.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-xD0MfdSdEmeFa3OmVqonHi+Cciab96ls1UhIF/qX/O/gPu5KXD0bY9lu33jj04fjzrXHcuvjBcBC+D3SNSadaw=="],
|
||||
|
||||
"@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.52.0", "", { "dependencies": { "@typescript-eslint/types": "8.52.0", "@typescript-eslint/visitor-keys": "8.52.0" } }, "sha512-ixxqmmCcc1Nf8S0mS0TkJ/3LKcC8mruYJPOU6Ia2F/zUUR4pApW7LzrpU3JmtePbRUTes9bEqRc1Gg4iyRnDzA=="],
|
||||
|
||||
"@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.52.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-jl+8fzr/SdzdxWJznq5nvoI7qn2tNYV/ZBAEcaFMVXf+K6jmXvAFrgo/+5rxgnL152f//pDEAYAhhBAZGrVfwg=="],
|
||||
|
||||
"@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.52.0", "", { "dependencies": { "@typescript-eslint/types": "8.52.0", "@typescript-eslint/typescript-estree": "8.52.0", "@typescript-eslint/utils": "8.52.0", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-JD3wKBRWglYRQkAtsyGz1AewDu3mTc7NtRjR/ceTyGoPqmdS5oCdx/oZMWD5Zuqmo6/MpsYs0wp6axNt88/2EQ=="],
|
||||
|
||||
"@typescript-eslint/types": ["@typescript-eslint/types@8.52.0", "", {}, "sha512-LWQV1V4q9V4cT4H5JCIx3481iIFxH1UkVk+ZkGGAV1ZGcjGI9IoFOfg3O6ywz8QqCDEp7Inlg6kovMofsNRaGg=="],
|
||||
|
||||
"@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.52.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.52.0", "@typescript-eslint/tsconfig-utils": "8.52.0", "@typescript-eslint/types": "8.52.0", "@typescript-eslint/visitor-keys": "8.52.0", "debug": "^4.4.3", "minimatch": "^9.0.5", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-XP3LClsCc0FsTK5/frGjolyADTh3QmsLp6nKd476xNI9CsSsLnmn4f0jrzNoAulmxlmNIpeXuHYeEQv61Q6qeQ=="],
|
||||
|
||||
"@typescript-eslint/utils": ["@typescript-eslint/utils@8.52.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/types": "8.52.0", "@typescript-eslint/typescript-estree": "8.52.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-wYndVMWkweqHpEpwPhwqE2lnD2DxC6WVLupU/DOt/0/v+/+iQbbzO3jOHjmBMnhu0DgLULvOaU4h4pwHYi2oRQ=="],
|
||||
|
||||
"@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.52.0", "", { "dependencies": { "@typescript-eslint/types": "8.52.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-ink3/Zofus34nmBsPjow63FP5M7IGff0RKAgqR6+CFpdk22M7aLwC9gOcLGYqr7MczLPzZVERW9hRog3O4n1sQ=="],
|
||||
|
||||
"abort-controller-x": ["abort-controller-x@0.4.3", "", {}, "sha512-VtUwTNU8fpMwvWGn4xE93ywbogTYsuT+AUxAXOeelbXuQVIwNmC5YLeho9sH4vZ4ITW8414TTAOG1nW6uIVHCA=="],
|
||||
|
||||
"acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
|
||||
|
||||
"acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
|
||||
|
||||
"ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="],
|
||||
|
||||
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
|
||||
|
||||
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="],
|
||||
|
||||
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||
|
||||
"chownr": ["chownr@3.0.0", "", {}, "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="],
|
||||
|
||||
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
||||
|
||||
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
||||
|
||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||
|
||||
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
||||
|
||||
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
|
||||
|
||||
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
||||
|
||||
"deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="],
|
||||
|
||||
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
||||
|
||||
"enhanced-resolve": ["enhanced-resolve@5.18.4", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" } }, "sha512-LgQMM4WXU3QI+SYgEc2liRgznaD5ojbmY3sb8LxyguVkIg5FxdpTkvk72te2R38/TGKxH634oLxXRGY6d7AP+Q=="],
|
||||
|
||||
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
||||
|
||||
"escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
||||
|
||||
"eslint": ["eslint@9.39.2", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.1", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.39.2", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw=="],
|
||||
|
||||
"eslint-compat-utils": ["eslint-compat-utils@0.5.1", "", { "dependencies": { "semver": "^7.5.4" }, "peerDependencies": { "eslint": ">=6.0.0" } }, "sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q=="],
|
||||
|
||||
"eslint-config-prettier": ["eslint-config-prettier@10.1.8", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w=="],
|
||||
|
||||
"eslint-plugin-es-x": ["eslint-plugin-es-x@7.8.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.1.2", "@eslint-community/regexpp": "^4.11.0", "eslint-compat-utils": "^0.5.1" }, "peerDependencies": { "eslint": ">=8" } }, "sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ=="],
|
||||
|
||||
"eslint-plugin-n": ["eslint-plugin-n@17.23.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.5.0", "enhanced-resolve": "^5.17.1", "eslint-plugin-es-x": "^7.8.0", "get-tsconfig": "^4.8.1", "globals": "^15.11.0", "globrex": "^0.1.2", "ignore": "^5.3.2", "semver": "^7.6.3", "ts-declaration-location": "^1.0.6" }, "peerDependencies": { "eslint": ">=8.23.0" } }, "sha512-68PealUpYoHOBh332JLLD9Sj7OQUDkFpmcfqt8R9sySfFSeuGJjMTJQvCRRB96zO3A/PELRLkPrzsHmzEFQQ5A=="],
|
||||
|
||||
"eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.4", "", { "dependencies": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.11.7" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-swNtI95SToIz05YINMA6Ox5R057IMAmWZ26GqPxusAp1TZzj+IdY9tXNWWD3vkF/wEqydCONcwjTFpxybBqZsg=="],
|
||||
|
||||
"eslint-plugin-simple-import-sort": ["eslint-plugin-simple-import-sort@12.1.1", "", { "peerDependencies": { "eslint": ">=5.0.0" } }, "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA=="],
|
||||
|
||||
"eslint-scope": ["eslint-scope@8.4.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="],
|
||||
|
||||
"eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="],
|
||||
|
||||
"espree": ["espree@10.4.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.1" } }, "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ=="],
|
||||
|
||||
"esquery": ["esquery@1.7.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="],
|
||||
|
||||
"esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],
|
||||
|
||||
"estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
|
||||
|
||||
"esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
|
||||
|
||||
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
|
||||
|
||||
"fast-diff": ["fast-diff@1.3.0", "", {}, "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw=="],
|
||||
|
||||
"fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
|
||||
|
||||
"fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],
|
||||
|
||||
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||
|
||||
"file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="],
|
||||
|
||||
"find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
|
||||
|
||||
"flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="],
|
||||
|
||||
"flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="],
|
||||
|
||||
"get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
|
||||
|
||||
"get-tsconfig": ["get-tsconfig@4.13.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ=="],
|
||||
|
||||
"glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
|
||||
|
||||
"globals": ["globals@15.15.0", "", {}, "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg=="],
|
||||
|
||||
"globrex": ["globrex@0.1.2", "", {}, "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="],
|
||||
|
||||
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
|
||||
|
||||
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
|
||||
|
||||
"ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
|
||||
|
||||
"import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="],
|
||||
|
||||
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
||||
|
||||
"is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
|
||||
|
||||
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
||||
|
||||
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
||||
|
||||
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
||||
|
||||
"js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="],
|
||||
|
||||
"json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="],
|
||||
|
||||
"json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
|
||||
|
||||
"json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],
|
||||
|
||||
"keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="],
|
||||
|
||||
"levn": ["levn@0.4.1", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
|
||||
|
||||
"locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],
|
||||
|
||||
"lodash.camelcase": ["lodash.camelcase@4.3.0", "", {}, "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="],
|
||||
|
||||
"lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="],
|
||||
|
||||
"long": ["long@5.3.2", "", {}, "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA=="],
|
||||
|
||||
"minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||
|
||||
"minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="],
|
||||
|
||||
"minizlib": ["minizlib@3.1.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw=="],
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],
|
||||
|
||||
"nice-grpc": ["nice-grpc@2.1.14", "", { "dependencies": { "@grpc/grpc-js": "^1.14.0", "abort-controller-x": "^0.4.0", "nice-grpc-common": "^2.0.2" } }, "sha512-GK9pKNxlvnU5FAdaw7i2FFuR9CqBspcE+if2tqnKXBcE0R8525wj4BZvfcwj7FjvqbssqKxRHt2nwedalbJlww=="],
|
||||
|
||||
"nice-grpc-common": ["nice-grpc-common@2.0.2", "", { "dependencies": { "ts-error": "^1.0.6" } }, "sha512-7RNWbls5kAL1QVUOXvBsv1uO0wPQK3lHv+cY1gwkTzirnG1Nop4cBJZubpgziNbaVc/bl9QJcyvsf/NQxa3rjQ=="],
|
||||
|
||||
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
|
||||
|
||||
"p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],
|
||||
|
||||
"p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],
|
||||
|
||||
"parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="],
|
||||
|
||||
"path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
|
||||
|
||||
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
|
||||
|
||||
"picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
|
||||
|
||||
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
|
||||
|
||||
"prettier": ["prettier@3.7.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA=="],
|
||||
|
||||
"prettier-linter-helpers": ["prettier-linter-helpers@1.0.1", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg=="],
|
||||
|
||||
"protobufjs": ["protobufjs@8.0.0", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.4", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-jx6+sE9h/UryaCZhsJWbJtTEy47yXoGNYI4z8ZaRncM0zBKeRqjO2JEcOUYwrYGb1WLhXM1FfMzW3annvFv0rw=="],
|
||||
|
||||
"punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
|
||||
|
||||
"require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
|
||||
|
||||
"resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="],
|
||||
|
||||
"resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
||||
|
||||
"semver": ["semver@7.7.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],
|
||||
|
||||
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
|
||||
|
||||
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
|
||||
|
||||
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
||||
|
||||
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
||||
|
||||
"strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
|
||||
|
||||
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"synckit": ["synckit@0.11.11", "", { "dependencies": { "@pkgr/core": "^0.2.9" } }, "sha512-MeQTA1r0litLUf0Rp/iisCaL8761lKAZHaimlbGK4j0HysC4PLfqygQj9srcs0m2RdtDYnF8UuYyKpbjHYp7Jw=="],
|
||||
|
||||
"tapable": ["tapable@2.3.0", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="],
|
||||
|
||||
"tar": ["tar@7.5.2", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg=="],
|
||||
|
||||
"tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
|
||||
|
||||
"ts-api-utils": ["ts-api-utils@2.4.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="],
|
||||
|
||||
"ts-declaration-location": ["ts-declaration-location@1.0.7", "", { "dependencies": { "picomatch": "^4.0.2" }, "peerDependencies": { "typescript": ">=4.0.0" } }, "sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA=="],
|
||||
|
||||
"ts-error": ["ts-error@1.0.6", "", {}, "sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA=="],
|
||||
|
||||
"type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],
|
||||
|
||||
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
||||
|
||||
"typescript-eslint": ["typescript-eslint@8.52.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.52.0", "@typescript-eslint/parser": "8.52.0", "@typescript-eslint/typescript-estree": "8.52.0", "@typescript-eslint/utils": "8.52.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-atlQQJ2YkO4pfTVQmQ+wvYQwexPDOIgo+RaVcD7gHgzy/IQA+XTyuxNM9M9TVXvttkF7koBHmcwisKdOAf2EcA=="],
|
||||
|
||||
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
||||
|
||||
"uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
|
||||
|
||||
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
||||
|
||||
"word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],
|
||||
|
||||
"wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
||||
|
||||
"y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
|
||||
|
||||
"yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="],
|
||||
|
||||
"yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="],
|
||||
|
||||
"yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
|
||||
|
||||
"yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],
|
||||
|
||||
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
||||
|
||||
"@eslint/eslintrc/globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="],
|
||||
|
||||
"@eslint/eslintrc/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||
|
||||
"@grpc/proto-loader/protobufjs": ["protobufjs@7.5.4", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.4", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg=="],
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
||||
|
||||
"eslint/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||
|
||||
"eslint-plugin-n/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||
|
||||
"@grpc/proto-loader/protobufjs/@types/node": ["@types/node@24.10.4", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg=="],
|
||||
|
||||
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
|
||||
}
|
||||
}
|
||||
4
bunfig.toml
Normal file
4
bunfig.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
telemetry = false
|
||||
|
||||
[install]
|
||||
linker = "hoisted"
|
||||
62
eslint.config.ts
Normal file
62
eslint.config.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import { defineConfig } from 'eslint/config';
|
||||
import eslintPluginN from 'eslint-plugin-n';
|
||||
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
|
||||
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default defineConfig([
|
||||
eslintPluginPrettier,
|
||||
tseslint.configs.stylisticTypeChecked,
|
||||
tseslint.configs.eslintRecommended,
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ['dist/**', '**/dist/**'],
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
projectService: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
'simple-import-sort': eslintPluginSimpleImportSort,
|
||||
},
|
||||
rules: {
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
n: eslintPluginN,
|
||||
},
|
||||
rules: {
|
||||
'block-scoped-var': 'error',
|
||||
eqeqeq: 'error',
|
||||
'no-var': 'error',
|
||||
'prefer-const': 'error',
|
||||
'eol-last': 'error',
|
||||
'prefer-arrow-callback': 'error',
|
||||
'no-trailing-spaces': 'error',
|
||||
quotes: ['warn', 'single', { avoidEscape: true }],
|
||||
'no-restricted-properties': [
|
||||
'error',
|
||||
{
|
||||
object: 'describe',
|
||||
property: 'only',
|
||||
},
|
||||
{
|
||||
object: 'it',
|
||||
property: 'only',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767640445,
|
||||
"narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
28
flake.nix
Normal file
28
flake.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
description = "xray-core dev shell";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
bun
|
||||
nixfmt
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
51
package.json
Normal file
51
package.json
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "@ruject/xray-core",
|
||||
"version": "0.2.0",
|
||||
"description": "A Typescript SDK for xray-core gRPC Api",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"prepack": "rm -rf dist && bun tsc",
|
||||
"postpack": "rm -rf dist",
|
||||
"build": "bun tsc"
|
||||
},
|
||||
"repository": "github:RuJect/ts-xray-core",
|
||||
"homepage": "https://github.com/RuJect/ts-xray-core#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/RuJect/ts-xray-core/issues"
|
||||
},
|
||||
"packageManager": "bun@1.3.5",
|
||||
"author": "RuJect <https://github.com/RuJect>",
|
||||
"license": "Unlicense",
|
||||
"keywords": [
|
||||
"api",
|
||||
"grpc",
|
||||
"typescript",
|
||||
"sdk",
|
||||
"xtls",
|
||||
"xray",
|
||||
"xray-core"
|
||||
],
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.10.2",
|
||||
"nice-grpc": "^2.1.14",
|
||||
"protobufjs": "^8.0.0",
|
||||
"tar": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
||||
"@typescript-eslint/parser": "^8.52.0",
|
||||
"eslint": "9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-n": "^17.23.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"prettier": "^3.7.4",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0"
|
||||
}
|
||||
}
|
||||
31
src/common/constants/account.ts
Normal file
31
src/common/constants/account.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import {
|
||||
ProtoShadowsocks2022Account,
|
||||
ProtoShadowsocksAccount,
|
||||
ProtoTrojanAccount,
|
||||
ProtoVlessAccount,
|
||||
ProtoVmessAccount,
|
||||
ProtoSocksAccount,
|
||||
ProtoHttpAccount,
|
||||
ProtoAccountType,
|
||||
} from '../protos';
|
||||
import { AccountProtocol } from '../types';
|
||||
|
||||
export const ACCOUNT_TYPES = {
|
||||
[ProtoShadowsocks2022Account.$type]: ProtoShadowsocks2022Account,
|
||||
[ProtoShadowsocksAccount.$type]: ProtoShadowsocksAccount,
|
||||
[ProtoTrojanAccount.$type]: ProtoTrojanAccount,
|
||||
[ProtoVlessAccount.$type]: ProtoVlessAccount,
|
||||
[ProtoVmessAccount.$type]: ProtoVmessAccount,
|
||||
[ProtoSocksAccount.$type]: ProtoSocksAccount,
|
||||
[ProtoHttpAccount.$type]: ProtoHttpAccount,
|
||||
};
|
||||
|
||||
export const ACCOUNT_PROTOCOLS: Record<ProtoAccountType, AccountProtocol> = {
|
||||
[ProtoShadowsocks2022Account.$type]: 'shadowsocks2022',
|
||||
[ProtoShadowsocksAccount.$type]: 'shadowsocks',
|
||||
[ProtoTrojanAccount.$type]: 'trojan',
|
||||
[ProtoVlessAccount.$type]: 'vless',
|
||||
[ProtoVmessAccount.$type]: 'vmess',
|
||||
[ProtoSocksAccount.$type]: 'socks',
|
||||
[ProtoHttpAccount.$type]: 'http',
|
||||
};
|
||||
1
src/common/constants/index.ts
Normal file
1
src/common/constants/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './account';
|
||||
34
src/common/protos/account.ts
Normal file
34
src/common/protos/account.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { Account as _ProtoShadowsocks2022Account } from '../../proto/proxy/shadowsocks_2022/config';
|
||||
import { Account as _ProtoShadowsocksAccount } from '../../proto/proxy/shadowsocks/config';
|
||||
import { Account as _ProtoTrojanAccount } from '../../proto/proxy/trojan/config';
|
||||
import { Account as _ProtoVlessAccount } from '../../proto/proxy/vless/account';
|
||||
import { Account as _ProtoVmessAccount } from '../../proto/proxy/vmess/account';
|
||||
import { Account as _ProtoSocksAccount } from '../../proto/proxy/socks/config';
|
||||
import { Account as _ProtoHttpAccount } from '../../proto/proxy/http/config';
|
||||
|
||||
export type ProtoShadowsocks2022Account = typeof _ProtoShadowsocks2022Account;
|
||||
export type ProtoShadowsocksAccount = typeof _ProtoShadowsocksAccount;
|
||||
export type ProtoTrojanAccount = typeof _ProtoTrojanAccount;
|
||||
export type ProtoVlessAccount = typeof _ProtoVlessAccount;
|
||||
export type ProtoVmessAccount = typeof _ProtoVmessAccount;
|
||||
export type ProtoSocksAccount = typeof _ProtoSocksAccount;
|
||||
export type ProtoHttpAccount = typeof _ProtoHttpAccount;
|
||||
|
||||
export const ProtoShadowsocks2022Account = _ProtoShadowsocks2022Account;
|
||||
export const ProtoShadowsocksAccount = _ProtoShadowsocksAccount;
|
||||
export const ProtoTrojanAccount = _ProtoTrojanAccount;
|
||||
export const ProtoVlessAccount = _ProtoVlessAccount;
|
||||
export const ProtoVmessAccount = _ProtoVmessAccount;
|
||||
export const ProtoSocksAccount = _ProtoSocksAccount;
|
||||
export const ProtoHttpAccount = _ProtoHttpAccount;
|
||||
|
||||
export type ProtoAccount =
|
||||
| ProtoShadowsocks2022Account
|
||||
| ProtoShadowsocksAccount
|
||||
| ProtoTrojanAccount
|
||||
| ProtoVlessAccount
|
||||
| ProtoVmessAccount
|
||||
| ProtoSocksAccount
|
||||
| ProtoHttpAccount;
|
||||
|
||||
export type ProtoAccountType = ProtoAccount['$type'];
|
||||
58
src/common/protos/config.ts
Normal file
58
src/common/protos/config.ts
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import {
|
||||
ServerConfig as _ProtoShadowsocks2022ServerConfig,
|
||||
ClientConfig as _ProtoShadowsocks2022ClientConfig,
|
||||
} from '../../proto/proxy/shadowsocks_2022/config';
|
||||
import {
|
||||
ServerConfig as _ProtoShadowsocksServerConfig,
|
||||
ClientConfig as _ProtoShadowsocksClientConfig,
|
||||
} from '../../proto/proxy/shadowsocks/config';
|
||||
import {
|
||||
ServerConfig as _ProtoTrojanServerConfig,
|
||||
ClientConfig as _ProtoTrojanClientConfig,
|
||||
} from '../../proto/proxy/trojan/config';
|
||||
import {
|
||||
ServerConfig as _ProtoSocksServerConfig,
|
||||
ClientConfig as _ProtoSocksClientConfig,
|
||||
} from '../../proto/proxy/socks/config';
|
||||
import {
|
||||
ServerConfig as _ProtoHttpServerConfig,
|
||||
ClientConfig as _ProtoHttpClientConfig,
|
||||
} from '../../proto/proxy/http/config';
|
||||
|
||||
export type ProtoShadowsocks2022ServerConfig = typeof _ProtoShadowsocks2022ServerConfig;
|
||||
export type ProtoShadowsocksServerConfig = typeof _ProtoShadowsocksServerConfig;
|
||||
export type ProtoTrojanServerConfig = typeof _ProtoTrojanServerConfig;
|
||||
export type ProtoSocksServerConfig = typeof _ProtoSocksServerConfig;
|
||||
export type ProtoHttpServerConfig = typeof _ProtoHttpServerConfig;
|
||||
|
||||
export type ProtoShadowsocks2022ClientConfig = typeof _ProtoShadowsocks2022ClientConfig;
|
||||
export type ProtoShadowsocksClientConfig = typeof _ProtoShadowsocksClientConfig;
|
||||
export type ProtoTrojanClientConfig = typeof _ProtoTrojanClientConfig;
|
||||
export type ProtoSocksClientConfig = typeof _ProtoSocksClientConfig;
|
||||
export type ProtoHttpClientConfig = typeof _ProtoHttpClientConfig;
|
||||
|
||||
export const ProtoShadowsocks2022ServerConfig = _ProtoShadowsocks2022ServerConfig;
|
||||
export const ProtoShadowsocksServerConfig = _ProtoShadowsocksServerConfig;
|
||||
export const ProtoTrojanServerConfig = _ProtoTrojanServerConfig;
|
||||
export const ProtoSocksServerConfig = _ProtoSocksServerConfig;
|
||||
export const ProtoHttpServerConfig = _ProtoHttpServerConfig;
|
||||
|
||||
export const ProtoShadowsocks2022ClientConfig = _ProtoShadowsocks2022ClientConfig;
|
||||
export const ProtoShadowsocksClientConfig = _ProtoShadowsocksClientConfig;
|
||||
export const ProtoTrojanClientConfig = _ProtoTrojanClientConfig;
|
||||
export const ProtoSocksClientConfig = _ProtoSocksClientConfig;
|
||||
export const ProtoHttpClientConfig = _ProtoHttpClientConfig;
|
||||
|
||||
export type ProtoServerConfig =
|
||||
| ProtoShadowsocks2022ServerConfig
|
||||
| ProtoShadowsocksServerConfig
|
||||
| ProtoTrojanServerConfig
|
||||
| ProtoSocksServerConfig
|
||||
| ProtoHttpServerConfig;
|
||||
|
||||
export type ProtoClientConfig =
|
||||
| ProtoShadowsocks2022ClientConfig
|
||||
| ProtoShadowsocksClientConfig
|
||||
| ProtoTrojanClientConfig
|
||||
| ProtoSocksClientConfig
|
||||
| ProtoHttpClientConfig;
|
||||
2
src/common/protos/index.ts
Normal file
2
src/common/protos/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from './account';
|
||||
export * from './config';
|
||||
88
src/common/types/account.ts
Normal file
88
src/common/types/account.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import {
|
||||
ProtoShadowsocks2022Account,
|
||||
ProtoShadowsocksAccount,
|
||||
ProtoTrojanAccount,
|
||||
ProtoVlessAccount,
|
||||
ProtoVmessAccount,
|
||||
ProtoSocksAccount,
|
||||
ProtoHttpAccount,
|
||||
ProtoAccount,
|
||||
} from '../protos';
|
||||
import { InferMessageFns } from './message';
|
||||
|
||||
export interface Shadowsocks2022Account {
|
||||
protocol: 'shadowsocks2022';
|
||||
account: InferMessageFns<ProtoShadowsocks2022Account>;
|
||||
}
|
||||
export interface ShadowsocksAccount {
|
||||
protocol: 'shadowsocks';
|
||||
account: InferMessageFns<ProtoShadowsocksAccount>;
|
||||
}
|
||||
export interface TrojanAccount {
|
||||
protocol: 'trojan';
|
||||
account: InferMessageFns<ProtoTrojanAccount>;
|
||||
}
|
||||
export interface VlessAccount {
|
||||
protocol: 'vless';
|
||||
account: InferMessageFns<ProtoVlessAccount>;
|
||||
}
|
||||
export interface VmessAccount {
|
||||
protocol: 'vmess';
|
||||
account: InferMessageFns<ProtoVmessAccount>;
|
||||
}
|
||||
export interface SocksAccount {
|
||||
protocol: 'socks';
|
||||
account: InferMessageFns<ProtoSocksAccount>;
|
||||
}
|
||||
export interface HttpAccount {
|
||||
protocol: 'http';
|
||||
account: InferMessageFns<ProtoHttpAccount>;
|
||||
}
|
||||
|
||||
export type ProtoInfer<T extends ProtoAccount> = T extends ProtoShadowsocks2022Account
|
||||
? Shadowsocks2022Account
|
||||
: T extends ProtoShadowsocksAccount
|
||||
? ShadowsocksAccount
|
||||
: T extends ProtoTrojanAccount
|
||||
? TrojanAccount
|
||||
: T extends ProtoVlessAccount
|
||||
? VlessAccount
|
||||
: T extends ProtoVmessAccount
|
||||
? VmessAccount
|
||||
: T extends ProtoSocksAccount
|
||||
? SocksAccount
|
||||
: T extends ProtoHttpAccount
|
||||
? HttpAccount
|
||||
: never;
|
||||
|
||||
export type AccountInfer<T extends Account> = T extends Shadowsocks2022Account
|
||||
? ProtoShadowsocks2022Account
|
||||
: T extends ShadowsocksAccount
|
||||
? ProtoShadowsocksAccount
|
||||
: T extends TrojanAccount
|
||||
? ProtoTrojanAccount
|
||||
: T extends VlessAccount
|
||||
? ProtoVlessAccount
|
||||
: T extends VmessAccount
|
||||
? ProtoVmessAccount
|
||||
: T extends SocksAccount
|
||||
? ProtoSocksAccount
|
||||
: T extends HttpAccount
|
||||
? ProtoHttpAccount
|
||||
: never;
|
||||
|
||||
export type BaseAccount =
|
||||
| Shadowsocks2022Account
|
||||
| ShadowsocksAccount
|
||||
| TrojanAccount
|
||||
| VlessAccount
|
||||
| VmessAccount
|
||||
| SocksAccount
|
||||
| HttpAccount;
|
||||
|
||||
export type Account<T extends BaseAccount = BaseAccount> = {
|
||||
email: string;
|
||||
level: number;
|
||||
} & T;
|
||||
|
||||
export type AccountProtocol = BaseAccount['protocol'];
|
||||
3
src/common/types/index.ts
Normal file
3
src/common/types/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export * from './account';
|
||||
export * from './message';
|
||||
export * from './sdk-response';
|
||||
7
src/common/types/message.ts
Normal file
7
src/common/types/message.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { MessageFns } from '../../proto/core/config';
|
||||
|
||||
export type InferMessageFns<T extends MessageFns<unknown, string>> = Required<
|
||||
Exclude<Parameters<T['create']>[0], undefined>
|
||||
>;
|
||||
|
||||
export type InferTypedMessage<T> = Omit<T, '$type'>;
|
||||
12
src/common/types/sdk-response.ts
Normal file
12
src/common/types/sdk-response.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export interface ApiResponseError {
|
||||
isOk: false;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface ApiResponseSuccess<T> {
|
||||
isOk: true;
|
||||
data: T;
|
||||
}
|
||||
|
||||
export type ApiResponse<T> = ApiResponseError | ApiResponseSuccess<T>;
|
||||
export type ApiEmptyResponse = ApiResponseError | { isOk: true };
|
||||
11
src/common/utils/create-typed-message.ts
Normal file
11
src/common/utils/create-typed-message.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { MessageFns, TypedMessage } from '../../proto/common/serial/typed_message';
|
||||
|
||||
export function createTypedMessage<T extends MessageFns<unknown, string>>(
|
||||
proto: T,
|
||||
data: Parameters<T['create']>[0],
|
||||
): TypedMessage {
|
||||
return TypedMessage.create({
|
||||
type: proto.$type,
|
||||
value: proto.encode(proto.create(data)).finish(),
|
||||
});
|
||||
}
|
||||
0
src/common/utils/decode-typed-message.ts
Normal file
0
src/common/utils/decode-typed-message.ts
Normal file
23
src/common/utils/decode-user.ts
Normal file
23
src/common/utils/decode-user.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { User } from '../../proto/common/protocol/user';
|
||||
|
||||
import { ACCOUNT_PROTOCOLS, ACCOUNT_TYPES } from '../constants';
|
||||
import { Account } from '../types';
|
||||
import { ProtoAccountType } from '../protos';
|
||||
|
||||
export const decodeUser = (user: User): Account => {
|
||||
if (!user?.account) {
|
||||
throw new Error('Invalid user object: missing account');
|
||||
}
|
||||
const accountType = user.account.type as ProtoAccountType;
|
||||
const accountConfig = ACCOUNT_TYPES[accountType];
|
||||
const protocol = ACCOUNT_PROTOCOLS[accountType];
|
||||
|
||||
const decodedAccount = accountConfig.decode(user.account.value);
|
||||
|
||||
return {
|
||||
email: user.email,
|
||||
level: user.level,
|
||||
protocol,
|
||||
account: decodedAccount,
|
||||
} as Account;
|
||||
};
|
||||
124
src/common/utils/export-protos.ts
Normal file
124
src/common/utils/export-protos.ts
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/* eslint-disable no-console */
|
||||
import { exec } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
import * as path from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
import * as fs from 'node:fs';
|
||||
import * as tar from 'tar';
|
||||
|
||||
interface Context {
|
||||
version: string;
|
||||
temp_dir: string;
|
||||
target_url: string;
|
||||
proto_dir: string;
|
||||
}
|
||||
|
||||
async function downloadTarGz(url: string, dest: string) {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) throw new Error(`Failed to download file: ${response.statusText}`);
|
||||
|
||||
const buffer = await response.arrayBuffer();
|
||||
fs.writeFileSync(dest, new Uint8Array(buffer));
|
||||
console.log(`Core extracted to ${dest}`);
|
||||
}
|
||||
|
||||
async function extractProtoFiles(ctx: Context, tarPath: string) {
|
||||
await tar.x({
|
||||
file: tarPath,
|
||||
cwd: ctx.temp_dir,
|
||||
strip: 1,
|
||||
});
|
||||
console.log('Core extracted');
|
||||
|
||||
const protoFiles = findProtoFiles(ctx.temp_dir);
|
||||
|
||||
return protoFiles;
|
||||
}
|
||||
|
||||
function findProtoFiles(dir: string, fileList: string[] = []): string[] {
|
||||
const files = fs.readdirSync(dir);
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(dir, file);
|
||||
const stat = fs.statSync(filePath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
findProtoFiles(filePath, fileList);
|
||||
} else if (path.extname(file) === '.proto') {
|
||||
fileList.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return fileList;
|
||||
}
|
||||
|
||||
async function generateTsFromProto(protoFile: string): Promise<void> {
|
||||
try {
|
||||
console.log(protoFile);
|
||||
|
||||
const dir = path.join(__dirname, '../src/proto');
|
||||
|
||||
const command = [
|
||||
'protoc',
|
||||
`--plugin=./node_modules/.bin/protoc-gen-ts_proto`,
|
||||
`--ts_proto_out=${dir}`,
|
||||
`--ts_proto_opt=outputServices=generic-definitions,useExactTypes=false`,
|
||||
`--ts_proto_opt=outputServices=nice-grpc`,
|
||||
|
||||
`--ts_proto_opt=outputTypeRegistry=true`,
|
||||
`--ts_proto_opt=outputEncodeMethods=true`,
|
||||
`--ts_proto_opt=outputJsonMethods=true`,
|
||||
`--ts_proto_opt=lowerCaseServiceMethods=true`,
|
||||
`--proto_path=${path.join(__dirname, '../scripts/temp-xray-core')}`,
|
||||
protoFile,
|
||||
].join(' ');
|
||||
|
||||
console.log(`Generating TypeScript for: ${protoFile}`);
|
||||
const { stdout, stderr } = await promisify(exec)(command);
|
||||
|
||||
if (stderr) {
|
||||
console.error(`Error for ${protoFile}:`, stderr);
|
||||
}
|
||||
if (stdout) {
|
||||
console.log(`Output for ${protoFile}:`, stdout);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Failed to generate TypeScript for ${protoFile}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
async function generateProtoDir(ctx: Context) {
|
||||
try {
|
||||
if (!fs.existsSync(ctx.temp_dir)) {
|
||||
fs.mkdirSync(ctx.temp_dir);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(ctx.proto_dir)) {
|
||||
fs.mkdirSync(ctx.proto_dir, { recursive: true });
|
||||
}
|
||||
|
||||
const tarPath = path.join(ctx.temp_dir, `xray-core-${ctx.version}.tar.gz`);
|
||||
|
||||
await downloadTarGz(ctx.target_url, tarPath);
|
||||
const protoFiles = await extractProtoFiles(ctx, tarPath);
|
||||
|
||||
for (const protoFile of protoFiles) {
|
||||
await generateTsFromProto(protoFile);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Unexpected error:', error);
|
||||
} finally {
|
||||
fs.rmSync(ctx.temp_dir, { recursive: true, force: true });
|
||||
console.log('Temp directory removed');
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateProtos(version: string, protoDir: string): Promise<void> {
|
||||
const ctx: Context = {
|
||||
version,
|
||||
temp_dir: path.join(tmpdir(), 'xray-core'),
|
||||
target_url: `https://github.com/XTLS/Xray-core/archive/refs/tags/v${version}.tar.gz`,
|
||||
proto_dir: protoDir,
|
||||
};
|
||||
await generateProtoDir(ctx);
|
||||
}
|
||||
4
src/common/utils/index.ts
Normal file
4
src/common/utils/index.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export * from './create-typed-message';
|
||||
export * from './decode-typed-message';
|
||||
export * from './decode-user';
|
||||
export * from './try-call';
|
||||
14
src/common/utils/try-call.ts
Normal file
14
src/common/utils/try-call.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { ApiResponse } from '../types';
|
||||
|
||||
export async function tryCall<T>(promise: Promise<T>): Promise<ApiResponse<T>> {
|
||||
try {
|
||||
const data = await promise;
|
||||
return { isOk: true, data };
|
||||
} catch (error) {
|
||||
let message = '';
|
||||
if (error instanceof Error) {
|
||||
message = error.message;
|
||||
}
|
||||
return { isOk: false, message };
|
||||
}
|
||||
}
|
||||
16
src/index.ts
Normal file
16
src/index.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { createChannel, Channel, ChannelOptions } from 'nice-grpc';
|
||||
|
||||
import { HandlerService } from './services';
|
||||
|
||||
export class XrayClient {
|
||||
public readonly channel: Channel;
|
||||
public readonly handler: HandlerService;
|
||||
|
||||
constructor(ip: string, port: string, options?: ChannelOptions) {
|
||||
this.channel = createChannel(`${ip}:${port}`, undefined, {
|
||||
...options,
|
||||
});
|
||||
this.handler = new HandlerService(this.channel);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
199
src/proto/app/commander/config.ts
Normal file
199
src/proto/app/commander/config.ts
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/commander/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { TypedMessage } from "../../common/serial/typed_message";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.commander";
|
||||
|
||||
/** Config is the settings for Commander. */
|
||||
export interface Config {
|
||||
$type: "xray.app.commander.Config";
|
||||
/** Tag of the outbound handler that handles grpc connections. */
|
||||
tag: string;
|
||||
/** Network address of commander grpc service. */
|
||||
listen: string;
|
||||
/**
|
||||
* Services that supported by this server. All services must implement Service
|
||||
* interface.
|
||||
*/
|
||||
service: TypedMessage[];
|
||||
}
|
||||
|
||||
/** ReflectionConfig is the placeholder config for ReflectionService. */
|
||||
export interface ReflectionConfig {
|
||||
$type: "xray.app.commander.ReflectionConfig";
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.commander.Config", tag: "", listen: "", service: [] };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.commander.Config"> = {
|
||||
$type: "xray.app.commander.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.listen !== "") {
|
||||
writer.uint32(26).string(message.listen);
|
||||
}
|
||||
for (const v of message.service) {
|
||||
TypedMessage.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.listen = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.service.push(TypedMessage.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
listen: isSet(object.listen) ? globalThis.String(object.listen) : "",
|
||||
service: globalThis.Array.isArray(object?.service)
|
||||
? object.service.map((e: any) => TypedMessage.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.listen !== "") {
|
||||
obj.listen = message.listen;
|
||||
}
|
||||
if (message.service?.length) {
|
||||
obj.service = message.service.map((e) => TypedMessage.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.listen = object.listen ?? "";
|
||||
message.service = object.service?.map((e) => TypedMessage.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseReflectionConfig(): ReflectionConfig {
|
||||
return { $type: "xray.app.commander.ReflectionConfig" };
|
||||
}
|
||||
|
||||
export const ReflectionConfig: MessageFns<ReflectionConfig, "xray.app.commander.ReflectionConfig"> = {
|
||||
$type: "xray.app.commander.ReflectionConfig" as const,
|
||||
|
||||
encode(_: ReflectionConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ReflectionConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseReflectionConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): ReflectionConfig {
|
||||
return { $type: ReflectionConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: ReflectionConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ReflectionConfig>): ReflectionConfig {
|
||||
return ReflectionConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<ReflectionConfig>): ReflectionConfig {
|
||||
const message = createBaseReflectionConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ReflectionConfig.$type, ReflectionConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
156
src/proto/app/dispatcher/config.ts
Normal file
156
src/proto/app/dispatcher/config.ts
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/dispatcher/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.dispatcher";
|
||||
|
||||
export interface SessionConfig {
|
||||
$type: "xray.app.dispatcher.SessionConfig";
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.dispatcher.Config";
|
||||
settings: SessionConfig | undefined;
|
||||
}
|
||||
|
||||
function createBaseSessionConfig(): SessionConfig {
|
||||
return { $type: "xray.app.dispatcher.SessionConfig" };
|
||||
}
|
||||
|
||||
export const SessionConfig: MessageFns<SessionConfig, "xray.app.dispatcher.SessionConfig"> = {
|
||||
$type: "xray.app.dispatcher.SessionConfig" as const,
|
||||
|
||||
encode(_: SessionConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SessionConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSessionConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): SessionConfig {
|
||||
return { $type: SessionConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: SessionConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SessionConfig>): SessionConfig {
|
||||
return SessionConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<SessionConfig>): SessionConfig {
|
||||
const message = createBaseSessionConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SessionConfig.$type, SessionConfig);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.dispatcher.Config", settings: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.dispatcher.Config"> = {
|
||||
$type: "xray.app.dispatcher.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.settings !== undefined) {
|
||||
SessionConfig.encode(message.settings, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.settings = SessionConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
settings: isSet(object.settings) ? SessionConfig.fromJSON(object.settings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.settings !== undefined) {
|
||||
obj.settings = SessionConfig.toJSON(message.settings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.settings = (object.settings !== undefined && object.settings !== null)
|
||||
? SessionConfig.fromPartial(object.settings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
1103
src/proto/app/dns/config.ts
Normal file
1103
src/proto/app/dns/config.ts
Normal file
File diff suppressed because it is too large
Load diff
203
src/proto/app/dns/fakedns/fakedns.ts
Normal file
203
src/proto/app/dns/fakedns/fakedns.ts
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/dns/fakedns/fakedns.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.dns.fakedns";
|
||||
|
||||
export interface FakeDnsPool {
|
||||
$type: "xray.app.dns.fakedns.FakeDnsPool";
|
||||
/** CIDR of IP pool used as fake DNS IP */
|
||||
ipPool: string;
|
||||
/** Size of Pool for remembering relationship between domain name and IP address */
|
||||
lruSize: number;
|
||||
}
|
||||
|
||||
export interface FakeDnsPoolMulti {
|
||||
$type: "xray.app.dns.fakedns.FakeDnsPoolMulti";
|
||||
pools: FakeDnsPool[];
|
||||
}
|
||||
|
||||
function createBaseFakeDnsPool(): FakeDnsPool {
|
||||
return { $type: "xray.app.dns.fakedns.FakeDnsPool", ipPool: "", lruSize: 0 };
|
||||
}
|
||||
|
||||
export const FakeDnsPool: MessageFns<FakeDnsPool, "xray.app.dns.fakedns.FakeDnsPool"> = {
|
||||
$type: "xray.app.dns.fakedns.FakeDnsPool" as const,
|
||||
|
||||
encode(message: FakeDnsPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.ipPool !== "") {
|
||||
writer.uint32(10).string(message.ipPool);
|
||||
}
|
||||
if (message.lruSize !== 0) {
|
||||
writer.uint32(16).int64(message.lruSize);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): FakeDnsPool {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFakeDnsPool();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ipPool = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lruSize = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): FakeDnsPool {
|
||||
return {
|
||||
$type: FakeDnsPool.$type,
|
||||
ipPool: isSet(object.ipPool) ? globalThis.String(object.ipPool) : "",
|
||||
lruSize: isSet(object.lruSize) ? globalThis.Number(object.lruSize) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: FakeDnsPool): unknown {
|
||||
const obj: any = {};
|
||||
if (message.ipPool !== "") {
|
||||
obj.ipPool = message.ipPool;
|
||||
}
|
||||
if (message.lruSize !== 0) {
|
||||
obj.lruSize = Math.round(message.lruSize);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<FakeDnsPool>): FakeDnsPool {
|
||||
return FakeDnsPool.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<FakeDnsPool>): FakeDnsPool {
|
||||
const message = createBaseFakeDnsPool();
|
||||
message.ipPool = object.ipPool ?? "";
|
||||
message.lruSize = object.lruSize ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(FakeDnsPool.$type, FakeDnsPool);
|
||||
|
||||
function createBaseFakeDnsPoolMulti(): FakeDnsPoolMulti {
|
||||
return { $type: "xray.app.dns.fakedns.FakeDnsPoolMulti", pools: [] };
|
||||
}
|
||||
|
||||
export const FakeDnsPoolMulti: MessageFns<FakeDnsPoolMulti, "xray.app.dns.fakedns.FakeDnsPoolMulti"> = {
|
||||
$type: "xray.app.dns.fakedns.FakeDnsPoolMulti" as const,
|
||||
|
||||
encode(message: FakeDnsPoolMulti, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.pools) {
|
||||
FakeDnsPool.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): FakeDnsPoolMulti {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFakeDnsPoolMulti();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pools.push(FakeDnsPool.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): FakeDnsPoolMulti {
|
||||
return {
|
||||
$type: FakeDnsPoolMulti.$type,
|
||||
pools: globalThis.Array.isArray(object?.pools) ? object.pools.map((e: any) => FakeDnsPool.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: FakeDnsPoolMulti): unknown {
|
||||
const obj: any = {};
|
||||
if (message.pools?.length) {
|
||||
obj.pools = message.pools.map((e) => FakeDnsPool.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<FakeDnsPoolMulti>): FakeDnsPoolMulti {
|
||||
return FakeDnsPoolMulti.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<FakeDnsPoolMulti>): FakeDnsPoolMulti {
|
||||
const message = createBaseFakeDnsPoolMulti();
|
||||
message.pools = object.pools?.map((e) => FakeDnsPool.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(FakeDnsPoolMulti.$type, FakeDnsPoolMulti);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
213
src/proto/app/log/command/config.ts
Normal file
213
src/proto/app/log/command/config.ts
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/log/command/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { CallContext, CallOptions } from "nice-grpc-common";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.log.command";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.log.command.Config";
|
||||
}
|
||||
|
||||
export interface RestartLoggerRequest {
|
||||
$type: "xray.app.log.command.RestartLoggerRequest";
|
||||
}
|
||||
|
||||
export interface RestartLoggerResponse {
|
||||
$type: "xray.app.log.command.RestartLoggerResponse";
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.log.command.Config" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.log.command.Config"> = {
|
||||
$type: "xray.app.log.command.Config" as const,
|
||||
|
||||
encode(_: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Config {
|
||||
return { $type: Config.$type };
|
||||
},
|
||||
|
||||
toJSON(_: Config): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseRestartLoggerRequest(): RestartLoggerRequest {
|
||||
return { $type: "xray.app.log.command.RestartLoggerRequest" };
|
||||
}
|
||||
|
||||
export const RestartLoggerRequest: MessageFns<RestartLoggerRequest, "xray.app.log.command.RestartLoggerRequest"> = {
|
||||
$type: "xray.app.log.command.RestartLoggerRequest" as const,
|
||||
|
||||
encode(_: RestartLoggerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RestartLoggerRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRestartLoggerRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): RestartLoggerRequest {
|
||||
return { $type: RestartLoggerRequest.$type };
|
||||
},
|
||||
|
||||
toJSON(_: RestartLoggerRequest): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RestartLoggerRequest>): RestartLoggerRequest {
|
||||
return RestartLoggerRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<RestartLoggerRequest>): RestartLoggerRequest {
|
||||
const message = createBaseRestartLoggerRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RestartLoggerRequest.$type, RestartLoggerRequest);
|
||||
|
||||
function createBaseRestartLoggerResponse(): RestartLoggerResponse {
|
||||
return { $type: "xray.app.log.command.RestartLoggerResponse" };
|
||||
}
|
||||
|
||||
export const RestartLoggerResponse: MessageFns<RestartLoggerResponse, "xray.app.log.command.RestartLoggerResponse"> = {
|
||||
$type: "xray.app.log.command.RestartLoggerResponse" as const,
|
||||
|
||||
encode(_: RestartLoggerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RestartLoggerResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRestartLoggerResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): RestartLoggerResponse {
|
||||
return { $type: RestartLoggerResponse.$type };
|
||||
},
|
||||
|
||||
toJSON(_: RestartLoggerResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RestartLoggerResponse>): RestartLoggerResponse {
|
||||
return RestartLoggerResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<RestartLoggerResponse>): RestartLoggerResponse {
|
||||
const message = createBaseRestartLoggerResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RestartLoggerResponse.$type, RestartLoggerResponse);
|
||||
|
||||
export type LoggerServiceDefinition = typeof LoggerServiceDefinition;
|
||||
export const LoggerServiceDefinition = {
|
||||
name: "LoggerService",
|
||||
fullName: "xray.app.log.command.LoggerService",
|
||||
methods: {
|
||||
restartLogger: {
|
||||
name: "RestartLogger",
|
||||
requestType: RestartLoggerRequest,
|
||||
requestStream: false,
|
||||
responseType: RestartLoggerResponse,
|
||||
responseStream: false,
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export interface LoggerServiceImplementation<CallContextExt = {}> {
|
||||
restartLogger(
|
||||
request: RestartLoggerRequest,
|
||||
context: CallContext & CallContextExt,
|
||||
): Promise<DeepPartial<RestartLoggerResponse>>;
|
||||
}
|
||||
|
||||
export interface LoggerServiceClient<CallOptionsExt = {}> {
|
||||
restartLogger(
|
||||
request: DeepPartial<RestartLoggerRequest>,
|
||||
options?: CallOptions & CallOptionsExt,
|
||||
): Promise<RestartLoggerResponse>;
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
260
src/proto/app/log/config.ts
Normal file
260
src/proto/app/log/config.ts
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/log/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Severity, severityFromJSON, severityToJSON } from "../../common/log/log";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.log";
|
||||
|
||||
export enum LogType {
|
||||
None = 0,
|
||||
Console = 1,
|
||||
File = 2,
|
||||
Event = 3,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function logTypeFromJSON(object: any): LogType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "None":
|
||||
return LogType.None;
|
||||
case 1:
|
||||
case "Console":
|
||||
return LogType.Console;
|
||||
case 2:
|
||||
case "File":
|
||||
return LogType.File;
|
||||
case 3:
|
||||
case "Event":
|
||||
return LogType.Event;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return LogType.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function logTypeToJSON(object: LogType): string {
|
||||
switch (object) {
|
||||
case LogType.None:
|
||||
return "None";
|
||||
case LogType.Console:
|
||||
return "Console";
|
||||
case LogType.File:
|
||||
return "File";
|
||||
case LogType.Event:
|
||||
return "Event";
|
||||
case LogType.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.log.Config";
|
||||
errorLogType: LogType;
|
||||
errorLogLevel: Severity;
|
||||
errorLogPath: string;
|
||||
accessLogType: LogType;
|
||||
accessLogPath: string;
|
||||
enableDnsLog: boolean;
|
||||
maskAddress: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.app.log.Config",
|
||||
errorLogType: 0,
|
||||
errorLogLevel: 0,
|
||||
errorLogPath: "",
|
||||
accessLogType: 0,
|
||||
accessLogPath: "",
|
||||
enableDnsLog: false,
|
||||
maskAddress: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.log.Config"> = {
|
||||
$type: "xray.app.log.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.errorLogType !== 0) {
|
||||
writer.uint32(8).int32(message.errorLogType);
|
||||
}
|
||||
if (message.errorLogLevel !== 0) {
|
||||
writer.uint32(16).int32(message.errorLogLevel);
|
||||
}
|
||||
if (message.errorLogPath !== "") {
|
||||
writer.uint32(26).string(message.errorLogPath);
|
||||
}
|
||||
if (message.accessLogType !== 0) {
|
||||
writer.uint32(32).int32(message.accessLogType);
|
||||
}
|
||||
if (message.accessLogPath !== "") {
|
||||
writer.uint32(42).string(message.accessLogPath);
|
||||
}
|
||||
if (message.enableDnsLog !== false) {
|
||||
writer.uint32(48).bool(message.enableDnsLog);
|
||||
}
|
||||
if (message.maskAddress !== "") {
|
||||
writer.uint32(58).string(message.maskAddress);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.errorLogType = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.errorLogLevel = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.errorLogPath = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.accessLogType = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.accessLogPath = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enableDnsLog = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maskAddress = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
errorLogType: isSet(object.errorLogType) ? logTypeFromJSON(object.errorLogType) : 0,
|
||||
errorLogLevel: isSet(object.errorLogLevel) ? severityFromJSON(object.errorLogLevel) : 0,
|
||||
errorLogPath: isSet(object.errorLogPath) ? globalThis.String(object.errorLogPath) : "",
|
||||
accessLogType: isSet(object.accessLogType) ? logTypeFromJSON(object.accessLogType) : 0,
|
||||
accessLogPath: isSet(object.accessLogPath) ? globalThis.String(object.accessLogPath) : "",
|
||||
enableDnsLog: isSet(object.enableDnsLog) ? globalThis.Boolean(object.enableDnsLog) : false,
|
||||
maskAddress: isSet(object.maskAddress) ? globalThis.String(object.maskAddress) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.errorLogType !== 0) {
|
||||
obj.errorLogType = logTypeToJSON(message.errorLogType);
|
||||
}
|
||||
if (message.errorLogLevel !== 0) {
|
||||
obj.errorLogLevel = severityToJSON(message.errorLogLevel);
|
||||
}
|
||||
if (message.errorLogPath !== "") {
|
||||
obj.errorLogPath = message.errorLogPath;
|
||||
}
|
||||
if (message.accessLogType !== 0) {
|
||||
obj.accessLogType = logTypeToJSON(message.accessLogType);
|
||||
}
|
||||
if (message.accessLogPath !== "") {
|
||||
obj.accessLogPath = message.accessLogPath;
|
||||
}
|
||||
if (message.enableDnsLog !== false) {
|
||||
obj.enableDnsLog = message.enableDnsLog;
|
||||
}
|
||||
if (message.maskAddress !== "") {
|
||||
obj.maskAddress = message.maskAddress;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.errorLogType = object.errorLogType ?? 0;
|
||||
message.errorLogLevel = object.errorLogLevel ?? 0;
|
||||
message.errorLogPath = object.errorLogPath ?? "";
|
||||
message.accessLogType = object.accessLogType ?? 0;
|
||||
message.accessLogPath = object.accessLogPath ?? "";
|
||||
message.enableDnsLog = object.enableDnsLog ?? false;
|
||||
message.maskAddress = object.maskAddress ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
122
src/proto/app/metrics/config.ts
Normal file
122
src/proto/app/metrics/config.ts
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/metrics/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.metrics";
|
||||
|
||||
/** Config is the settings for metrics. */
|
||||
export interface Config {
|
||||
$type: "xray.app.metrics.Config";
|
||||
/** Tag of the outbound handler that handles metrics http connections. */
|
||||
tag: string;
|
||||
listen: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.metrics.Config", tag: "", listen: "" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.metrics.Config"> = {
|
||||
$type: "xray.app.metrics.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.listen !== "") {
|
||||
writer.uint32(18).string(message.listen);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.listen = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
listen: isSet(object.listen) ? globalThis.String(object.listen) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.listen !== "") {
|
||||
obj.listen = message.listen;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.listen = object.listen ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
308
src/proto/app/observatory/burst/config.ts
Normal file
308
src/proto/app/observatory/burst/config.ts
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/observatory/burst/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.core.app.observatory.burst";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.core.app.observatory.burst.Config";
|
||||
/** @Document The selectors for outbound under observation */
|
||||
subjectSelector: string[];
|
||||
pingConfig: HealthPingConfig | undefined;
|
||||
}
|
||||
|
||||
export interface HealthPingConfig {
|
||||
$type: "xray.core.app.observatory.burst.HealthPingConfig";
|
||||
/**
|
||||
* destination url, need 204 for success return
|
||||
* default https://connectivitycheck.gstatic.com/generate_204
|
||||
*/
|
||||
destination: string;
|
||||
/** connectivity check url */
|
||||
connectivity: string;
|
||||
/** health check interval, int64 values of time.Duration */
|
||||
interval: number;
|
||||
/** sampling count is the amount of recent ping results which are kept for calculation */
|
||||
samplingCount: number;
|
||||
/** ping timeout, int64 values of time.Duration */
|
||||
timeout: number;
|
||||
/** http method to make request */
|
||||
httpMethod: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.core.app.observatory.burst.Config", subjectSelector: [], pingConfig: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.core.app.observatory.burst.Config"> = {
|
||||
$type: "xray.core.app.observatory.burst.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.subjectSelector) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
if (message.pingConfig !== undefined) {
|
||||
HealthPingConfig.encode(message.pingConfig, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.subjectSelector.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pingConfig = HealthPingConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
subjectSelector: globalThis.Array.isArray(object?.subjectSelector)
|
||||
? object.subjectSelector.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
pingConfig: isSet(object.pingConfig) ? HealthPingConfig.fromJSON(object.pingConfig) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.subjectSelector?.length) {
|
||||
obj.subjectSelector = message.subjectSelector;
|
||||
}
|
||||
if (message.pingConfig !== undefined) {
|
||||
obj.pingConfig = HealthPingConfig.toJSON(message.pingConfig);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.subjectSelector = object.subjectSelector?.map((e) => e) || [];
|
||||
message.pingConfig = (object.pingConfig !== undefined && object.pingConfig !== null)
|
||||
? HealthPingConfig.fromPartial(object.pingConfig)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseHealthPingConfig(): HealthPingConfig {
|
||||
return {
|
||||
$type: "xray.core.app.observatory.burst.HealthPingConfig",
|
||||
destination: "",
|
||||
connectivity: "",
|
||||
interval: 0,
|
||||
samplingCount: 0,
|
||||
timeout: 0,
|
||||
httpMethod: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const HealthPingConfig: MessageFns<HealthPingConfig, "xray.core.app.observatory.burst.HealthPingConfig"> = {
|
||||
$type: "xray.core.app.observatory.burst.HealthPingConfig" as const,
|
||||
|
||||
encode(message: HealthPingConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.destination !== "") {
|
||||
writer.uint32(10).string(message.destination);
|
||||
}
|
||||
if (message.connectivity !== "") {
|
||||
writer.uint32(18).string(message.connectivity);
|
||||
}
|
||||
if (message.interval !== 0) {
|
||||
writer.uint32(24).int64(message.interval);
|
||||
}
|
||||
if (message.samplingCount !== 0) {
|
||||
writer.uint32(32).int32(message.samplingCount);
|
||||
}
|
||||
if (message.timeout !== 0) {
|
||||
writer.uint32(40).int64(message.timeout);
|
||||
}
|
||||
if (message.httpMethod !== "") {
|
||||
writer.uint32(50).string(message.httpMethod);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): HealthPingConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHealthPingConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.destination = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.connectivity = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.interval = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.samplingCount = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.timeout = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.httpMethod = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): HealthPingConfig {
|
||||
return {
|
||||
$type: HealthPingConfig.$type,
|
||||
destination: isSet(object.destination) ? globalThis.String(object.destination) : "",
|
||||
connectivity: isSet(object.connectivity) ? globalThis.String(object.connectivity) : "",
|
||||
interval: isSet(object.interval) ? globalThis.Number(object.interval) : 0,
|
||||
samplingCount: isSet(object.samplingCount) ? globalThis.Number(object.samplingCount) : 0,
|
||||
timeout: isSet(object.timeout) ? globalThis.Number(object.timeout) : 0,
|
||||
httpMethod: isSet(object.httpMethod) ? globalThis.String(object.httpMethod) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: HealthPingConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.destination !== "") {
|
||||
obj.destination = message.destination;
|
||||
}
|
||||
if (message.connectivity !== "") {
|
||||
obj.connectivity = message.connectivity;
|
||||
}
|
||||
if (message.interval !== 0) {
|
||||
obj.interval = Math.round(message.interval);
|
||||
}
|
||||
if (message.samplingCount !== 0) {
|
||||
obj.samplingCount = Math.round(message.samplingCount);
|
||||
}
|
||||
if (message.timeout !== 0) {
|
||||
obj.timeout = Math.round(message.timeout);
|
||||
}
|
||||
if (message.httpMethod !== "") {
|
||||
obj.httpMethod = message.httpMethod;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<HealthPingConfig>): HealthPingConfig {
|
||||
return HealthPingConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<HealthPingConfig>): HealthPingConfig {
|
||||
const message = createBaseHealthPingConfig();
|
||||
message.destination = object.destination ?? "";
|
||||
message.connectivity = object.connectivity ?? "";
|
||||
message.interval = object.interval ?? 0;
|
||||
message.samplingCount = object.samplingCount ?? 0;
|
||||
message.timeout = object.timeout ?? 0;
|
||||
message.httpMethod = object.httpMethod ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(HealthPingConfig.$type, HealthPingConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
245
src/proto/app/observatory/command/command.ts
Normal file
245
src/proto/app/observatory/command/command.ts
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/observatory/command/command.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { CallContext, CallOptions } from "nice-grpc-common";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
import { ObservationResult } from "../config";
|
||||
|
||||
export const protobufPackage = "xray.core.app.observatory.command";
|
||||
|
||||
export interface GetOutboundStatusRequest {
|
||||
$type: "xray.core.app.observatory.command.GetOutboundStatusRequest";
|
||||
}
|
||||
|
||||
export interface GetOutboundStatusResponse {
|
||||
$type: "xray.core.app.observatory.command.GetOutboundStatusResponse";
|
||||
status: ObservationResult | undefined;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.core.app.observatory.command.Config";
|
||||
}
|
||||
|
||||
function createBaseGetOutboundStatusRequest(): GetOutboundStatusRequest {
|
||||
return { $type: "xray.core.app.observatory.command.GetOutboundStatusRequest" };
|
||||
}
|
||||
|
||||
export const GetOutboundStatusRequest: MessageFns<
|
||||
GetOutboundStatusRequest,
|
||||
"xray.core.app.observatory.command.GetOutboundStatusRequest"
|
||||
> = {
|
||||
$type: "xray.core.app.observatory.command.GetOutboundStatusRequest" as const,
|
||||
|
||||
encode(_: GetOutboundStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetOutboundStatusRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetOutboundStatusRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): GetOutboundStatusRequest {
|
||||
return { $type: GetOutboundStatusRequest.$type };
|
||||
},
|
||||
|
||||
toJSON(_: GetOutboundStatusRequest): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetOutboundStatusRequest>): GetOutboundStatusRequest {
|
||||
return GetOutboundStatusRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<GetOutboundStatusRequest>): GetOutboundStatusRequest {
|
||||
const message = createBaseGetOutboundStatusRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(GetOutboundStatusRequest.$type, GetOutboundStatusRequest);
|
||||
|
||||
function createBaseGetOutboundStatusResponse(): GetOutboundStatusResponse {
|
||||
return { $type: "xray.core.app.observatory.command.GetOutboundStatusResponse", status: undefined };
|
||||
}
|
||||
|
||||
export const GetOutboundStatusResponse: MessageFns<
|
||||
GetOutboundStatusResponse,
|
||||
"xray.core.app.observatory.command.GetOutboundStatusResponse"
|
||||
> = {
|
||||
$type: "xray.core.app.observatory.command.GetOutboundStatusResponse" as const,
|
||||
|
||||
encode(message: GetOutboundStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.status !== undefined) {
|
||||
ObservationResult.encode(message.status, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetOutboundStatusResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetOutboundStatusResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.status = ObservationResult.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GetOutboundStatusResponse {
|
||||
return {
|
||||
$type: GetOutboundStatusResponse.$type,
|
||||
status: isSet(object.status) ? ObservationResult.fromJSON(object.status) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GetOutboundStatusResponse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.status !== undefined) {
|
||||
obj.status = ObservationResult.toJSON(message.status);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetOutboundStatusResponse>): GetOutboundStatusResponse {
|
||||
return GetOutboundStatusResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetOutboundStatusResponse>): GetOutboundStatusResponse {
|
||||
const message = createBaseGetOutboundStatusResponse();
|
||||
message.status = (object.status !== undefined && object.status !== null)
|
||||
? ObservationResult.fromPartial(object.status)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(GetOutboundStatusResponse.$type, GetOutboundStatusResponse);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.core.app.observatory.command.Config" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.core.app.observatory.command.Config"> = {
|
||||
$type: "xray.core.app.observatory.command.Config" as const,
|
||||
|
||||
encode(_: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Config {
|
||||
return { $type: Config.$type };
|
||||
},
|
||||
|
||||
toJSON(_: Config): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
export type ObservatoryServiceDefinition = typeof ObservatoryServiceDefinition;
|
||||
export const ObservatoryServiceDefinition = {
|
||||
name: "ObservatoryService",
|
||||
fullName: "xray.core.app.observatory.command.ObservatoryService",
|
||||
methods: {
|
||||
getOutboundStatus: {
|
||||
name: "GetOutboundStatus",
|
||||
requestType: GetOutboundStatusRequest,
|
||||
requestStream: false,
|
||||
responseType: GetOutboundStatusResponse,
|
||||
responseStream: false,
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export interface ObservatoryServiceImplementation<CallContextExt = {}> {
|
||||
getOutboundStatus(
|
||||
request: GetOutboundStatusRequest,
|
||||
context: CallContext & CallContextExt,
|
||||
): Promise<DeepPartial<GetOutboundStatusResponse>>;
|
||||
}
|
||||
|
||||
export interface ObservatoryServiceClient<CallOptionsExt = {}> {
|
||||
getOutboundStatus(
|
||||
request: DeepPartial<GetOutboundStatusRequest>,
|
||||
options?: CallOptions & CallOptionsExt,
|
||||
): Promise<GetOutboundStatusResponse>;
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
809
src/proto/app/observatory/config.ts
Normal file
809
src/proto/app/observatory/config.ts
Normal file
|
|
@ -0,0 +1,809 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/observatory/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.core.app.observatory";
|
||||
|
||||
export interface ObservationResult {
|
||||
$type: "xray.core.app.observatory.ObservationResult";
|
||||
status: OutboundStatus[];
|
||||
}
|
||||
|
||||
export interface HealthPingMeasurementResult {
|
||||
$type: "xray.core.app.observatory.HealthPingMeasurementResult";
|
||||
all: number;
|
||||
fail: number;
|
||||
deviation: number;
|
||||
average: number;
|
||||
max: number;
|
||||
min: number;
|
||||
}
|
||||
|
||||
export interface OutboundStatus {
|
||||
$type: "xray.core.app.observatory.OutboundStatus";
|
||||
/**
|
||||
* @Document Whether this outbound is usable
|
||||
* @Restriction ReadOnlyForUser
|
||||
*/
|
||||
alive: boolean;
|
||||
/**
|
||||
* @Document The time for probe request to finish.
|
||||
* @Type time.ms
|
||||
* @Restriction ReadOnlyForUser
|
||||
*/
|
||||
delay: number;
|
||||
/**
|
||||
* @Document The last error caused this outbound failed to relay probe request
|
||||
* @Restriction NotMachineReadable
|
||||
*/
|
||||
lastErrorReason: string;
|
||||
/**
|
||||
* @Document The outbound tag for this Server
|
||||
* @Type id.outboundTag
|
||||
*/
|
||||
outboundTag: string;
|
||||
/**
|
||||
* @Document The time this outbound is known to be alive
|
||||
* @Type id.outboundTag
|
||||
*/
|
||||
lastSeenTime: number;
|
||||
/**
|
||||
* @Document The time this outbound is tried
|
||||
* @Type id.outboundTag
|
||||
*/
|
||||
lastTryTime: number;
|
||||
healthPing: HealthPingMeasurementResult | undefined;
|
||||
}
|
||||
|
||||
export interface ProbeResult {
|
||||
$type: "xray.core.app.observatory.ProbeResult";
|
||||
/**
|
||||
* @Document Whether this outbound is usable
|
||||
* @Restriction ReadOnlyForUser
|
||||
*/
|
||||
alive: boolean;
|
||||
/**
|
||||
* @Document The time for probe request to finish.
|
||||
* @Type time.ms
|
||||
* @Restriction ReadOnlyForUser
|
||||
*/
|
||||
delay: number;
|
||||
/**
|
||||
* @Document The error caused this outbound failed to relay probe request
|
||||
* @Restriction NotMachineReadable
|
||||
*/
|
||||
lastErrorReason: string;
|
||||
}
|
||||
|
||||
export interface Intensity {
|
||||
$type: "xray.core.app.observatory.Intensity";
|
||||
/**
|
||||
* @Document The time interval for a probe request in ms.
|
||||
* @Type time.ms
|
||||
*/
|
||||
probeInterval: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.core.app.observatory.Config";
|
||||
/** @Document The selectors for outbound under observation */
|
||||
subjectSelector: string[];
|
||||
probeUrl: string;
|
||||
probeInterval: number;
|
||||
enableConcurrency: boolean;
|
||||
}
|
||||
|
||||
function createBaseObservationResult(): ObservationResult {
|
||||
return { $type: "xray.core.app.observatory.ObservationResult", status: [] };
|
||||
}
|
||||
|
||||
export const ObservationResult: MessageFns<ObservationResult, "xray.core.app.observatory.ObservationResult"> = {
|
||||
$type: "xray.core.app.observatory.ObservationResult" as const,
|
||||
|
||||
encode(message: ObservationResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.status) {
|
||||
OutboundStatus.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ObservationResult {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseObservationResult();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.status.push(OutboundStatus.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ObservationResult {
|
||||
return {
|
||||
$type: ObservationResult.$type,
|
||||
status: globalThis.Array.isArray(object?.status) ? object.status.map((e: any) => OutboundStatus.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ObservationResult): unknown {
|
||||
const obj: any = {};
|
||||
if (message.status?.length) {
|
||||
obj.status = message.status.map((e) => OutboundStatus.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ObservationResult>): ObservationResult {
|
||||
return ObservationResult.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ObservationResult>): ObservationResult {
|
||||
const message = createBaseObservationResult();
|
||||
message.status = object.status?.map((e) => OutboundStatus.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ObservationResult.$type, ObservationResult);
|
||||
|
||||
function createBaseHealthPingMeasurementResult(): HealthPingMeasurementResult {
|
||||
return {
|
||||
$type: "xray.core.app.observatory.HealthPingMeasurementResult",
|
||||
all: 0,
|
||||
fail: 0,
|
||||
deviation: 0,
|
||||
average: 0,
|
||||
max: 0,
|
||||
min: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const HealthPingMeasurementResult: MessageFns<
|
||||
HealthPingMeasurementResult,
|
||||
"xray.core.app.observatory.HealthPingMeasurementResult"
|
||||
> = {
|
||||
$type: "xray.core.app.observatory.HealthPingMeasurementResult" as const,
|
||||
|
||||
encode(message: HealthPingMeasurementResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.all !== 0) {
|
||||
writer.uint32(8).int64(message.all);
|
||||
}
|
||||
if (message.fail !== 0) {
|
||||
writer.uint32(16).int64(message.fail);
|
||||
}
|
||||
if (message.deviation !== 0) {
|
||||
writer.uint32(24).int64(message.deviation);
|
||||
}
|
||||
if (message.average !== 0) {
|
||||
writer.uint32(32).int64(message.average);
|
||||
}
|
||||
if (message.max !== 0) {
|
||||
writer.uint32(40).int64(message.max);
|
||||
}
|
||||
if (message.min !== 0) {
|
||||
writer.uint32(48).int64(message.min);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): HealthPingMeasurementResult {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHealthPingMeasurementResult();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.all = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.fail = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.deviation = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.average = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.max = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.min = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): HealthPingMeasurementResult {
|
||||
return {
|
||||
$type: HealthPingMeasurementResult.$type,
|
||||
all: isSet(object.all) ? globalThis.Number(object.all) : 0,
|
||||
fail: isSet(object.fail) ? globalThis.Number(object.fail) : 0,
|
||||
deviation: isSet(object.deviation) ? globalThis.Number(object.deviation) : 0,
|
||||
average: isSet(object.average) ? globalThis.Number(object.average) : 0,
|
||||
max: isSet(object.max) ? globalThis.Number(object.max) : 0,
|
||||
min: isSet(object.min) ? globalThis.Number(object.min) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: HealthPingMeasurementResult): unknown {
|
||||
const obj: any = {};
|
||||
if (message.all !== 0) {
|
||||
obj.all = Math.round(message.all);
|
||||
}
|
||||
if (message.fail !== 0) {
|
||||
obj.fail = Math.round(message.fail);
|
||||
}
|
||||
if (message.deviation !== 0) {
|
||||
obj.deviation = Math.round(message.deviation);
|
||||
}
|
||||
if (message.average !== 0) {
|
||||
obj.average = Math.round(message.average);
|
||||
}
|
||||
if (message.max !== 0) {
|
||||
obj.max = Math.round(message.max);
|
||||
}
|
||||
if (message.min !== 0) {
|
||||
obj.min = Math.round(message.min);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<HealthPingMeasurementResult>): HealthPingMeasurementResult {
|
||||
return HealthPingMeasurementResult.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<HealthPingMeasurementResult>): HealthPingMeasurementResult {
|
||||
const message = createBaseHealthPingMeasurementResult();
|
||||
message.all = object.all ?? 0;
|
||||
message.fail = object.fail ?? 0;
|
||||
message.deviation = object.deviation ?? 0;
|
||||
message.average = object.average ?? 0;
|
||||
message.max = object.max ?? 0;
|
||||
message.min = object.min ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(HealthPingMeasurementResult.$type, HealthPingMeasurementResult);
|
||||
|
||||
function createBaseOutboundStatus(): OutboundStatus {
|
||||
return {
|
||||
$type: "xray.core.app.observatory.OutboundStatus",
|
||||
alive: false,
|
||||
delay: 0,
|
||||
lastErrorReason: "",
|
||||
outboundTag: "",
|
||||
lastSeenTime: 0,
|
||||
lastTryTime: 0,
|
||||
healthPing: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const OutboundStatus: MessageFns<OutboundStatus, "xray.core.app.observatory.OutboundStatus"> = {
|
||||
$type: "xray.core.app.observatory.OutboundStatus" as const,
|
||||
|
||||
encode(message: OutboundStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.alive !== false) {
|
||||
writer.uint32(8).bool(message.alive);
|
||||
}
|
||||
if (message.delay !== 0) {
|
||||
writer.uint32(16).int64(message.delay);
|
||||
}
|
||||
if (message.lastErrorReason !== "") {
|
||||
writer.uint32(26).string(message.lastErrorReason);
|
||||
}
|
||||
if (message.outboundTag !== "") {
|
||||
writer.uint32(34).string(message.outboundTag);
|
||||
}
|
||||
if (message.lastSeenTime !== 0) {
|
||||
writer.uint32(40).int64(message.lastSeenTime);
|
||||
}
|
||||
if (message.lastTryTime !== 0) {
|
||||
writer.uint32(48).int64(message.lastTryTime);
|
||||
}
|
||||
if (message.healthPing !== undefined) {
|
||||
HealthPingMeasurementResult.encode(message.healthPing, writer.uint32(58).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): OutboundStatus {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseOutboundStatus();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.alive = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.delay = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lastErrorReason = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.outboundTag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lastSeenTime = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lastTryTime = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.healthPing = HealthPingMeasurementResult.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): OutboundStatus {
|
||||
return {
|
||||
$type: OutboundStatus.$type,
|
||||
alive: isSet(object.alive) ? globalThis.Boolean(object.alive) : false,
|
||||
delay: isSet(object.delay) ? globalThis.Number(object.delay) : 0,
|
||||
lastErrorReason: isSet(object.lastErrorReason) ? globalThis.String(object.lastErrorReason) : "",
|
||||
outboundTag: isSet(object.outboundTag) ? globalThis.String(object.outboundTag) : "",
|
||||
lastSeenTime: isSet(object.lastSeenTime) ? globalThis.Number(object.lastSeenTime) : 0,
|
||||
lastTryTime: isSet(object.lastTryTime) ? globalThis.Number(object.lastTryTime) : 0,
|
||||
healthPing: isSet(object.healthPing) ? HealthPingMeasurementResult.fromJSON(object.healthPing) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: OutboundStatus): unknown {
|
||||
const obj: any = {};
|
||||
if (message.alive !== false) {
|
||||
obj.alive = message.alive;
|
||||
}
|
||||
if (message.delay !== 0) {
|
||||
obj.delay = Math.round(message.delay);
|
||||
}
|
||||
if (message.lastErrorReason !== "") {
|
||||
obj.lastErrorReason = message.lastErrorReason;
|
||||
}
|
||||
if (message.outboundTag !== "") {
|
||||
obj.outboundTag = message.outboundTag;
|
||||
}
|
||||
if (message.lastSeenTime !== 0) {
|
||||
obj.lastSeenTime = Math.round(message.lastSeenTime);
|
||||
}
|
||||
if (message.lastTryTime !== 0) {
|
||||
obj.lastTryTime = Math.round(message.lastTryTime);
|
||||
}
|
||||
if (message.healthPing !== undefined) {
|
||||
obj.healthPing = HealthPingMeasurementResult.toJSON(message.healthPing);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<OutboundStatus>): OutboundStatus {
|
||||
return OutboundStatus.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<OutboundStatus>): OutboundStatus {
|
||||
const message = createBaseOutboundStatus();
|
||||
message.alive = object.alive ?? false;
|
||||
message.delay = object.delay ?? 0;
|
||||
message.lastErrorReason = object.lastErrorReason ?? "";
|
||||
message.outboundTag = object.outboundTag ?? "";
|
||||
message.lastSeenTime = object.lastSeenTime ?? 0;
|
||||
message.lastTryTime = object.lastTryTime ?? 0;
|
||||
message.healthPing = (object.healthPing !== undefined && object.healthPing !== null)
|
||||
? HealthPingMeasurementResult.fromPartial(object.healthPing)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(OutboundStatus.$type, OutboundStatus);
|
||||
|
||||
function createBaseProbeResult(): ProbeResult {
|
||||
return { $type: "xray.core.app.observatory.ProbeResult", alive: false, delay: 0, lastErrorReason: "" };
|
||||
}
|
||||
|
||||
export const ProbeResult: MessageFns<ProbeResult, "xray.core.app.observatory.ProbeResult"> = {
|
||||
$type: "xray.core.app.observatory.ProbeResult" as const,
|
||||
|
||||
encode(message: ProbeResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.alive !== false) {
|
||||
writer.uint32(8).bool(message.alive);
|
||||
}
|
||||
if (message.delay !== 0) {
|
||||
writer.uint32(16).int64(message.delay);
|
||||
}
|
||||
if (message.lastErrorReason !== "") {
|
||||
writer.uint32(26).string(message.lastErrorReason);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ProbeResult {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseProbeResult();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.alive = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.delay = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lastErrorReason = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ProbeResult {
|
||||
return {
|
||||
$type: ProbeResult.$type,
|
||||
alive: isSet(object.alive) ? globalThis.Boolean(object.alive) : false,
|
||||
delay: isSet(object.delay) ? globalThis.Number(object.delay) : 0,
|
||||
lastErrorReason: isSet(object.lastErrorReason) ? globalThis.String(object.lastErrorReason) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ProbeResult): unknown {
|
||||
const obj: any = {};
|
||||
if (message.alive !== false) {
|
||||
obj.alive = message.alive;
|
||||
}
|
||||
if (message.delay !== 0) {
|
||||
obj.delay = Math.round(message.delay);
|
||||
}
|
||||
if (message.lastErrorReason !== "") {
|
||||
obj.lastErrorReason = message.lastErrorReason;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ProbeResult>): ProbeResult {
|
||||
return ProbeResult.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ProbeResult>): ProbeResult {
|
||||
const message = createBaseProbeResult();
|
||||
message.alive = object.alive ?? false;
|
||||
message.delay = object.delay ?? 0;
|
||||
message.lastErrorReason = object.lastErrorReason ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ProbeResult.$type, ProbeResult);
|
||||
|
||||
function createBaseIntensity(): Intensity {
|
||||
return { $type: "xray.core.app.observatory.Intensity", probeInterval: 0 };
|
||||
}
|
||||
|
||||
export const Intensity: MessageFns<Intensity, "xray.core.app.observatory.Intensity"> = {
|
||||
$type: "xray.core.app.observatory.Intensity" as const,
|
||||
|
||||
encode(message: Intensity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.probeInterval !== 0) {
|
||||
writer.uint32(8).uint32(message.probeInterval);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Intensity {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseIntensity();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.probeInterval = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Intensity {
|
||||
return {
|
||||
$type: Intensity.$type,
|
||||
probeInterval: isSet(object.probeInterval) ? globalThis.Number(object.probeInterval) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Intensity): unknown {
|
||||
const obj: any = {};
|
||||
if (message.probeInterval !== 0) {
|
||||
obj.probeInterval = Math.round(message.probeInterval);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Intensity>): Intensity {
|
||||
return Intensity.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Intensity>): Intensity {
|
||||
const message = createBaseIntensity();
|
||||
message.probeInterval = object.probeInterval ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Intensity.$type, Intensity);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.core.app.observatory.Config",
|
||||
subjectSelector: [],
|
||||
probeUrl: "",
|
||||
probeInterval: 0,
|
||||
enableConcurrency: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.core.app.observatory.Config"> = {
|
||||
$type: "xray.core.app.observatory.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.subjectSelector) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
if (message.probeUrl !== "") {
|
||||
writer.uint32(26).string(message.probeUrl);
|
||||
}
|
||||
if (message.probeInterval !== 0) {
|
||||
writer.uint32(32).int64(message.probeInterval);
|
||||
}
|
||||
if (message.enableConcurrency !== false) {
|
||||
writer.uint32(40).bool(message.enableConcurrency);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.subjectSelector.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.probeUrl = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.probeInterval = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enableConcurrency = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
subjectSelector: globalThis.Array.isArray(object?.subjectSelector)
|
||||
? object.subjectSelector.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
probeUrl: isSet(object.probeUrl) ? globalThis.String(object.probeUrl) : "",
|
||||
probeInterval: isSet(object.probeInterval) ? globalThis.Number(object.probeInterval) : 0,
|
||||
enableConcurrency: isSet(object.enableConcurrency) ? globalThis.Boolean(object.enableConcurrency) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.subjectSelector?.length) {
|
||||
obj.subjectSelector = message.subjectSelector;
|
||||
}
|
||||
if (message.probeUrl !== "") {
|
||||
obj.probeUrl = message.probeUrl;
|
||||
}
|
||||
if (message.probeInterval !== 0) {
|
||||
obj.probeInterval = Math.round(message.probeInterval);
|
||||
}
|
||||
if (message.enableConcurrency !== false) {
|
||||
obj.enableConcurrency = message.enableConcurrency;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.subjectSelector = object.subjectSelector?.map((e) => e) || [];
|
||||
message.probeUrl = object.probeUrl ?? "";
|
||||
message.probeInterval = object.probeInterval ?? 0;
|
||||
message.enableConcurrency = object.enableConcurrency ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
930
src/proto/app/policy/config.ts
Normal file
930
src/proto/app/policy/config.ts
Normal file
|
|
@ -0,0 +1,930 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/policy/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.policy";
|
||||
|
||||
export interface Second {
|
||||
$type: "xray.app.policy.Second";
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface Policy {
|
||||
$type: "xray.app.policy.Policy";
|
||||
timeout: Policy_Timeout | undefined;
|
||||
stats: Policy_Stats | undefined;
|
||||
buffer: Policy_Buffer | undefined;
|
||||
}
|
||||
|
||||
/** Timeout is a message for timeout settings in various stages, in seconds. */
|
||||
export interface Policy_Timeout {
|
||||
$type: "xray.app.policy.Policy.Timeout";
|
||||
handshake: Second | undefined;
|
||||
connectionIdle: Second | undefined;
|
||||
uplinkOnly: Second | undefined;
|
||||
downlinkOnly: Second | undefined;
|
||||
}
|
||||
|
||||
export interface Policy_Stats {
|
||||
$type: "xray.app.policy.Policy.Stats";
|
||||
userUplink: boolean;
|
||||
userDownlink: boolean;
|
||||
userOnline: boolean;
|
||||
}
|
||||
|
||||
export interface Policy_Buffer {
|
||||
$type: "xray.app.policy.Policy.Buffer";
|
||||
/** Buffer size per connection, in bytes. -1 for unlimited buffer. */
|
||||
connection: number;
|
||||
}
|
||||
|
||||
export interface SystemPolicy {
|
||||
$type: "xray.app.policy.SystemPolicy";
|
||||
stats: SystemPolicy_Stats | undefined;
|
||||
}
|
||||
|
||||
export interface SystemPolicy_Stats {
|
||||
$type: "xray.app.policy.SystemPolicy.Stats";
|
||||
inboundUplink: boolean;
|
||||
inboundDownlink: boolean;
|
||||
outboundUplink: boolean;
|
||||
outboundDownlink: boolean;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.policy.Config";
|
||||
level: { [key: number]: Policy };
|
||||
system: SystemPolicy | undefined;
|
||||
}
|
||||
|
||||
export interface Config_LevelEntry {
|
||||
$type: "xray.app.policy.Config.LevelEntry";
|
||||
key: number;
|
||||
value: Policy | undefined;
|
||||
}
|
||||
|
||||
function createBaseSecond(): Second {
|
||||
return { $type: "xray.app.policy.Second", value: 0 };
|
||||
}
|
||||
|
||||
export const Second: MessageFns<Second, "xray.app.policy.Second"> = {
|
||||
$type: "xray.app.policy.Second" as const,
|
||||
|
||||
encode(message: Second, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Second {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSecond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Second {
|
||||
return { $type: Second.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: Second): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Second>): Second {
|
||||
return Second.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Second>): Second {
|
||||
const message = createBaseSecond();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Second.$type, Second);
|
||||
|
||||
function createBasePolicy(): Policy {
|
||||
return { $type: "xray.app.policy.Policy", timeout: undefined, stats: undefined, buffer: undefined };
|
||||
}
|
||||
|
||||
export const Policy: MessageFns<Policy, "xray.app.policy.Policy"> = {
|
||||
$type: "xray.app.policy.Policy" as const,
|
||||
|
||||
encode(message: Policy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.timeout !== undefined) {
|
||||
Policy_Timeout.encode(message.timeout, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.stats !== undefined) {
|
||||
Policy_Stats.encode(message.stats, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.buffer !== undefined) {
|
||||
Policy_Buffer.encode(message.buffer, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Policy {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePolicy();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.timeout = Policy_Timeout.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.stats = Policy_Stats.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.buffer = Policy_Buffer.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Policy {
|
||||
return {
|
||||
$type: Policy.$type,
|
||||
timeout: isSet(object.timeout) ? Policy_Timeout.fromJSON(object.timeout) : undefined,
|
||||
stats: isSet(object.stats) ? Policy_Stats.fromJSON(object.stats) : undefined,
|
||||
buffer: isSet(object.buffer) ? Policy_Buffer.fromJSON(object.buffer) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Policy): unknown {
|
||||
const obj: any = {};
|
||||
if (message.timeout !== undefined) {
|
||||
obj.timeout = Policy_Timeout.toJSON(message.timeout);
|
||||
}
|
||||
if (message.stats !== undefined) {
|
||||
obj.stats = Policy_Stats.toJSON(message.stats);
|
||||
}
|
||||
if (message.buffer !== undefined) {
|
||||
obj.buffer = Policy_Buffer.toJSON(message.buffer);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Policy>): Policy {
|
||||
return Policy.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Policy>): Policy {
|
||||
const message = createBasePolicy();
|
||||
message.timeout = (object.timeout !== undefined && object.timeout !== null)
|
||||
? Policy_Timeout.fromPartial(object.timeout)
|
||||
: undefined;
|
||||
message.stats = (object.stats !== undefined && object.stats !== null)
|
||||
? Policy_Stats.fromPartial(object.stats)
|
||||
: undefined;
|
||||
message.buffer = (object.buffer !== undefined && object.buffer !== null)
|
||||
? Policy_Buffer.fromPartial(object.buffer)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Policy.$type, Policy);
|
||||
|
||||
function createBasePolicy_Timeout(): Policy_Timeout {
|
||||
return {
|
||||
$type: "xray.app.policy.Policy.Timeout",
|
||||
handshake: undefined,
|
||||
connectionIdle: undefined,
|
||||
uplinkOnly: undefined,
|
||||
downlinkOnly: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Policy_Timeout: MessageFns<Policy_Timeout, "xray.app.policy.Policy.Timeout"> = {
|
||||
$type: "xray.app.policy.Policy.Timeout" as const,
|
||||
|
||||
encode(message: Policy_Timeout, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.handshake !== undefined) {
|
||||
Second.encode(message.handshake, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.connectionIdle !== undefined) {
|
||||
Second.encode(message.connectionIdle, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.uplinkOnly !== undefined) {
|
||||
Second.encode(message.uplinkOnly, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.downlinkOnly !== undefined) {
|
||||
Second.encode(message.downlinkOnly, writer.uint32(34).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Policy_Timeout {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePolicy_Timeout();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.handshake = Second.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.connectionIdle = Second.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.uplinkOnly = Second.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.downlinkOnly = Second.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Policy_Timeout {
|
||||
return {
|
||||
$type: Policy_Timeout.$type,
|
||||
handshake: isSet(object.handshake) ? Second.fromJSON(object.handshake) : undefined,
|
||||
connectionIdle: isSet(object.connectionIdle) ? Second.fromJSON(object.connectionIdle) : undefined,
|
||||
uplinkOnly: isSet(object.uplinkOnly) ? Second.fromJSON(object.uplinkOnly) : undefined,
|
||||
downlinkOnly: isSet(object.downlinkOnly) ? Second.fromJSON(object.downlinkOnly) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Policy_Timeout): unknown {
|
||||
const obj: any = {};
|
||||
if (message.handshake !== undefined) {
|
||||
obj.handshake = Second.toJSON(message.handshake);
|
||||
}
|
||||
if (message.connectionIdle !== undefined) {
|
||||
obj.connectionIdle = Second.toJSON(message.connectionIdle);
|
||||
}
|
||||
if (message.uplinkOnly !== undefined) {
|
||||
obj.uplinkOnly = Second.toJSON(message.uplinkOnly);
|
||||
}
|
||||
if (message.downlinkOnly !== undefined) {
|
||||
obj.downlinkOnly = Second.toJSON(message.downlinkOnly);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Policy_Timeout>): Policy_Timeout {
|
||||
return Policy_Timeout.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Policy_Timeout>): Policy_Timeout {
|
||||
const message = createBasePolicy_Timeout();
|
||||
message.handshake = (object.handshake !== undefined && object.handshake !== null)
|
||||
? Second.fromPartial(object.handshake)
|
||||
: undefined;
|
||||
message.connectionIdle = (object.connectionIdle !== undefined && object.connectionIdle !== null)
|
||||
? Second.fromPartial(object.connectionIdle)
|
||||
: undefined;
|
||||
message.uplinkOnly = (object.uplinkOnly !== undefined && object.uplinkOnly !== null)
|
||||
? Second.fromPartial(object.uplinkOnly)
|
||||
: undefined;
|
||||
message.downlinkOnly = (object.downlinkOnly !== undefined && object.downlinkOnly !== null)
|
||||
? Second.fromPartial(object.downlinkOnly)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Policy_Timeout.$type, Policy_Timeout);
|
||||
|
||||
function createBasePolicy_Stats(): Policy_Stats {
|
||||
return { $type: "xray.app.policy.Policy.Stats", userUplink: false, userDownlink: false, userOnline: false };
|
||||
}
|
||||
|
||||
export const Policy_Stats: MessageFns<Policy_Stats, "xray.app.policy.Policy.Stats"> = {
|
||||
$type: "xray.app.policy.Policy.Stats" as const,
|
||||
|
||||
encode(message: Policy_Stats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.userUplink !== false) {
|
||||
writer.uint32(8).bool(message.userUplink);
|
||||
}
|
||||
if (message.userDownlink !== false) {
|
||||
writer.uint32(16).bool(message.userDownlink);
|
||||
}
|
||||
if (message.userOnline !== false) {
|
||||
writer.uint32(24).bool(message.userOnline);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Policy_Stats {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePolicy_Stats();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userUplink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userDownlink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userOnline = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Policy_Stats {
|
||||
return {
|
||||
$type: Policy_Stats.$type,
|
||||
userUplink: isSet(object.userUplink) ? globalThis.Boolean(object.userUplink) : false,
|
||||
userDownlink: isSet(object.userDownlink) ? globalThis.Boolean(object.userDownlink) : false,
|
||||
userOnline: isSet(object.userOnline) ? globalThis.Boolean(object.userOnline) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Policy_Stats): unknown {
|
||||
const obj: any = {};
|
||||
if (message.userUplink !== false) {
|
||||
obj.userUplink = message.userUplink;
|
||||
}
|
||||
if (message.userDownlink !== false) {
|
||||
obj.userDownlink = message.userDownlink;
|
||||
}
|
||||
if (message.userOnline !== false) {
|
||||
obj.userOnline = message.userOnline;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Policy_Stats>): Policy_Stats {
|
||||
return Policy_Stats.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Policy_Stats>): Policy_Stats {
|
||||
const message = createBasePolicy_Stats();
|
||||
message.userUplink = object.userUplink ?? false;
|
||||
message.userDownlink = object.userDownlink ?? false;
|
||||
message.userOnline = object.userOnline ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Policy_Stats.$type, Policy_Stats);
|
||||
|
||||
function createBasePolicy_Buffer(): Policy_Buffer {
|
||||
return { $type: "xray.app.policy.Policy.Buffer", connection: 0 };
|
||||
}
|
||||
|
||||
export const Policy_Buffer: MessageFns<Policy_Buffer, "xray.app.policy.Policy.Buffer"> = {
|
||||
$type: "xray.app.policy.Policy.Buffer" as const,
|
||||
|
||||
encode(message: Policy_Buffer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.connection !== 0) {
|
||||
writer.uint32(8).int32(message.connection);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Policy_Buffer {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePolicy_Buffer();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.connection = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Policy_Buffer {
|
||||
return {
|
||||
$type: Policy_Buffer.$type,
|
||||
connection: isSet(object.connection) ? globalThis.Number(object.connection) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Policy_Buffer): unknown {
|
||||
const obj: any = {};
|
||||
if (message.connection !== 0) {
|
||||
obj.connection = Math.round(message.connection);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Policy_Buffer>): Policy_Buffer {
|
||||
return Policy_Buffer.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Policy_Buffer>): Policy_Buffer {
|
||||
const message = createBasePolicy_Buffer();
|
||||
message.connection = object.connection ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Policy_Buffer.$type, Policy_Buffer);
|
||||
|
||||
function createBaseSystemPolicy(): SystemPolicy {
|
||||
return { $type: "xray.app.policy.SystemPolicy", stats: undefined };
|
||||
}
|
||||
|
||||
export const SystemPolicy: MessageFns<SystemPolicy, "xray.app.policy.SystemPolicy"> = {
|
||||
$type: "xray.app.policy.SystemPolicy" as const,
|
||||
|
||||
encode(message: SystemPolicy, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.stats !== undefined) {
|
||||
SystemPolicy_Stats.encode(message.stats, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SystemPolicy {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSystemPolicy();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.stats = SystemPolicy_Stats.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SystemPolicy {
|
||||
return {
|
||||
$type: SystemPolicy.$type,
|
||||
stats: isSet(object.stats) ? SystemPolicy_Stats.fromJSON(object.stats) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: SystemPolicy): unknown {
|
||||
const obj: any = {};
|
||||
if (message.stats !== undefined) {
|
||||
obj.stats = SystemPolicy_Stats.toJSON(message.stats);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SystemPolicy>): SystemPolicy {
|
||||
return SystemPolicy.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SystemPolicy>): SystemPolicy {
|
||||
const message = createBaseSystemPolicy();
|
||||
message.stats = (object.stats !== undefined && object.stats !== null)
|
||||
? SystemPolicy_Stats.fromPartial(object.stats)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SystemPolicy.$type, SystemPolicy);
|
||||
|
||||
function createBaseSystemPolicy_Stats(): SystemPolicy_Stats {
|
||||
return {
|
||||
$type: "xray.app.policy.SystemPolicy.Stats",
|
||||
inboundUplink: false,
|
||||
inboundDownlink: false,
|
||||
outboundUplink: false,
|
||||
outboundDownlink: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const SystemPolicy_Stats: MessageFns<SystemPolicy_Stats, "xray.app.policy.SystemPolicy.Stats"> = {
|
||||
$type: "xray.app.policy.SystemPolicy.Stats" as const,
|
||||
|
||||
encode(message: SystemPolicy_Stats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.inboundUplink !== false) {
|
||||
writer.uint32(8).bool(message.inboundUplink);
|
||||
}
|
||||
if (message.inboundDownlink !== false) {
|
||||
writer.uint32(16).bool(message.inboundDownlink);
|
||||
}
|
||||
if (message.outboundUplink !== false) {
|
||||
writer.uint32(24).bool(message.outboundUplink);
|
||||
}
|
||||
if (message.outboundDownlink !== false) {
|
||||
writer.uint32(32).bool(message.outboundDownlink);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SystemPolicy_Stats {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSystemPolicy_Stats();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.inboundUplink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.inboundDownlink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.outboundUplink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.outboundDownlink = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SystemPolicy_Stats {
|
||||
return {
|
||||
$type: SystemPolicy_Stats.$type,
|
||||
inboundUplink: isSet(object.inboundUplink) ? globalThis.Boolean(object.inboundUplink) : false,
|
||||
inboundDownlink: isSet(object.inboundDownlink) ? globalThis.Boolean(object.inboundDownlink) : false,
|
||||
outboundUplink: isSet(object.outboundUplink) ? globalThis.Boolean(object.outboundUplink) : false,
|
||||
outboundDownlink: isSet(object.outboundDownlink) ? globalThis.Boolean(object.outboundDownlink) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: SystemPolicy_Stats): unknown {
|
||||
const obj: any = {};
|
||||
if (message.inboundUplink !== false) {
|
||||
obj.inboundUplink = message.inboundUplink;
|
||||
}
|
||||
if (message.inboundDownlink !== false) {
|
||||
obj.inboundDownlink = message.inboundDownlink;
|
||||
}
|
||||
if (message.outboundUplink !== false) {
|
||||
obj.outboundUplink = message.outboundUplink;
|
||||
}
|
||||
if (message.outboundDownlink !== false) {
|
||||
obj.outboundDownlink = message.outboundDownlink;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SystemPolicy_Stats>): SystemPolicy_Stats {
|
||||
return SystemPolicy_Stats.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SystemPolicy_Stats>): SystemPolicy_Stats {
|
||||
const message = createBaseSystemPolicy_Stats();
|
||||
message.inboundUplink = object.inboundUplink ?? false;
|
||||
message.inboundDownlink = object.inboundDownlink ?? false;
|
||||
message.outboundUplink = object.outboundUplink ?? false;
|
||||
message.outboundDownlink = object.outboundDownlink ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SystemPolicy_Stats.$type, SystemPolicy_Stats);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.policy.Config", level: {}, system: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.policy.Config"> = {
|
||||
$type: "xray.app.policy.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
globalThis.Object.entries(message.level).forEach(([key, value]: [string, Policy]) => {
|
||||
Config_LevelEntry.encode(
|
||||
{ $type: "xray.app.policy.Config.LevelEntry", key: key as any, value },
|
||||
writer.uint32(10).fork(),
|
||||
).join();
|
||||
});
|
||||
if (message.system !== undefined) {
|
||||
SystemPolicy.encode(message.system, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry1 = Config_LevelEntry.decode(reader, reader.uint32());
|
||||
if (entry1.value !== undefined) {
|
||||
message.level[entry1.key] = entry1.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.system = SystemPolicy.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
level: isObject(object.level)
|
||||
? (globalThis.Object.entries(object.level) as [string, any][]).reduce(
|
||||
(acc: { [key: number]: Policy }, [key, value]: [string, any]) => {
|
||||
acc[globalThis.Number(key)] = Policy.fromJSON(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
system: isSet(object.system) ? SystemPolicy.fromJSON(object.system) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.level) {
|
||||
const entries = globalThis.Object.entries(message.level) as [string, Policy][];
|
||||
if (entries.length > 0) {
|
||||
obj.level = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.level[k] = Policy.toJSON(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.system !== undefined) {
|
||||
obj.system = SystemPolicy.toJSON(message.system);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.level = (globalThis.Object.entries(object.level ?? {}) as [string, Policy][]).reduce(
|
||||
(acc: { [key: number]: Policy }, [key, value]: [string, Policy]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = Policy.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.system = (object.system !== undefined && object.system !== null)
|
||||
? SystemPolicy.fromPartial(object.system)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConfig_LevelEntry(): Config_LevelEntry {
|
||||
return { $type: "xray.app.policy.Config.LevelEntry", key: 0, value: undefined };
|
||||
}
|
||||
|
||||
export const Config_LevelEntry: MessageFns<Config_LevelEntry, "xray.app.policy.Config.LevelEntry"> = {
|
||||
$type: "xray.app.policy.Config.LevelEntry" as const,
|
||||
|
||||
encode(message: Config_LevelEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== 0) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
Policy.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config_LevelEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig_LevelEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = Policy.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config_LevelEntry {
|
||||
return {
|
||||
$type: Config_LevelEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.Number(object.key) : 0,
|
||||
value: isSet(object.value) ? Policy.fromJSON(object.value) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config_LevelEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== 0) {
|
||||
obj.key = Math.round(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = Policy.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config_LevelEntry>): Config_LevelEntry {
|
||||
return Config_LevelEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config_LevelEntry>): Config_LevelEntry {
|
||||
const message = createBaseConfig_LevelEntry();
|
||||
message.key = object.key ?? 0;
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
? Policy.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config_LevelEntry.$type, Config_LevelEntry);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
1647
src/proto/app/proxyman/command/command.ts
Normal file
1647
src/proto/app/proxyman/command/command.ts
Normal file
File diff suppressed because it is too large
Load diff
879
src/proto/app/proxyman/config.ts
Normal file
879
src/proto/app/proxyman/config.ts
Normal file
|
|
@ -0,0 +1,879 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/proxyman/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { IPOrDomain } from "../../common/net/address";
|
||||
import { PortList } from "../../common/net/port";
|
||||
import { TypedMessage } from "../../common/serial/typed_message";
|
||||
import {
|
||||
DomainStrategy,
|
||||
domainStrategyFromJSON,
|
||||
domainStrategyToJSON,
|
||||
ProxyConfig,
|
||||
StreamConfig,
|
||||
} from "../../transport/internet/config";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.proxyman";
|
||||
|
||||
export interface InboundConfig {
|
||||
$type: "xray.app.proxyman.InboundConfig";
|
||||
}
|
||||
|
||||
export interface SniffingConfig {
|
||||
$type: "xray.app.proxyman.SniffingConfig";
|
||||
/** Whether or not to enable content sniffing on an inbound connection. */
|
||||
enabled: boolean;
|
||||
/**
|
||||
* Override target destination if sniff'ed protocol is in the given list.
|
||||
* Supported values are "http", "tls", "fakedns".
|
||||
*/
|
||||
destinationOverride: string[];
|
||||
domainsExcluded: string[];
|
||||
/**
|
||||
* Whether should only try to sniff metadata without waiting for client input.
|
||||
* Can be used to support SMTP like protocol where server send the first
|
||||
* message.
|
||||
*/
|
||||
metadataOnly: boolean;
|
||||
routeOnly: boolean;
|
||||
}
|
||||
|
||||
export interface ReceiverConfig {
|
||||
$type: "xray.app.proxyman.ReceiverConfig";
|
||||
/** PortList specifies the ports which the Receiver should listen on. */
|
||||
portList:
|
||||
| PortList
|
||||
| undefined;
|
||||
/** Listen specifies the IP address that the Receiver should listen on. */
|
||||
listen: IPOrDomain | undefined;
|
||||
streamSettings: StreamConfig | undefined;
|
||||
receiveOriginalDestination: boolean;
|
||||
sniffingSettings: SniffingConfig | undefined;
|
||||
}
|
||||
|
||||
export interface InboundHandlerConfig {
|
||||
$type: "xray.app.proxyman.InboundHandlerConfig";
|
||||
tag: string;
|
||||
receiverSettings: TypedMessage | undefined;
|
||||
proxySettings: TypedMessage | undefined;
|
||||
}
|
||||
|
||||
export interface OutboundConfig {
|
||||
$type: "xray.app.proxyman.OutboundConfig";
|
||||
}
|
||||
|
||||
export interface SenderConfig {
|
||||
$type: "xray.app.proxyman.SenderConfig";
|
||||
/** Send traffic through the given IP. Only IP is allowed. */
|
||||
via: IPOrDomain | undefined;
|
||||
streamSettings: StreamConfig | undefined;
|
||||
proxySettings: ProxyConfig | undefined;
|
||||
multiplexSettings: MultiplexingConfig | undefined;
|
||||
viaCidr: string;
|
||||
targetStrategy: DomainStrategy;
|
||||
}
|
||||
|
||||
export interface MultiplexingConfig {
|
||||
$type: "xray.app.proxyman.MultiplexingConfig";
|
||||
/** Whether or not Mux is enabled. */
|
||||
enabled: boolean;
|
||||
/** Max number of concurrent connections that one Mux connection can handle. */
|
||||
concurrency: number;
|
||||
/** Transport XUDP in another Mux. */
|
||||
xudpConcurrency: number;
|
||||
/** "reject" (default), "allow" or "skip". */
|
||||
xudpProxyUDP443: string;
|
||||
}
|
||||
|
||||
function createBaseInboundConfig(): InboundConfig {
|
||||
return { $type: "xray.app.proxyman.InboundConfig" };
|
||||
}
|
||||
|
||||
export const InboundConfig: MessageFns<InboundConfig, "xray.app.proxyman.InboundConfig"> = {
|
||||
$type: "xray.app.proxyman.InboundConfig" as const,
|
||||
|
||||
encode(_: InboundConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): InboundConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInboundConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): InboundConfig {
|
||||
return { $type: InboundConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: InboundConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<InboundConfig>): InboundConfig {
|
||||
return InboundConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<InboundConfig>): InboundConfig {
|
||||
const message = createBaseInboundConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(InboundConfig.$type, InboundConfig);
|
||||
|
||||
function createBaseSniffingConfig(): SniffingConfig {
|
||||
return {
|
||||
$type: "xray.app.proxyman.SniffingConfig",
|
||||
enabled: false,
|
||||
destinationOverride: [],
|
||||
domainsExcluded: [],
|
||||
metadataOnly: false,
|
||||
routeOnly: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const SniffingConfig: MessageFns<SniffingConfig, "xray.app.proxyman.SniffingConfig"> = {
|
||||
$type: "xray.app.proxyman.SniffingConfig" as const,
|
||||
|
||||
encode(message: SniffingConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.enabled !== false) {
|
||||
writer.uint32(8).bool(message.enabled);
|
||||
}
|
||||
for (const v of message.destinationOverride) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
for (const v of message.domainsExcluded) {
|
||||
writer.uint32(26).string(v!);
|
||||
}
|
||||
if (message.metadataOnly !== false) {
|
||||
writer.uint32(32).bool(message.metadataOnly);
|
||||
}
|
||||
if (message.routeOnly !== false) {
|
||||
writer.uint32(40).bool(message.routeOnly);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SniffingConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSniffingConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enabled = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.destinationOverride.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domainsExcluded.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.metadataOnly = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.routeOnly = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SniffingConfig {
|
||||
return {
|
||||
$type: SniffingConfig.$type,
|
||||
enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
|
||||
destinationOverride: globalThis.Array.isArray(object?.destinationOverride)
|
||||
? object.destinationOverride.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
domainsExcluded: globalThis.Array.isArray(object?.domainsExcluded)
|
||||
? object.domainsExcluded.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
metadataOnly: isSet(object.metadataOnly) ? globalThis.Boolean(object.metadataOnly) : false,
|
||||
routeOnly: isSet(object.routeOnly) ? globalThis.Boolean(object.routeOnly) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: SniffingConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.enabled !== false) {
|
||||
obj.enabled = message.enabled;
|
||||
}
|
||||
if (message.destinationOverride?.length) {
|
||||
obj.destinationOverride = message.destinationOverride;
|
||||
}
|
||||
if (message.domainsExcluded?.length) {
|
||||
obj.domainsExcluded = message.domainsExcluded;
|
||||
}
|
||||
if (message.metadataOnly !== false) {
|
||||
obj.metadataOnly = message.metadataOnly;
|
||||
}
|
||||
if (message.routeOnly !== false) {
|
||||
obj.routeOnly = message.routeOnly;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SniffingConfig>): SniffingConfig {
|
||||
return SniffingConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SniffingConfig>): SniffingConfig {
|
||||
const message = createBaseSniffingConfig();
|
||||
message.enabled = object.enabled ?? false;
|
||||
message.destinationOverride = object.destinationOverride?.map((e) => e) || [];
|
||||
message.domainsExcluded = object.domainsExcluded?.map((e) => e) || [];
|
||||
message.metadataOnly = object.metadataOnly ?? false;
|
||||
message.routeOnly = object.routeOnly ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SniffingConfig.$type, SniffingConfig);
|
||||
|
||||
function createBaseReceiverConfig(): ReceiverConfig {
|
||||
return {
|
||||
$type: "xray.app.proxyman.ReceiverConfig",
|
||||
portList: undefined,
|
||||
listen: undefined,
|
||||
streamSettings: undefined,
|
||||
receiveOriginalDestination: false,
|
||||
sniffingSettings: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const ReceiverConfig: MessageFns<ReceiverConfig, "xray.app.proxyman.ReceiverConfig"> = {
|
||||
$type: "xray.app.proxyman.ReceiverConfig" as const,
|
||||
|
||||
encode(message: ReceiverConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.portList !== undefined) {
|
||||
PortList.encode(message.portList, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.listen !== undefined) {
|
||||
IPOrDomain.encode(message.listen, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.streamSettings !== undefined) {
|
||||
StreamConfig.encode(message.streamSettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.receiveOriginalDestination !== false) {
|
||||
writer.uint32(32).bool(message.receiveOriginalDestination);
|
||||
}
|
||||
if (message.sniffingSettings !== undefined) {
|
||||
SniffingConfig.encode(message.sniffingSettings, writer.uint32(50).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ReceiverConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseReceiverConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.portList = PortList.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.listen = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.streamSettings = StreamConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.receiveOriginalDestination = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.sniffingSettings = SniffingConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ReceiverConfig {
|
||||
return {
|
||||
$type: ReceiverConfig.$type,
|
||||
portList: isSet(object.portList) ? PortList.fromJSON(object.portList) : undefined,
|
||||
listen: isSet(object.listen) ? IPOrDomain.fromJSON(object.listen) : undefined,
|
||||
streamSettings: isSet(object.streamSettings) ? StreamConfig.fromJSON(object.streamSettings) : undefined,
|
||||
receiveOriginalDestination: isSet(object.receiveOriginalDestination)
|
||||
? globalThis.Boolean(object.receiveOriginalDestination)
|
||||
: false,
|
||||
sniffingSettings: isSet(object.sniffingSettings) ? SniffingConfig.fromJSON(object.sniffingSettings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ReceiverConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.portList !== undefined) {
|
||||
obj.portList = PortList.toJSON(message.portList);
|
||||
}
|
||||
if (message.listen !== undefined) {
|
||||
obj.listen = IPOrDomain.toJSON(message.listen);
|
||||
}
|
||||
if (message.streamSettings !== undefined) {
|
||||
obj.streamSettings = StreamConfig.toJSON(message.streamSettings);
|
||||
}
|
||||
if (message.receiveOriginalDestination !== false) {
|
||||
obj.receiveOriginalDestination = message.receiveOriginalDestination;
|
||||
}
|
||||
if (message.sniffingSettings !== undefined) {
|
||||
obj.sniffingSettings = SniffingConfig.toJSON(message.sniffingSettings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ReceiverConfig>): ReceiverConfig {
|
||||
return ReceiverConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ReceiverConfig>): ReceiverConfig {
|
||||
const message = createBaseReceiverConfig();
|
||||
message.portList = (object.portList !== undefined && object.portList !== null)
|
||||
? PortList.fromPartial(object.portList)
|
||||
: undefined;
|
||||
message.listen = (object.listen !== undefined && object.listen !== null)
|
||||
? IPOrDomain.fromPartial(object.listen)
|
||||
: undefined;
|
||||
message.streamSettings = (object.streamSettings !== undefined && object.streamSettings !== null)
|
||||
? StreamConfig.fromPartial(object.streamSettings)
|
||||
: undefined;
|
||||
message.receiveOriginalDestination = object.receiveOriginalDestination ?? false;
|
||||
message.sniffingSettings = (object.sniffingSettings !== undefined && object.sniffingSettings !== null)
|
||||
? SniffingConfig.fromPartial(object.sniffingSettings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ReceiverConfig.$type, ReceiverConfig);
|
||||
|
||||
function createBaseInboundHandlerConfig(): InboundHandlerConfig {
|
||||
return {
|
||||
$type: "xray.app.proxyman.InboundHandlerConfig",
|
||||
tag: "",
|
||||
receiverSettings: undefined,
|
||||
proxySettings: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const InboundHandlerConfig: MessageFns<InboundHandlerConfig, "xray.app.proxyman.InboundHandlerConfig"> = {
|
||||
$type: "xray.app.proxyman.InboundHandlerConfig" as const,
|
||||
|
||||
encode(message: InboundHandlerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.receiverSettings !== undefined) {
|
||||
TypedMessage.encode(message.receiverSettings, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
TypedMessage.encode(message.proxySettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): InboundHandlerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInboundHandlerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.receiverSettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.proxySettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): InboundHandlerConfig {
|
||||
return {
|
||||
$type: InboundHandlerConfig.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
receiverSettings: isSet(object.receiverSettings) ? TypedMessage.fromJSON(object.receiverSettings) : undefined,
|
||||
proxySettings: isSet(object.proxySettings) ? TypedMessage.fromJSON(object.proxySettings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: InboundHandlerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.receiverSettings !== undefined) {
|
||||
obj.receiverSettings = TypedMessage.toJSON(message.receiverSettings);
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
obj.proxySettings = TypedMessage.toJSON(message.proxySettings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<InboundHandlerConfig>): InboundHandlerConfig {
|
||||
return InboundHandlerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<InboundHandlerConfig>): InboundHandlerConfig {
|
||||
const message = createBaseInboundHandlerConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.receiverSettings = (object.receiverSettings !== undefined && object.receiverSettings !== null)
|
||||
? TypedMessage.fromPartial(object.receiverSettings)
|
||||
: undefined;
|
||||
message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null)
|
||||
? TypedMessage.fromPartial(object.proxySettings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(InboundHandlerConfig.$type, InboundHandlerConfig);
|
||||
|
||||
function createBaseOutboundConfig(): OutboundConfig {
|
||||
return { $type: "xray.app.proxyman.OutboundConfig" };
|
||||
}
|
||||
|
||||
export const OutboundConfig: MessageFns<OutboundConfig, "xray.app.proxyman.OutboundConfig"> = {
|
||||
$type: "xray.app.proxyman.OutboundConfig" as const,
|
||||
|
||||
encode(_: OutboundConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): OutboundConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseOutboundConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): OutboundConfig {
|
||||
return { $type: OutboundConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: OutboundConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<OutboundConfig>): OutboundConfig {
|
||||
return OutboundConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<OutboundConfig>): OutboundConfig {
|
||||
const message = createBaseOutboundConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(OutboundConfig.$type, OutboundConfig);
|
||||
|
||||
function createBaseSenderConfig(): SenderConfig {
|
||||
return {
|
||||
$type: "xray.app.proxyman.SenderConfig",
|
||||
via: undefined,
|
||||
streamSettings: undefined,
|
||||
proxySettings: undefined,
|
||||
multiplexSettings: undefined,
|
||||
viaCidr: "",
|
||||
targetStrategy: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const SenderConfig: MessageFns<SenderConfig, "xray.app.proxyman.SenderConfig"> = {
|
||||
$type: "xray.app.proxyman.SenderConfig" as const,
|
||||
|
||||
encode(message: SenderConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.via !== undefined) {
|
||||
IPOrDomain.encode(message.via, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.streamSettings !== undefined) {
|
||||
StreamConfig.encode(message.streamSettings, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
ProxyConfig.encode(message.proxySettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.multiplexSettings !== undefined) {
|
||||
MultiplexingConfig.encode(message.multiplexSettings, writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.viaCidr !== "") {
|
||||
writer.uint32(42).string(message.viaCidr);
|
||||
}
|
||||
if (message.targetStrategy !== 0) {
|
||||
writer.uint32(48).int32(message.targetStrategy);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SenderConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSenderConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.via = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.streamSettings = StreamConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.proxySettings = ProxyConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.multiplexSettings = MultiplexingConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.viaCidr = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.targetStrategy = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SenderConfig {
|
||||
return {
|
||||
$type: SenderConfig.$type,
|
||||
via: isSet(object.via) ? IPOrDomain.fromJSON(object.via) : undefined,
|
||||
streamSettings: isSet(object.streamSettings) ? StreamConfig.fromJSON(object.streamSettings) : undefined,
|
||||
proxySettings: isSet(object.proxySettings) ? ProxyConfig.fromJSON(object.proxySettings) : undefined,
|
||||
multiplexSettings: isSet(object.multiplexSettings)
|
||||
? MultiplexingConfig.fromJSON(object.multiplexSettings)
|
||||
: undefined,
|
||||
viaCidr: isSet(object.viaCidr) ? globalThis.String(object.viaCidr) : "",
|
||||
targetStrategy: isSet(object.targetStrategy) ? domainStrategyFromJSON(object.targetStrategy) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: SenderConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.via !== undefined) {
|
||||
obj.via = IPOrDomain.toJSON(message.via);
|
||||
}
|
||||
if (message.streamSettings !== undefined) {
|
||||
obj.streamSettings = StreamConfig.toJSON(message.streamSettings);
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
obj.proxySettings = ProxyConfig.toJSON(message.proxySettings);
|
||||
}
|
||||
if (message.multiplexSettings !== undefined) {
|
||||
obj.multiplexSettings = MultiplexingConfig.toJSON(message.multiplexSettings);
|
||||
}
|
||||
if (message.viaCidr !== "") {
|
||||
obj.viaCidr = message.viaCidr;
|
||||
}
|
||||
if (message.targetStrategy !== 0) {
|
||||
obj.targetStrategy = domainStrategyToJSON(message.targetStrategy);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SenderConfig>): SenderConfig {
|
||||
return SenderConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SenderConfig>): SenderConfig {
|
||||
const message = createBaseSenderConfig();
|
||||
message.via = (object.via !== undefined && object.via !== null) ? IPOrDomain.fromPartial(object.via) : undefined;
|
||||
message.streamSettings = (object.streamSettings !== undefined && object.streamSettings !== null)
|
||||
? StreamConfig.fromPartial(object.streamSettings)
|
||||
: undefined;
|
||||
message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null)
|
||||
? ProxyConfig.fromPartial(object.proxySettings)
|
||||
: undefined;
|
||||
message.multiplexSettings = (object.multiplexSettings !== undefined && object.multiplexSettings !== null)
|
||||
? MultiplexingConfig.fromPartial(object.multiplexSettings)
|
||||
: undefined;
|
||||
message.viaCidr = object.viaCidr ?? "";
|
||||
message.targetStrategy = object.targetStrategy ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SenderConfig.$type, SenderConfig);
|
||||
|
||||
function createBaseMultiplexingConfig(): MultiplexingConfig {
|
||||
return {
|
||||
$type: "xray.app.proxyman.MultiplexingConfig",
|
||||
enabled: false,
|
||||
concurrency: 0,
|
||||
xudpConcurrency: 0,
|
||||
xudpProxyUDP443: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const MultiplexingConfig: MessageFns<MultiplexingConfig, "xray.app.proxyman.MultiplexingConfig"> = {
|
||||
$type: "xray.app.proxyman.MultiplexingConfig" as const,
|
||||
|
||||
encode(message: MultiplexingConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.enabled !== false) {
|
||||
writer.uint32(8).bool(message.enabled);
|
||||
}
|
||||
if (message.concurrency !== 0) {
|
||||
writer.uint32(16).int32(message.concurrency);
|
||||
}
|
||||
if (message.xudpConcurrency !== 0) {
|
||||
writer.uint32(24).int32(message.xudpConcurrency);
|
||||
}
|
||||
if (message.xudpProxyUDP443 !== "") {
|
||||
writer.uint32(34).string(message.xudpProxyUDP443);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): MultiplexingConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMultiplexingConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enabled = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.concurrency = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xudpConcurrency = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xudpProxyUDP443 = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MultiplexingConfig {
|
||||
return {
|
||||
$type: MultiplexingConfig.$type,
|
||||
enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
|
||||
concurrency: isSet(object.concurrency) ? globalThis.Number(object.concurrency) : 0,
|
||||
xudpConcurrency: isSet(object.xudpConcurrency) ? globalThis.Number(object.xudpConcurrency) : 0,
|
||||
xudpProxyUDP443: isSet(object.xudpProxyUDP443) ? globalThis.String(object.xudpProxyUDP443) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MultiplexingConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.enabled !== false) {
|
||||
obj.enabled = message.enabled;
|
||||
}
|
||||
if (message.concurrency !== 0) {
|
||||
obj.concurrency = Math.round(message.concurrency);
|
||||
}
|
||||
if (message.xudpConcurrency !== 0) {
|
||||
obj.xudpConcurrency = Math.round(message.xudpConcurrency);
|
||||
}
|
||||
if (message.xudpProxyUDP443 !== "") {
|
||||
obj.xudpProxyUDP443 = message.xudpProxyUDP443;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<MultiplexingConfig>): MultiplexingConfig {
|
||||
return MultiplexingConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<MultiplexingConfig>): MultiplexingConfig {
|
||||
const message = createBaseMultiplexingConfig();
|
||||
message.enabled = object.enabled ?? false;
|
||||
message.concurrency = object.concurrency ?? 0;
|
||||
message.xudpConcurrency = object.xudpConcurrency ?? 0;
|
||||
message.xudpProxyUDP443 = object.xudpProxyUDP443 ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(MultiplexingConfig.$type, MultiplexingConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
443
src/proto/app/reverse/config.ts
Normal file
443
src/proto/app/reverse/config.ts
Normal file
|
|
@ -0,0 +1,443 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/reverse/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.reverse";
|
||||
|
||||
export interface Control {
|
||||
$type: "xray.app.reverse.Control";
|
||||
state: Control_State;
|
||||
random: Uint8Array;
|
||||
}
|
||||
|
||||
export enum Control_State {
|
||||
ACTIVE = 0,
|
||||
DRAIN = 1,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function control_StateFromJSON(object: any): Control_State {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "ACTIVE":
|
||||
return Control_State.ACTIVE;
|
||||
case 1:
|
||||
case "DRAIN":
|
||||
return Control_State.DRAIN;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Control_State.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function control_StateToJSON(object: Control_State): string {
|
||||
switch (object) {
|
||||
case Control_State.ACTIVE:
|
||||
return "ACTIVE";
|
||||
case Control_State.DRAIN:
|
||||
return "DRAIN";
|
||||
case Control_State.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
export interface BridgeConfig {
|
||||
$type: "xray.app.reverse.BridgeConfig";
|
||||
tag: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface PortalConfig {
|
||||
$type: "xray.app.reverse.PortalConfig";
|
||||
tag: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.reverse.Config";
|
||||
bridgeConfig: BridgeConfig[];
|
||||
portalConfig: PortalConfig[];
|
||||
}
|
||||
|
||||
function createBaseControl(): Control {
|
||||
return { $type: "xray.app.reverse.Control", state: 0, random: new Uint8Array(0) };
|
||||
}
|
||||
|
||||
export const Control: MessageFns<Control, "xray.app.reverse.Control"> = {
|
||||
$type: "xray.app.reverse.Control" as const,
|
||||
|
||||
encode(message: Control, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.state !== 0) {
|
||||
writer.uint32(8).int32(message.state);
|
||||
}
|
||||
if (message.random.length !== 0) {
|
||||
writer.uint32(794).bytes(message.random);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Control {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseControl();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.state = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 99: {
|
||||
if (tag !== 794) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.random = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Control {
|
||||
return {
|
||||
$type: Control.$type,
|
||||
state: isSet(object.state) ? control_StateFromJSON(object.state) : 0,
|
||||
random: isSet(object.random) ? bytesFromBase64(object.random) : new Uint8Array(0),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Control): unknown {
|
||||
const obj: any = {};
|
||||
if (message.state !== 0) {
|
||||
obj.state = control_StateToJSON(message.state);
|
||||
}
|
||||
if (message.random.length !== 0) {
|
||||
obj.random = base64FromBytes(message.random);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Control>): Control {
|
||||
return Control.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Control>): Control {
|
||||
const message = createBaseControl();
|
||||
message.state = object.state ?? 0;
|
||||
message.random = object.random ?? new Uint8Array(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Control.$type, Control);
|
||||
|
||||
function createBaseBridgeConfig(): BridgeConfig {
|
||||
return { $type: "xray.app.reverse.BridgeConfig", tag: "", domain: "" };
|
||||
}
|
||||
|
||||
export const BridgeConfig: MessageFns<BridgeConfig, "xray.app.reverse.BridgeConfig"> = {
|
||||
$type: "xray.app.reverse.BridgeConfig" as const,
|
||||
|
||||
encode(message: BridgeConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.domain !== "") {
|
||||
writer.uint32(18).string(message.domain);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): BridgeConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseBridgeConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domain = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): BridgeConfig {
|
||||
return {
|
||||
$type: BridgeConfig.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
domain: isSet(object.domain) ? globalThis.String(object.domain) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: BridgeConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.domain !== "") {
|
||||
obj.domain = message.domain;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<BridgeConfig>): BridgeConfig {
|
||||
return BridgeConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<BridgeConfig>): BridgeConfig {
|
||||
const message = createBaseBridgeConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.domain = object.domain ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(BridgeConfig.$type, BridgeConfig);
|
||||
|
||||
function createBasePortalConfig(): PortalConfig {
|
||||
return { $type: "xray.app.reverse.PortalConfig", tag: "", domain: "" };
|
||||
}
|
||||
|
||||
export const PortalConfig: MessageFns<PortalConfig, "xray.app.reverse.PortalConfig"> = {
|
||||
$type: "xray.app.reverse.PortalConfig" as const,
|
||||
|
||||
encode(message: PortalConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.domain !== "") {
|
||||
writer.uint32(18).string(message.domain);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PortalConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePortalConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domain = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PortalConfig {
|
||||
return {
|
||||
$type: PortalConfig.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
domain: isSet(object.domain) ? globalThis.String(object.domain) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PortalConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.domain !== "") {
|
||||
obj.domain = message.domain;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PortalConfig>): PortalConfig {
|
||||
return PortalConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<PortalConfig>): PortalConfig {
|
||||
const message = createBasePortalConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.domain = object.domain ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(PortalConfig.$type, PortalConfig);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.reverse.Config", bridgeConfig: [], portalConfig: [] };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.reverse.Config"> = {
|
||||
$type: "xray.app.reverse.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.bridgeConfig) {
|
||||
BridgeConfig.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
for (const v of message.portalConfig) {
|
||||
PortalConfig.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.bridgeConfig.push(BridgeConfig.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.portalConfig.push(PortalConfig.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
bridgeConfig: globalThis.Array.isArray(object?.bridgeConfig)
|
||||
? object.bridgeConfig.map((e: any) => BridgeConfig.fromJSON(e))
|
||||
: [],
|
||||
portalConfig: globalThis.Array.isArray(object?.portalConfig)
|
||||
? object.portalConfig.map((e: any) => PortalConfig.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.bridgeConfig?.length) {
|
||||
obj.bridgeConfig = message.bridgeConfig.map((e) => BridgeConfig.toJSON(e));
|
||||
}
|
||||
if (message.portalConfig?.length) {
|
||||
obj.portalConfig = message.portalConfig.map((e) => PortalConfig.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.bridgeConfig = object.bridgeConfig?.map((e) => BridgeConfig.fromPartial(e)) || [];
|
||||
message.portalConfig = object.portalConfig?.map((e) => PortalConfig.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
1662
src/proto/app/router/command/command.ts
Normal file
1662
src/proto/app/router/command/command.ts
Normal file
File diff suppressed because it is too large
Load diff
1836
src/proto/app/router/config.ts
Normal file
1836
src/proto/app/router/config.ts
Normal file
File diff suppressed because it is too large
Load diff
1060
src/proto/app/stats/command/command.ts
Normal file
1060
src/proto/app/stats/command/command.ts
Normal file
File diff suppressed because it is too large
Load diff
188
src/proto/app/stats/config.ts
Normal file
188
src/proto/app/stats/config.ts
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/stats/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.stats";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.stats.Config";
|
||||
}
|
||||
|
||||
export interface ChannelConfig {
|
||||
$type: "xray.app.stats.ChannelConfig";
|
||||
Blocking: boolean;
|
||||
SubscriberLimit: number;
|
||||
BufferSize: number;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.stats.Config" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.stats.Config"> = {
|
||||
$type: "xray.app.stats.Config" as const,
|
||||
|
||||
encode(_: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Config {
|
||||
return { $type: Config.$type };
|
||||
},
|
||||
|
||||
toJSON(_: Config): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseChannelConfig(): ChannelConfig {
|
||||
return { $type: "xray.app.stats.ChannelConfig", Blocking: false, SubscriberLimit: 0, BufferSize: 0 };
|
||||
}
|
||||
|
||||
export const ChannelConfig: MessageFns<ChannelConfig, "xray.app.stats.ChannelConfig"> = {
|
||||
$type: "xray.app.stats.ChannelConfig" as const,
|
||||
|
||||
encode(message: ChannelConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.Blocking !== false) {
|
||||
writer.uint32(8).bool(message.Blocking);
|
||||
}
|
||||
if (message.SubscriberLimit !== 0) {
|
||||
writer.uint32(16).int32(message.SubscriberLimit);
|
||||
}
|
||||
if (message.BufferSize !== 0) {
|
||||
writer.uint32(24).int32(message.BufferSize);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ChannelConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseChannelConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.Blocking = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.SubscriberLimit = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.BufferSize = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ChannelConfig {
|
||||
return {
|
||||
$type: ChannelConfig.$type,
|
||||
Blocking: isSet(object.Blocking) ? globalThis.Boolean(object.Blocking) : false,
|
||||
SubscriberLimit: isSet(object.SubscriberLimit) ? globalThis.Number(object.SubscriberLimit) : 0,
|
||||
BufferSize: isSet(object.BufferSize) ? globalThis.Number(object.BufferSize) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ChannelConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.Blocking !== false) {
|
||||
obj.Blocking = message.Blocking;
|
||||
}
|
||||
if (message.SubscriberLimit !== 0) {
|
||||
obj.SubscriberLimit = Math.round(message.SubscriberLimit);
|
||||
}
|
||||
if (message.BufferSize !== 0) {
|
||||
obj.BufferSize = Math.round(message.BufferSize);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ChannelConfig>): ChannelConfig {
|
||||
return ChannelConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ChannelConfig>): ChannelConfig {
|
||||
const message = createBaseChannelConfig();
|
||||
message.Blocking = object.Blocking ?? false;
|
||||
message.SubscriberLimit = object.SubscriberLimit ?? 0;
|
||||
message.BufferSize = object.BufferSize ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ChannelConfig.$type, ChannelConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
137
src/proto/app/version/config.ts
Normal file
137
src/proto/app/version/config.ts
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: app/version/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.app.version";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.app.version.Config";
|
||||
coreVersion: string;
|
||||
minVersion: string;
|
||||
maxVersion: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.app.version.Config", coreVersion: "", minVersion: "", maxVersion: "" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.app.version.Config"> = {
|
||||
$type: "xray.app.version.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.coreVersion !== "") {
|
||||
writer.uint32(10).string(message.coreVersion);
|
||||
}
|
||||
if (message.minVersion !== "") {
|
||||
writer.uint32(18).string(message.minVersion);
|
||||
}
|
||||
if (message.maxVersion !== "") {
|
||||
writer.uint32(26).string(message.maxVersion);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.coreVersion = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.minVersion = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxVersion = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
coreVersion: isSet(object.coreVersion) ? globalThis.String(object.coreVersion) : "",
|
||||
minVersion: isSet(object.minVersion) ? globalThis.String(object.minVersion) : "",
|
||||
maxVersion: isSet(object.maxVersion) ? globalThis.String(object.maxVersion) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.coreVersion !== "") {
|
||||
obj.coreVersion = message.coreVersion;
|
||||
}
|
||||
if (message.minVersion !== "") {
|
||||
obj.minVersion = message.minVersion;
|
||||
}
|
||||
if (message.maxVersion !== "") {
|
||||
obj.maxVersion = message.maxVersion;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.coreVersion = object.coreVersion ?? "";
|
||||
message.minVersion = object.minVersion ?? "";
|
||||
message.maxVersion = object.maxVersion ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
60
src/proto/common/log/log.ts
Normal file
60
src/proto/common/log/log.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/log/log.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "xray.common.log";
|
||||
|
||||
export enum Severity {
|
||||
Unknown = 0,
|
||||
Error = 1,
|
||||
Warning = 2,
|
||||
Info = 3,
|
||||
Debug = 4,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function severityFromJSON(object: any): Severity {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "Unknown":
|
||||
return Severity.Unknown;
|
||||
case 1:
|
||||
case "Error":
|
||||
return Severity.Error;
|
||||
case 2:
|
||||
case "Warning":
|
||||
return Severity.Warning;
|
||||
case 3:
|
||||
case "Info":
|
||||
return Severity.Info;
|
||||
case 4:
|
||||
case "Debug":
|
||||
return Severity.Debug;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Severity.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function severityToJSON(object: Severity): string {
|
||||
switch (object) {
|
||||
case Severity.Unknown:
|
||||
return "Unknown";
|
||||
case Severity.Error:
|
||||
return "Error";
|
||||
case Severity.Warning:
|
||||
return "Warning";
|
||||
case Severity.Info:
|
||||
return "Info";
|
||||
case Severity.Debug:
|
||||
return "Debug";
|
||||
case Severity.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
153
src/proto/common/net/address.ts
Normal file
153
src/proto/common/net/address.ts
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/net/address.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.common.net";
|
||||
|
||||
/**
|
||||
* Address of a network host. It may be either an IP address or a domain
|
||||
* address.
|
||||
*/
|
||||
export interface IPOrDomain {
|
||||
$type: "xray.common.net.IPOrDomain";
|
||||
/** IP address. Must by either 4 or 16 bytes. */
|
||||
ip?:
|
||||
| Uint8Array
|
||||
| undefined;
|
||||
/** Domain address. */
|
||||
domain?: string | undefined;
|
||||
}
|
||||
|
||||
function createBaseIPOrDomain(): IPOrDomain {
|
||||
return { $type: "xray.common.net.IPOrDomain", ip: undefined, domain: undefined };
|
||||
}
|
||||
|
||||
export const IPOrDomain: MessageFns<IPOrDomain, "xray.common.net.IPOrDomain"> = {
|
||||
$type: "xray.common.net.IPOrDomain" as const,
|
||||
|
||||
encode(message: IPOrDomain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.ip !== undefined) {
|
||||
writer.uint32(10).bytes(message.ip);
|
||||
}
|
||||
if (message.domain !== undefined) {
|
||||
writer.uint32(18).string(message.domain);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): IPOrDomain {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseIPOrDomain();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ip = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domain = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): IPOrDomain {
|
||||
return {
|
||||
$type: IPOrDomain.$type,
|
||||
ip: isSet(object.ip) ? bytesFromBase64(object.ip) : undefined,
|
||||
domain: isSet(object.domain) ? globalThis.String(object.domain) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: IPOrDomain): unknown {
|
||||
const obj: any = {};
|
||||
if (message.ip !== undefined) {
|
||||
obj.ip = base64FromBytes(message.ip);
|
||||
}
|
||||
if (message.domain !== undefined) {
|
||||
obj.domain = message.domain;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<IPOrDomain>): IPOrDomain {
|
||||
return IPOrDomain.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<IPOrDomain>): IPOrDomain {
|
||||
const message = createBaseIPOrDomain();
|
||||
message.ip = object.ip ?? undefined;
|
||||
message.domain = object.domain ?? undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(IPOrDomain.$type, IPOrDomain);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
142
src/proto/common/net/destination.ts
Normal file
142
src/proto/common/net/destination.ts
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/net/destination.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
import { IPOrDomain } from "./address";
|
||||
import { Network, networkFromJSON, networkToJSON } from "./network";
|
||||
|
||||
export const protobufPackage = "xray.common.net";
|
||||
|
||||
/** Endpoint of a network connection. */
|
||||
export interface Endpoint {
|
||||
$type: "xray.common.net.Endpoint";
|
||||
network: Network;
|
||||
address: IPOrDomain | undefined;
|
||||
port: number;
|
||||
}
|
||||
|
||||
function createBaseEndpoint(): Endpoint {
|
||||
return { $type: "xray.common.net.Endpoint", network: 0, address: undefined, port: 0 };
|
||||
}
|
||||
|
||||
export const Endpoint: MessageFns<Endpoint, "xray.common.net.Endpoint"> = {
|
||||
$type: "xray.common.net.Endpoint" as const,
|
||||
|
||||
encode(message: Endpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.network !== 0) {
|
||||
writer.uint32(8).int32(message.network);
|
||||
}
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
writer.uint32(24).uint32(message.port);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Endpoint {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseEndpoint();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.network = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.port = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Endpoint {
|
||||
return {
|
||||
$type: Endpoint.$type,
|
||||
network: isSet(object.network) ? networkFromJSON(object.network) : 0,
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Endpoint): unknown {
|
||||
const obj: any = {};
|
||||
if (message.network !== 0) {
|
||||
obj.network = networkToJSON(message.network);
|
||||
}
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
obj.port = Math.round(message.port);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Endpoint>): Endpoint {
|
||||
return Endpoint.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Endpoint>): Endpoint {
|
||||
const message = createBaseEndpoint();
|
||||
message.network = object.network ?? 0;
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.port = object.port ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Endpoint.$type, Endpoint);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
157
src/proto/common/net/network.ts
Normal file
157
src/proto/common/net/network.ts
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/net/network.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.common.net";
|
||||
|
||||
export enum Network {
|
||||
Unknown = 0,
|
||||
TCP = 2,
|
||||
UDP = 3,
|
||||
UNIX = 4,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function networkFromJSON(object: any): Network {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "Unknown":
|
||||
return Network.Unknown;
|
||||
case 2:
|
||||
case "TCP":
|
||||
return Network.TCP;
|
||||
case 3:
|
||||
case "UDP":
|
||||
return Network.UDP;
|
||||
case 4:
|
||||
case "UNIX":
|
||||
return Network.UNIX;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Network.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function networkToJSON(object: Network): string {
|
||||
switch (object) {
|
||||
case Network.Unknown:
|
||||
return "Unknown";
|
||||
case Network.TCP:
|
||||
return "TCP";
|
||||
case Network.UDP:
|
||||
return "UDP";
|
||||
case Network.UNIX:
|
||||
return "UNIX";
|
||||
case Network.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
/** NetworkList is a list of Networks. */
|
||||
export interface NetworkList {
|
||||
$type: "xray.common.net.NetworkList";
|
||||
network: Network[];
|
||||
}
|
||||
|
||||
function createBaseNetworkList(): NetworkList {
|
||||
return { $type: "xray.common.net.NetworkList", network: [] };
|
||||
}
|
||||
|
||||
export const NetworkList: MessageFns<NetworkList, "xray.common.net.NetworkList"> = {
|
||||
$type: "xray.common.net.NetworkList" as const,
|
||||
|
||||
encode(message: NetworkList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
writer.uint32(10).fork();
|
||||
for (const v of message.network) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): NetworkList {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseNetworkList();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag === 8) {
|
||||
message.network.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 10) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.network.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): NetworkList {
|
||||
return {
|
||||
$type: NetworkList.$type,
|
||||
network: globalThis.Array.isArray(object?.network) ? object.network.map((e: any) => networkFromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: NetworkList): unknown {
|
||||
const obj: any = {};
|
||||
if (message.network?.length) {
|
||||
obj.network = message.network.map((e) => networkToJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<NetworkList>): NetworkList {
|
||||
return NetworkList.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<NetworkList>): NetworkList {
|
||||
const message = createBaseNetworkList();
|
||||
message.network = object.network?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(NetworkList.$type, NetworkList);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
194
src/proto/common/net/port.ts
Normal file
194
src/proto/common/net/port.ts
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/net/port.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.common.net";
|
||||
|
||||
/** PortRange represents a range of ports. */
|
||||
export interface PortRange {
|
||||
$type: "xray.common.net.PortRange";
|
||||
/** The port that this range starts from. */
|
||||
From: number;
|
||||
/** The port that this range ends with (inclusive). */
|
||||
To: number;
|
||||
}
|
||||
|
||||
/** PortList is a list of ports. */
|
||||
export interface PortList {
|
||||
$type: "xray.common.net.PortList";
|
||||
range: PortRange[];
|
||||
}
|
||||
|
||||
function createBasePortRange(): PortRange {
|
||||
return { $type: "xray.common.net.PortRange", From: 0, To: 0 };
|
||||
}
|
||||
|
||||
export const PortRange: MessageFns<PortRange, "xray.common.net.PortRange"> = {
|
||||
$type: "xray.common.net.PortRange" as const,
|
||||
|
||||
encode(message: PortRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.From !== 0) {
|
||||
writer.uint32(8).uint32(message.From);
|
||||
}
|
||||
if (message.To !== 0) {
|
||||
writer.uint32(16).uint32(message.To);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PortRange {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePortRange();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.From = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.To = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PortRange {
|
||||
return {
|
||||
$type: PortRange.$type,
|
||||
From: isSet(object.From) ? globalThis.Number(object.From) : 0,
|
||||
To: isSet(object.To) ? globalThis.Number(object.To) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PortRange): unknown {
|
||||
const obj: any = {};
|
||||
if (message.From !== 0) {
|
||||
obj.From = Math.round(message.From);
|
||||
}
|
||||
if (message.To !== 0) {
|
||||
obj.To = Math.round(message.To);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PortRange>): PortRange {
|
||||
return PortRange.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<PortRange>): PortRange {
|
||||
const message = createBasePortRange();
|
||||
message.From = object.From ?? 0;
|
||||
message.To = object.To ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(PortRange.$type, PortRange);
|
||||
|
||||
function createBasePortList(): PortList {
|
||||
return { $type: "xray.common.net.PortList", range: [] };
|
||||
}
|
||||
|
||||
export const PortList: MessageFns<PortList, "xray.common.net.PortList"> = {
|
||||
$type: "xray.common.net.PortList" as const,
|
||||
|
||||
encode(message: PortList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.range) {
|
||||
PortRange.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PortList {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePortList();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.range.push(PortRange.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PortList {
|
||||
return {
|
||||
$type: PortList.$type,
|
||||
range: globalThis.Array.isArray(object?.range) ? object.range.map((e: any) => PortRange.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PortList): unknown {
|
||||
const obj: any = {};
|
||||
if (message.range?.length) {
|
||||
obj.range = message.range.map((e) => PortRange.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PortList>): PortList {
|
||||
return PortList.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<PortList>): PortList {
|
||||
const message = createBasePortList();
|
||||
message.range = object.range?.map((e) => PortRange.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(PortList.$type, PortList);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
158
src/proto/common/protocol/headers.ts
Normal file
158
src/proto/common/protocol/headers.ts
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/protocol/headers.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.common.protocol";
|
||||
|
||||
export enum SecurityType {
|
||||
UNKNOWN = 0,
|
||||
AUTO = 2,
|
||||
AES128_GCM = 3,
|
||||
CHACHA20_POLY1305 = 4,
|
||||
/** NONE - [DEPRECATED 2023-06] */
|
||||
NONE = 5,
|
||||
ZERO = 6,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function securityTypeFromJSON(object: any): SecurityType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "UNKNOWN":
|
||||
return SecurityType.UNKNOWN;
|
||||
case 2:
|
||||
case "AUTO":
|
||||
return SecurityType.AUTO;
|
||||
case 3:
|
||||
case "AES128_GCM":
|
||||
return SecurityType.AES128_GCM;
|
||||
case 4:
|
||||
case "CHACHA20_POLY1305":
|
||||
return SecurityType.CHACHA20_POLY1305;
|
||||
case 5:
|
||||
case "NONE":
|
||||
return SecurityType.NONE;
|
||||
case 6:
|
||||
case "ZERO":
|
||||
return SecurityType.ZERO;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return SecurityType.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function securityTypeToJSON(object: SecurityType): string {
|
||||
switch (object) {
|
||||
case SecurityType.UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
case SecurityType.AUTO:
|
||||
return "AUTO";
|
||||
case SecurityType.AES128_GCM:
|
||||
return "AES128_GCM";
|
||||
case SecurityType.CHACHA20_POLY1305:
|
||||
return "CHACHA20_POLY1305";
|
||||
case SecurityType.NONE:
|
||||
return "NONE";
|
||||
case SecurityType.ZERO:
|
||||
return "ZERO";
|
||||
case SecurityType.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
export interface SecurityConfig {
|
||||
$type: "xray.common.protocol.SecurityConfig";
|
||||
type: SecurityType;
|
||||
}
|
||||
|
||||
function createBaseSecurityConfig(): SecurityConfig {
|
||||
return { $type: "xray.common.protocol.SecurityConfig", type: 0 };
|
||||
}
|
||||
|
||||
export const SecurityConfig: MessageFns<SecurityConfig, "xray.common.protocol.SecurityConfig"> = {
|
||||
$type: "xray.common.protocol.SecurityConfig" as const,
|
||||
|
||||
encode(message: SecurityConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.type !== 0) {
|
||||
writer.uint32(8).int32(message.type);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SecurityConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSecurityConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SecurityConfig {
|
||||
return { $type: SecurityConfig.$type, type: isSet(object.type) ? securityTypeFromJSON(object.type) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: SecurityConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.type !== 0) {
|
||||
obj.type = securityTypeToJSON(message.type);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SecurityConfig>): SecurityConfig {
|
||||
return SecurityConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SecurityConfig>): SecurityConfig {
|
||||
const message = createBaseSecurityConfig();
|
||||
message.type = object.type ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(SecurityConfig.$type, SecurityConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
141
src/proto/common/protocol/server_spec.ts
Normal file
141
src/proto/common/protocol/server_spec.ts
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/protocol/server_spec.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
import { IPOrDomain } from "../net/address";
|
||||
import { User } from "./user";
|
||||
|
||||
export const protobufPackage = "xray.common.protocol";
|
||||
|
||||
export interface ServerEndpoint {
|
||||
$type: "xray.common.protocol.ServerEndpoint";
|
||||
address: IPOrDomain | undefined;
|
||||
port: number;
|
||||
user: User | undefined;
|
||||
}
|
||||
|
||||
function createBaseServerEndpoint(): ServerEndpoint {
|
||||
return { $type: "xray.common.protocol.ServerEndpoint", address: undefined, port: 0, user: undefined };
|
||||
}
|
||||
|
||||
export const ServerEndpoint: MessageFns<ServerEndpoint, "xray.common.protocol.ServerEndpoint"> = {
|
||||
$type: "xray.common.protocol.ServerEndpoint" as const,
|
||||
|
||||
encode(message: ServerEndpoint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
writer.uint32(16).uint32(message.port);
|
||||
}
|
||||
if (message.user !== undefined) {
|
||||
User.encode(message.user, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerEndpoint {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerEndpoint();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.port = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.user = User.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerEndpoint {
|
||||
return {
|
||||
$type: ServerEndpoint.$type,
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
||||
user: isSet(object.user) ? User.fromJSON(object.user) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerEndpoint): unknown {
|
||||
const obj: any = {};
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
obj.port = Math.round(message.port);
|
||||
}
|
||||
if (message.user !== undefined) {
|
||||
obj.user = User.toJSON(message.user);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerEndpoint>): ServerEndpoint {
|
||||
return ServerEndpoint.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerEndpoint>): ServerEndpoint {
|
||||
const message = createBaseServerEndpoint();
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.port = object.port ?? 0;
|
||||
message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerEndpoint.$type, ServerEndpoint);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
145
src/proto/common/protocol/user.ts
Normal file
145
src/proto/common/protocol/user.ts
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/protocol/user.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
import { TypedMessage } from "../serial/typed_message";
|
||||
|
||||
export const protobufPackage = "xray.common.protocol";
|
||||
|
||||
/** User is a generic user for all protocols. */
|
||||
export interface User {
|
||||
$type: "xray.common.protocol.User";
|
||||
level: number;
|
||||
email: string;
|
||||
/**
|
||||
* Protocol specific account information. Must be the account proto in one of
|
||||
* the proxies.
|
||||
*/
|
||||
account: TypedMessage | undefined;
|
||||
}
|
||||
|
||||
function createBaseUser(): User {
|
||||
return { $type: "xray.common.protocol.User", level: 0, email: "", account: undefined };
|
||||
}
|
||||
|
||||
export const User: MessageFns<User, "xray.common.protocol.User"> = {
|
||||
$type: "xray.common.protocol.User" as const,
|
||||
|
||||
encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.level !== 0) {
|
||||
writer.uint32(8).uint32(message.level);
|
||||
}
|
||||
if (message.email !== "") {
|
||||
writer.uint32(18).string(message.email);
|
||||
}
|
||||
if (message.account !== undefined) {
|
||||
TypedMessage.encode(message.account, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): User {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseUser();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.level = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.email = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.account = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): User {
|
||||
return {
|
||||
$type: User.$type,
|
||||
level: isSet(object.level) ? globalThis.Number(object.level) : 0,
|
||||
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
||||
account: isSet(object.account) ? TypedMessage.fromJSON(object.account) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: User): unknown {
|
||||
const obj: any = {};
|
||||
if (message.level !== 0) {
|
||||
obj.level = Math.round(message.level);
|
||||
}
|
||||
if (message.email !== "") {
|
||||
obj.email = message.email;
|
||||
}
|
||||
if (message.account !== undefined) {
|
||||
obj.account = TypedMessage.toJSON(message.account);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<User>): User {
|
||||
return User.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<User>): User {
|
||||
const message = createBaseUser();
|
||||
message.level = object.level ?? 0;
|
||||
message.email = object.email ?? "";
|
||||
message.account = (object.account !== undefined && object.account !== null)
|
||||
? TypedMessage.fromPartial(object.account)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(User.$type, User);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
148
src/proto/common/serial/typed_message.ts
Normal file
148
src/proto/common/serial/typed_message.ts
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: common/serial/typed_message.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.common.serial";
|
||||
|
||||
/** TypedMessage is a serialized proto message along with its type name. */
|
||||
export interface TypedMessage {
|
||||
$type: "xray.common.serial.TypedMessage";
|
||||
/** The name of the message type, retrieved from protobuf API. */
|
||||
type: string;
|
||||
/** Serialized proto message. */
|
||||
value: Uint8Array;
|
||||
}
|
||||
|
||||
function createBaseTypedMessage(): TypedMessage {
|
||||
return { $type: "xray.common.serial.TypedMessage", type: "", value: new Uint8Array(0) };
|
||||
}
|
||||
|
||||
export const TypedMessage: MessageFns<TypedMessage, "xray.common.serial.TypedMessage"> = {
|
||||
$type: "xray.common.serial.TypedMessage" as const,
|
||||
|
||||
encode(message: TypedMessage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.type !== "") {
|
||||
writer.uint32(10).string(message.type);
|
||||
}
|
||||
if (message.value.length !== 0) {
|
||||
writer.uint32(18).bytes(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TypedMessage {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTypedMessage();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TypedMessage {
|
||||
return {
|
||||
$type: TypedMessage.$type,
|
||||
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
||||
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: TypedMessage): unknown {
|
||||
const obj: any = {};
|
||||
if (message.type !== "") {
|
||||
obj.type = message.type;
|
||||
}
|
||||
if (message.value.length !== 0) {
|
||||
obj.value = base64FromBytes(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<TypedMessage>): TypedMessage {
|
||||
return TypedMessage.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<TypedMessage>): TypedMessage {
|
||||
const message = createBaseTypedMessage();
|
||||
message.type = object.type ?? "";
|
||||
message.value = object.value ?? new Uint8Array(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(TypedMessage.$type, TypedMessage);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
467
src/proto/core/config.ts
Normal file
467
src/proto/core/config.ts
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: core/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { TypedMessage } from "../common/serial/typed_message";
|
||||
import { messageTypeRegistry } from "../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.core";
|
||||
|
||||
/**
|
||||
* Config is the master config of Xray. Xray takes this config as input and
|
||||
* functions accordingly.
|
||||
*/
|
||||
export interface Config {
|
||||
$type: "xray.core.Config";
|
||||
/** Inbound handler configurations. Must have at least one item. */
|
||||
inbound: InboundHandlerConfig[];
|
||||
/**
|
||||
* Outbound handler configurations. Must have at least one item. The first
|
||||
* item is used as default for routing.
|
||||
*/
|
||||
outbound: OutboundHandlerConfig[];
|
||||
/**
|
||||
* App is for configurations of all features in Xray. A feature must
|
||||
* implement the Feature interface, and its config type must be registered
|
||||
* through common.RegisterConfig.
|
||||
*/
|
||||
app: TypedMessage[];
|
||||
/**
|
||||
* Configuration for extensions. The config may not work if corresponding
|
||||
* extension is not loaded into Xray. Xray will ignore such config during
|
||||
* initialization.
|
||||
*/
|
||||
extension: TypedMessage[];
|
||||
}
|
||||
|
||||
/** InboundHandlerConfig is the configuration for inbound handler. */
|
||||
export interface InboundHandlerConfig {
|
||||
$type: "xray.core.InboundHandlerConfig";
|
||||
/**
|
||||
* Tag of the inbound handler. The tag must be unique among all inbound
|
||||
* handlers
|
||||
*/
|
||||
tag: string;
|
||||
/** Settings for how this inbound proxy is handled. */
|
||||
receiverSettings:
|
||||
| TypedMessage
|
||||
| undefined;
|
||||
/** Settings for inbound proxy. Must be one of the inbound proxies. */
|
||||
proxySettings: TypedMessage | undefined;
|
||||
}
|
||||
|
||||
/** OutboundHandlerConfig is the configuration for outbound handler. */
|
||||
export interface OutboundHandlerConfig {
|
||||
$type: "xray.core.OutboundHandlerConfig";
|
||||
/** Tag of this outbound handler. */
|
||||
tag: string;
|
||||
/** Settings for how to dial connection for this outbound handler. */
|
||||
senderSettings:
|
||||
| TypedMessage
|
||||
| undefined;
|
||||
/** Settings for this outbound proxy. Must be one of the outbound proxies. */
|
||||
proxySettings:
|
||||
| TypedMessage
|
||||
| undefined;
|
||||
/** If not zero, this outbound will be expired in seconds. Not used for now. */
|
||||
expire: number;
|
||||
/** Comment of this outbound handler. Not used for now. */
|
||||
comment: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.core.Config", inbound: [], outbound: [], app: [], extension: [] };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.core.Config"> = {
|
||||
$type: "xray.core.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.inbound) {
|
||||
InboundHandlerConfig.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
for (const v of message.outbound) {
|
||||
OutboundHandlerConfig.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
for (const v of message.app) {
|
||||
TypedMessage.encode(v!, writer.uint32(34).fork()).join();
|
||||
}
|
||||
for (const v of message.extension) {
|
||||
TypedMessage.encode(v!, writer.uint32(50).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.inbound.push(InboundHandlerConfig.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.outbound.push(OutboundHandlerConfig.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.app.push(TypedMessage.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.extension.push(TypedMessage.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
inbound: globalThis.Array.isArray(object?.inbound)
|
||||
? object.inbound.map((e: any) => InboundHandlerConfig.fromJSON(e))
|
||||
: [],
|
||||
outbound: globalThis.Array.isArray(object?.outbound)
|
||||
? object.outbound.map((e: any) => OutboundHandlerConfig.fromJSON(e))
|
||||
: [],
|
||||
app: globalThis.Array.isArray(object?.app) ? object.app.map((e: any) => TypedMessage.fromJSON(e)) : [],
|
||||
extension: globalThis.Array.isArray(object?.extension)
|
||||
? object.extension.map((e: any) => TypedMessage.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.inbound?.length) {
|
||||
obj.inbound = message.inbound.map((e) => InboundHandlerConfig.toJSON(e));
|
||||
}
|
||||
if (message.outbound?.length) {
|
||||
obj.outbound = message.outbound.map((e) => OutboundHandlerConfig.toJSON(e));
|
||||
}
|
||||
if (message.app?.length) {
|
||||
obj.app = message.app.map((e) => TypedMessage.toJSON(e));
|
||||
}
|
||||
if (message.extension?.length) {
|
||||
obj.extension = message.extension.map((e) => TypedMessage.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.inbound = object.inbound?.map((e) => InboundHandlerConfig.fromPartial(e)) || [];
|
||||
message.outbound = object.outbound?.map((e) => OutboundHandlerConfig.fromPartial(e)) || [];
|
||||
message.app = object.app?.map((e) => TypedMessage.fromPartial(e)) || [];
|
||||
message.extension = object.extension?.map((e) => TypedMessage.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseInboundHandlerConfig(): InboundHandlerConfig {
|
||||
return { $type: "xray.core.InboundHandlerConfig", tag: "", receiverSettings: undefined, proxySettings: undefined };
|
||||
}
|
||||
|
||||
export const InboundHandlerConfig: MessageFns<InboundHandlerConfig, "xray.core.InboundHandlerConfig"> = {
|
||||
$type: "xray.core.InboundHandlerConfig" as const,
|
||||
|
||||
encode(message: InboundHandlerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.receiverSettings !== undefined) {
|
||||
TypedMessage.encode(message.receiverSettings, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
TypedMessage.encode(message.proxySettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): InboundHandlerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInboundHandlerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.receiverSettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.proxySettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): InboundHandlerConfig {
|
||||
return {
|
||||
$type: InboundHandlerConfig.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
receiverSettings: isSet(object.receiverSettings) ? TypedMessage.fromJSON(object.receiverSettings) : undefined,
|
||||
proxySettings: isSet(object.proxySettings) ? TypedMessage.fromJSON(object.proxySettings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: InboundHandlerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.receiverSettings !== undefined) {
|
||||
obj.receiverSettings = TypedMessage.toJSON(message.receiverSettings);
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
obj.proxySettings = TypedMessage.toJSON(message.proxySettings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<InboundHandlerConfig>): InboundHandlerConfig {
|
||||
return InboundHandlerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<InboundHandlerConfig>): InboundHandlerConfig {
|
||||
const message = createBaseInboundHandlerConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.receiverSettings = (object.receiverSettings !== undefined && object.receiverSettings !== null)
|
||||
? TypedMessage.fromPartial(object.receiverSettings)
|
||||
: undefined;
|
||||
message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null)
|
||||
? TypedMessage.fromPartial(object.proxySettings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(InboundHandlerConfig.$type, InboundHandlerConfig);
|
||||
|
||||
function createBaseOutboundHandlerConfig(): OutboundHandlerConfig {
|
||||
return {
|
||||
$type: "xray.core.OutboundHandlerConfig",
|
||||
tag: "",
|
||||
senderSettings: undefined,
|
||||
proxySettings: undefined,
|
||||
expire: 0,
|
||||
comment: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const OutboundHandlerConfig: MessageFns<OutboundHandlerConfig, "xray.core.OutboundHandlerConfig"> = {
|
||||
$type: "xray.core.OutboundHandlerConfig" as const,
|
||||
|
||||
encode(message: OutboundHandlerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
if (message.senderSettings !== undefined) {
|
||||
TypedMessage.encode(message.senderSettings, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
TypedMessage.encode(message.proxySettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.expire !== 0) {
|
||||
writer.uint32(32).int64(message.expire);
|
||||
}
|
||||
if (message.comment !== "") {
|
||||
writer.uint32(42).string(message.comment);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): OutboundHandlerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseOutboundHandlerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.senderSettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.proxySettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.expire = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.comment = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): OutboundHandlerConfig {
|
||||
return {
|
||||
$type: OutboundHandlerConfig.$type,
|
||||
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
|
||||
senderSettings: isSet(object.senderSettings) ? TypedMessage.fromJSON(object.senderSettings) : undefined,
|
||||
proxySettings: isSet(object.proxySettings) ? TypedMessage.fromJSON(object.proxySettings) : undefined,
|
||||
expire: isSet(object.expire) ? globalThis.Number(object.expire) : 0,
|
||||
comment: isSet(object.comment) ? globalThis.String(object.comment) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: OutboundHandlerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
if (message.senderSettings !== undefined) {
|
||||
obj.senderSettings = TypedMessage.toJSON(message.senderSettings);
|
||||
}
|
||||
if (message.proxySettings !== undefined) {
|
||||
obj.proxySettings = TypedMessage.toJSON(message.proxySettings);
|
||||
}
|
||||
if (message.expire !== 0) {
|
||||
obj.expire = Math.round(message.expire);
|
||||
}
|
||||
if (message.comment !== "") {
|
||||
obj.comment = message.comment;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<OutboundHandlerConfig>): OutboundHandlerConfig {
|
||||
return OutboundHandlerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<OutboundHandlerConfig>): OutboundHandlerConfig {
|
||||
const message = createBaseOutboundHandlerConfig();
|
||||
message.tag = object.tag ?? "";
|
||||
message.senderSettings = (object.senderSettings !== undefined && object.senderSettings !== null)
|
||||
? TypedMessage.fromPartial(object.senderSettings)
|
||||
: undefined;
|
||||
message.proxySettings = (object.proxySettings !== undefined && object.proxySettings !== null)
|
||||
? TypedMessage.fromPartial(object.proxySettings)
|
||||
: undefined;
|
||||
message.expire = object.expire ?? 0;
|
||||
message.comment = object.comment ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(OutboundHandlerConfig.$type, OutboundHandlerConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
208
src/proto/proxy/blackhole/config.ts
Normal file
208
src/proto/proxy/blackhole/config.ts
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/blackhole/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { TypedMessage } from "../../common/serial/typed_message";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.blackhole";
|
||||
|
||||
export interface NoneResponse {
|
||||
$type: "xray.proxy.blackhole.NoneResponse";
|
||||
}
|
||||
|
||||
export interface HTTPResponse {
|
||||
$type: "xray.proxy.blackhole.HTTPResponse";
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.blackhole.Config";
|
||||
response: TypedMessage | undefined;
|
||||
}
|
||||
|
||||
function createBaseNoneResponse(): NoneResponse {
|
||||
return { $type: "xray.proxy.blackhole.NoneResponse" };
|
||||
}
|
||||
|
||||
export const NoneResponse: MessageFns<NoneResponse, "xray.proxy.blackhole.NoneResponse"> = {
|
||||
$type: "xray.proxy.blackhole.NoneResponse" as const,
|
||||
|
||||
encode(_: NoneResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): NoneResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseNoneResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): NoneResponse {
|
||||
return { $type: NoneResponse.$type };
|
||||
},
|
||||
|
||||
toJSON(_: NoneResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<NoneResponse>): NoneResponse {
|
||||
return NoneResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<NoneResponse>): NoneResponse {
|
||||
const message = createBaseNoneResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(NoneResponse.$type, NoneResponse);
|
||||
|
||||
function createBaseHTTPResponse(): HTTPResponse {
|
||||
return { $type: "xray.proxy.blackhole.HTTPResponse" };
|
||||
}
|
||||
|
||||
export const HTTPResponse: MessageFns<HTTPResponse, "xray.proxy.blackhole.HTTPResponse"> = {
|
||||
$type: "xray.proxy.blackhole.HTTPResponse" as const,
|
||||
|
||||
encode(_: HTTPResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): HTTPResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHTTPResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): HTTPResponse {
|
||||
return { $type: HTTPResponse.$type };
|
||||
},
|
||||
|
||||
toJSON(_: HTTPResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<HTTPResponse>): HTTPResponse {
|
||||
return HTTPResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<HTTPResponse>): HTTPResponse {
|
||||
const message = createBaseHTTPResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(HTTPResponse.$type, HTTPResponse);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.blackhole.Config", response: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.blackhole.Config"> = {
|
||||
$type: "xray.proxy.blackhole.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.response !== undefined) {
|
||||
TypedMessage.encode(message.response, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.response = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
response: isSet(object.response) ? TypedMessage.fromJSON(object.response) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.response !== undefined) {
|
||||
obj.response = TypedMessage.toJSON(message.response);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.response = (object.response !== undefined && object.response !== null)
|
||||
? TypedMessage.fromPartial(object.response)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
175
src/proto/proxy/dns/config.ts
Normal file
175
src/proto/proxy/dns/config.ts
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/dns/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Endpoint } from "../../common/net/destination";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.dns";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.dns.Config";
|
||||
/**
|
||||
* Server is the DNS server address. If specified, this address overrides the
|
||||
* original one.
|
||||
*/
|
||||
server: Endpoint | undefined;
|
||||
userLevel: number;
|
||||
nonIPQuery: string;
|
||||
blockTypes: number[];
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.dns.Config", server: undefined, userLevel: 0, nonIPQuery: "", blockTypes: [] };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.dns.Config"> = {
|
||||
$type: "xray.proxy.dns.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
Endpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
writer.uint32(16).uint32(message.userLevel);
|
||||
}
|
||||
if (message.nonIPQuery !== "") {
|
||||
writer.uint32(26).string(message.nonIPQuery);
|
||||
}
|
||||
writer.uint32(34).fork();
|
||||
for (const v of message.blockTypes) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = Endpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userLevel = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nonIPQuery = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag === 32) {
|
||||
message.blockTypes.push(reader.int32());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 34) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.blockTypes.push(reader.int32());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
server: isSet(object.server) ? Endpoint.fromJSON(object.server) : undefined,
|
||||
userLevel: isSet(object.userLevel) ? globalThis.Number(object.userLevel) : 0,
|
||||
nonIPQuery: isSet(object.nonIPQuery) ? globalThis.String(object.nonIPQuery) : "",
|
||||
blockTypes: globalThis.Array.isArray(object?.blockTypes)
|
||||
? object.blockTypes.map((e: any) => globalThis.Number(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = Endpoint.toJSON(message.server);
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
obj.userLevel = Math.round(message.userLevel);
|
||||
}
|
||||
if (message.nonIPQuery !== "") {
|
||||
obj.nonIPQuery = message.nonIPQuery;
|
||||
}
|
||||
if (message.blockTypes?.length) {
|
||||
obj.blockTypes = message.blockTypes.map((e) => Math.round(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? Endpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
message.userLevel = object.userLevel ?? 0;
|
||||
message.nonIPQuery = object.nonIPQuery ?? "";
|
||||
message.blockTypes = object.blockTypes?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
332
src/proto/proxy/dokodemo/config.ts
Normal file
332
src/proto/proxy/dokodemo/config.ts
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/dokodemo/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { IPOrDomain } from "../../common/net/address";
|
||||
import { Network, networkFromJSON, networkToJSON } from "../../common/net/network";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.dokodemo";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.dokodemo.Config";
|
||||
address: IPOrDomain | undefined;
|
||||
port: number;
|
||||
portMap: { [key: string]: string };
|
||||
/** List of networks that the Dokodemo accepts. */
|
||||
networks: Network[];
|
||||
followRedirect: boolean;
|
||||
userLevel: number;
|
||||
}
|
||||
|
||||
export interface Config_PortMapEntry {
|
||||
$type: "xray.proxy.dokodemo.Config.PortMapEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.proxy.dokodemo.Config",
|
||||
address: undefined,
|
||||
port: 0,
|
||||
portMap: {},
|
||||
networks: [],
|
||||
followRedirect: false,
|
||||
userLevel: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.dokodemo.Config"> = {
|
||||
$type: "xray.proxy.dokodemo.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
writer.uint32(16).uint32(message.port);
|
||||
}
|
||||
globalThis.Object.entries(message.portMap).forEach(([key, value]: [string, string]) => {
|
||||
Config_PortMapEntry.encode(
|
||||
{ $type: "xray.proxy.dokodemo.Config.PortMapEntry", key: key as any, value },
|
||||
writer.uint32(26).fork(),
|
||||
).join();
|
||||
});
|
||||
writer.uint32(58).fork();
|
||||
for (const v of message.networks) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
if (message.followRedirect !== false) {
|
||||
writer.uint32(40).bool(message.followRedirect);
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
writer.uint32(48).uint32(message.userLevel);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.port = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry3 = Config_PortMapEntry.decode(reader, reader.uint32());
|
||||
if (entry3.value !== undefined) {
|
||||
message.portMap[entry3.key] = entry3.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag === 56) {
|
||||
message.networks.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 58) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.networks.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.followRedirect = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userLevel = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
||||
portMap: isObject(object.portMap)
|
||||
? (globalThis.Object.entries(object.portMap) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
networks: globalThis.Array.isArray(object?.networks) ? object.networks.map((e: any) => networkFromJSON(e)) : [],
|
||||
followRedirect: isSet(object.followRedirect) ? globalThis.Boolean(object.followRedirect) : false,
|
||||
userLevel: isSet(object.userLevel) ? globalThis.Number(object.userLevel) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
obj.port = Math.round(message.port);
|
||||
}
|
||||
if (message.portMap) {
|
||||
const entries = globalThis.Object.entries(message.portMap) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.portMap = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.portMap[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.networks?.length) {
|
||||
obj.networks = message.networks.map((e) => networkToJSON(e));
|
||||
}
|
||||
if (message.followRedirect !== false) {
|
||||
obj.followRedirect = message.followRedirect;
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
obj.userLevel = Math.round(message.userLevel);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.port = object.port ?? 0;
|
||||
message.portMap = (globalThis.Object.entries(object.portMap ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.networks = object.networks?.map((e) => e) || [];
|
||||
message.followRedirect = object.followRedirect ?? false;
|
||||
message.userLevel = object.userLevel ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConfig_PortMapEntry(): Config_PortMapEntry {
|
||||
return { $type: "xray.proxy.dokodemo.Config.PortMapEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const Config_PortMapEntry: MessageFns<Config_PortMapEntry, "xray.proxy.dokodemo.Config.PortMapEntry"> = {
|
||||
$type: "xray.proxy.dokodemo.Config.PortMapEntry" as const,
|
||||
|
||||
encode(message: Config_PortMapEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config_PortMapEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig_PortMapEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config_PortMapEntry {
|
||||
return {
|
||||
$type: Config_PortMapEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config_PortMapEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config_PortMapEntry>): Config_PortMapEntry {
|
||||
return Config_PortMapEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config_PortMapEntry>): Config_PortMapEntry {
|
||||
const message = createBaseConfig_PortMapEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config_PortMapEntry.$type, Config_PortMapEntry);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
674
src/proto/proxy/freedom/config.ts
Normal file
674
src/proto/proxy/freedom/config.ts
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/freedom/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ServerEndpoint } from "../../common/protocol/server_spec";
|
||||
import { DomainStrategy, domainStrategyFromJSON, domainStrategyToJSON } from "../../transport/internet/config";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.freedom";
|
||||
|
||||
export interface DestinationOverride {
|
||||
$type: "xray.proxy.freedom.DestinationOverride";
|
||||
server: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
export interface Fragment {
|
||||
$type: "xray.proxy.freedom.Fragment";
|
||||
packetsFrom: number;
|
||||
packetsTo: number;
|
||||
lengthMin: number;
|
||||
lengthMax: number;
|
||||
intervalMin: number;
|
||||
intervalMax: number;
|
||||
maxSplitMin: number;
|
||||
maxSplitMax: number;
|
||||
}
|
||||
|
||||
export interface Noise {
|
||||
$type: "xray.proxy.freedom.Noise";
|
||||
lengthMin: number;
|
||||
lengthMax: number;
|
||||
delayMin: number;
|
||||
delayMax: number;
|
||||
packet: Uint8Array;
|
||||
applyTo: string;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.freedom.Config";
|
||||
domainStrategy: DomainStrategy;
|
||||
destinationOverride: DestinationOverride | undefined;
|
||||
userLevel: number;
|
||||
fragment: Fragment | undefined;
|
||||
proxyProtocol: number;
|
||||
noises: Noise[];
|
||||
}
|
||||
|
||||
function createBaseDestinationOverride(): DestinationOverride {
|
||||
return { $type: "xray.proxy.freedom.DestinationOverride", server: undefined };
|
||||
}
|
||||
|
||||
export const DestinationOverride: MessageFns<DestinationOverride, "xray.proxy.freedom.DestinationOverride"> = {
|
||||
$type: "xray.proxy.freedom.DestinationOverride" as const,
|
||||
|
||||
encode(message: DestinationOverride, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DestinationOverride {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDestinationOverride();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DestinationOverride {
|
||||
return {
|
||||
$type: DestinationOverride.$type,
|
||||
server: isSet(object.server) ? ServerEndpoint.fromJSON(object.server) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: DestinationOverride): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = ServerEndpoint.toJSON(message.server);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DestinationOverride>): DestinationOverride {
|
||||
return DestinationOverride.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DestinationOverride>): DestinationOverride {
|
||||
const message = createBaseDestinationOverride();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? ServerEndpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(DestinationOverride.$type, DestinationOverride);
|
||||
|
||||
function createBaseFragment(): Fragment {
|
||||
return {
|
||||
$type: "xray.proxy.freedom.Fragment",
|
||||
packetsFrom: 0,
|
||||
packetsTo: 0,
|
||||
lengthMin: 0,
|
||||
lengthMax: 0,
|
||||
intervalMin: 0,
|
||||
intervalMax: 0,
|
||||
maxSplitMin: 0,
|
||||
maxSplitMax: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const Fragment: MessageFns<Fragment, "xray.proxy.freedom.Fragment"> = {
|
||||
$type: "xray.proxy.freedom.Fragment" as const,
|
||||
|
||||
encode(message: Fragment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.packetsFrom !== 0) {
|
||||
writer.uint32(8).uint64(message.packetsFrom);
|
||||
}
|
||||
if (message.packetsTo !== 0) {
|
||||
writer.uint32(16).uint64(message.packetsTo);
|
||||
}
|
||||
if (message.lengthMin !== 0) {
|
||||
writer.uint32(24).uint64(message.lengthMin);
|
||||
}
|
||||
if (message.lengthMax !== 0) {
|
||||
writer.uint32(32).uint64(message.lengthMax);
|
||||
}
|
||||
if (message.intervalMin !== 0) {
|
||||
writer.uint32(40).uint64(message.intervalMin);
|
||||
}
|
||||
if (message.intervalMax !== 0) {
|
||||
writer.uint32(48).uint64(message.intervalMax);
|
||||
}
|
||||
if (message.maxSplitMin !== 0) {
|
||||
writer.uint32(56).uint64(message.maxSplitMin);
|
||||
}
|
||||
if (message.maxSplitMax !== 0) {
|
||||
writer.uint32(64).uint64(message.maxSplitMax);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Fragment {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFragment();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.packetsFrom = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.packetsTo = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lengthMin = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lengthMax = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.intervalMin = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.intervalMax = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxSplitMin = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxSplitMax = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Fragment {
|
||||
return {
|
||||
$type: Fragment.$type,
|
||||
packetsFrom: isSet(object.packetsFrom) ? globalThis.Number(object.packetsFrom) : 0,
|
||||
packetsTo: isSet(object.packetsTo) ? globalThis.Number(object.packetsTo) : 0,
|
||||
lengthMin: isSet(object.lengthMin) ? globalThis.Number(object.lengthMin) : 0,
|
||||
lengthMax: isSet(object.lengthMax) ? globalThis.Number(object.lengthMax) : 0,
|
||||
intervalMin: isSet(object.intervalMin) ? globalThis.Number(object.intervalMin) : 0,
|
||||
intervalMax: isSet(object.intervalMax) ? globalThis.Number(object.intervalMax) : 0,
|
||||
maxSplitMin: isSet(object.maxSplitMin) ? globalThis.Number(object.maxSplitMin) : 0,
|
||||
maxSplitMax: isSet(object.maxSplitMax) ? globalThis.Number(object.maxSplitMax) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Fragment): unknown {
|
||||
const obj: any = {};
|
||||
if (message.packetsFrom !== 0) {
|
||||
obj.packetsFrom = Math.round(message.packetsFrom);
|
||||
}
|
||||
if (message.packetsTo !== 0) {
|
||||
obj.packetsTo = Math.round(message.packetsTo);
|
||||
}
|
||||
if (message.lengthMin !== 0) {
|
||||
obj.lengthMin = Math.round(message.lengthMin);
|
||||
}
|
||||
if (message.lengthMax !== 0) {
|
||||
obj.lengthMax = Math.round(message.lengthMax);
|
||||
}
|
||||
if (message.intervalMin !== 0) {
|
||||
obj.intervalMin = Math.round(message.intervalMin);
|
||||
}
|
||||
if (message.intervalMax !== 0) {
|
||||
obj.intervalMax = Math.round(message.intervalMax);
|
||||
}
|
||||
if (message.maxSplitMin !== 0) {
|
||||
obj.maxSplitMin = Math.round(message.maxSplitMin);
|
||||
}
|
||||
if (message.maxSplitMax !== 0) {
|
||||
obj.maxSplitMax = Math.round(message.maxSplitMax);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Fragment>): Fragment {
|
||||
return Fragment.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Fragment>): Fragment {
|
||||
const message = createBaseFragment();
|
||||
message.packetsFrom = object.packetsFrom ?? 0;
|
||||
message.packetsTo = object.packetsTo ?? 0;
|
||||
message.lengthMin = object.lengthMin ?? 0;
|
||||
message.lengthMax = object.lengthMax ?? 0;
|
||||
message.intervalMin = object.intervalMin ?? 0;
|
||||
message.intervalMax = object.intervalMax ?? 0;
|
||||
message.maxSplitMin = object.maxSplitMin ?? 0;
|
||||
message.maxSplitMax = object.maxSplitMax ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Fragment.$type, Fragment);
|
||||
|
||||
function createBaseNoise(): Noise {
|
||||
return {
|
||||
$type: "xray.proxy.freedom.Noise",
|
||||
lengthMin: 0,
|
||||
lengthMax: 0,
|
||||
delayMin: 0,
|
||||
delayMax: 0,
|
||||
packet: new Uint8Array(0),
|
||||
applyTo: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Noise: MessageFns<Noise, "xray.proxy.freedom.Noise"> = {
|
||||
$type: "xray.proxy.freedom.Noise" as const,
|
||||
|
||||
encode(message: Noise, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.lengthMin !== 0) {
|
||||
writer.uint32(8).uint64(message.lengthMin);
|
||||
}
|
||||
if (message.lengthMax !== 0) {
|
||||
writer.uint32(16).uint64(message.lengthMax);
|
||||
}
|
||||
if (message.delayMin !== 0) {
|
||||
writer.uint32(24).uint64(message.delayMin);
|
||||
}
|
||||
if (message.delayMax !== 0) {
|
||||
writer.uint32(32).uint64(message.delayMax);
|
||||
}
|
||||
if (message.packet.length !== 0) {
|
||||
writer.uint32(42).bytes(message.packet);
|
||||
}
|
||||
if (message.applyTo !== "") {
|
||||
writer.uint32(50).string(message.applyTo);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Noise {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseNoise();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lengthMin = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.lengthMax = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.delayMin = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.delayMax = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.packet = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.applyTo = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Noise {
|
||||
return {
|
||||
$type: Noise.$type,
|
||||
lengthMin: isSet(object.lengthMin) ? globalThis.Number(object.lengthMin) : 0,
|
||||
lengthMax: isSet(object.lengthMax) ? globalThis.Number(object.lengthMax) : 0,
|
||||
delayMin: isSet(object.delayMin) ? globalThis.Number(object.delayMin) : 0,
|
||||
delayMax: isSet(object.delayMax) ? globalThis.Number(object.delayMax) : 0,
|
||||
packet: isSet(object.packet) ? bytesFromBase64(object.packet) : new Uint8Array(0),
|
||||
applyTo: isSet(object.applyTo) ? globalThis.String(object.applyTo) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Noise): unknown {
|
||||
const obj: any = {};
|
||||
if (message.lengthMin !== 0) {
|
||||
obj.lengthMin = Math.round(message.lengthMin);
|
||||
}
|
||||
if (message.lengthMax !== 0) {
|
||||
obj.lengthMax = Math.round(message.lengthMax);
|
||||
}
|
||||
if (message.delayMin !== 0) {
|
||||
obj.delayMin = Math.round(message.delayMin);
|
||||
}
|
||||
if (message.delayMax !== 0) {
|
||||
obj.delayMax = Math.round(message.delayMax);
|
||||
}
|
||||
if (message.packet.length !== 0) {
|
||||
obj.packet = base64FromBytes(message.packet);
|
||||
}
|
||||
if (message.applyTo !== "") {
|
||||
obj.applyTo = message.applyTo;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Noise>): Noise {
|
||||
return Noise.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Noise>): Noise {
|
||||
const message = createBaseNoise();
|
||||
message.lengthMin = object.lengthMin ?? 0;
|
||||
message.lengthMax = object.lengthMax ?? 0;
|
||||
message.delayMin = object.delayMin ?? 0;
|
||||
message.delayMax = object.delayMax ?? 0;
|
||||
message.packet = object.packet ?? new Uint8Array(0);
|
||||
message.applyTo = object.applyTo ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Noise.$type, Noise);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.proxy.freedom.Config",
|
||||
domainStrategy: 0,
|
||||
destinationOverride: undefined,
|
||||
userLevel: 0,
|
||||
fragment: undefined,
|
||||
proxyProtocol: 0,
|
||||
noises: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.freedom.Config"> = {
|
||||
$type: "xray.proxy.freedom.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.domainStrategy !== 0) {
|
||||
writer.uint32(8).int32(message.domainStrategy);
|
||||
}
|
||||
if (message.destinationOverride !== undefined) {
|
||||
DestinationOverride.encode(message.destinationOverride, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
writer.uint32(32).uint32(message.userLevel);
|
||||
}
|
||||
if (message.fragment !== undefined) {
|
||||
Fragment.encode(message.fragment, writer.uint32(42).fork()).join();
|
||||
}
|
||||
if (message.proxyProtocol !== 0) {
|
||||
writer.uint32(48).uint32(message.proxyProtocol);
|
||||
}
|
||||
for (const v of message.noises) {
|
||||
Noise.encode(v!, writer.uint32(58).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domainStrategy = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.destinationOverride = DestinationOverride.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userLevel = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.fragment = Fragment.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.proxyProtocol = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.noises.push(Noise.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
domainStrategy: isSet(object.domainStrategy) ? domainStrategyFromJSON(object.domainStrategy) : 0,
|
||||
destinationOverride: isSet(object.destinationOverride)
|
||||
? DestinationOverride.fromJSON(object.destinationOverride)
|
||||
: undefined,
|
||||
userLevel: isSet(object.userLevel) ? globalThis.Number(object.userLevel) : 0,
|
||||
fragment: isSet(object.fragment) ? Fragment.fromJSON(object.fragment) : undefined,
|
||||
proxyProtocol: isSet(object.proxyProtocol) ? globalThis.Number(object.proxyProtocol) : 0,
|
||||
noises: globalThis.Array.isArray(object?.noises) ? object.noises.map((e: any) => Noise.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.domainStrategy !== 0) {
|
||||
obj.domainStrategy = domainStrategyToJSON(message.domainStrategy);
|
||||
}
|
||||
if (message.destinationOverride !== undefined) {
|
||||
obj.destinationOverride = DestinationOverride.toJSON(message.destinationOverride);
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
obj.userLevel = Math.round(message.userLevel);
|
||||
}
|
||||
if (message.fragment !== undefined) {
|
||||
obj.fragment = Fragment.toJSON(message.fragment);
|
||||
}
|
||||
if (message.proxyProtocol !== 0) {
|
||||
obj.proxyProtocol = Math.round(message.proxyProtocol);
|
||||
}
|
||||
if (message.noises?.length) {
|
||||
obj.noises = message.noises.map((e) => Noise.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.domainStrategy = object.domainStrategy ?? 0;
|
||||
message.destinationOverride = (object.destinationOverride !== undefined && object.destinationOverride !== null)
|
||||
? DestinationOverride.fromPartial(object.destinationOverride)
|
||||
: undefined;
|
||||
message.userLevel = object.userLevel ?? 0;
|
||||
message.fragment = (object.fragment !== undefined && object.fragment !== null)
|
||||
? Fragment.fromPartial(object.fragment)
|
||||
: undefined;
|
||||
message.proxyProtocol = object.proxyProtocol ?? 0;
|
||||
message.noises = object.noises?.map((e) => Noise.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
526
src/proto/proxy/http/config.ts
Normal file
526
src/proto/proxy/http/config.ts
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/http/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ServerEndpoint } from "../../common/protocol/server_spec";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.http";
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.http.Account";
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** Config for HTTP proxy server. */
|
||||
export interface ServerConfig {
|
||||
$type: "xray.proxy.http.ServerConfig";
|
||||
accounts: { [key: string]: string };
|
||||
allowTransparent: boolean;
|
||||
userLevel: number;
|
||||
}
|
||||
|
||||
export interface ServerConfig_AccountsEntry {
|
||||
$type: "xray.proxy.http.ServerConfig.AccountsEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface Header {
|
||||
$type: "xray.proxy.http.Header";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/** ClientConfig is the protobuf config for HTTP proxy client. */
|
||||
export interface ClientConfig {
|
||||
$type: "xray.proxy.http.ClientConfig";
|
||||
/** Sever is a list of HTTP server addresses. */
|
||||
server: ServerEndpoint | undefined;
|
||||
header: Header[];
|
||||
}
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.http.Account", username: "", password: "" };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.http.Account"> = {
|
||||
$type: "xray.proxy.http.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.username !== "") {
|
||||
writer.uint32(10).string(message.username);
|
||||
}
|
||||
if (message.password !== "") {
|
||||
writer.uint32(18).string(message.password);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.username = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return {
|
||||
$type: Account.$type,
|
||||
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
||||
password: isSet(object.password) ? globalThis.String(object.password) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.username !== "") {
|
||||
obj.username = message.username;
|
||||
}
|
||||
if (message.password !== "") {
|
||||
obj.password = message.password;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.username = object.username ?? "";
|
||||
message.password = object.password ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
function createBaseServerConfig(): ServerConfig {
|
||||
return { $type: "xray.proxy.http.ServerConfig", accounts: {}, allowTransparent: false, userLevel: 0 };
|
||||
}
|
||||
|
||||
export const ServerConfig: MessageFns<ServerConfig, "xray.proxy.http.ServerConfig"> = {
|
||||
$type: "xray.proxy.http.ServerConfig" as const,
|
||||
|
||||
encode(message: ServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
globalThis.Object.entries(message.accounts).forEach(([key, value]: [string, string]) => {
|
||||
ServerConfig_AccountsEntry.encode(
|
||||
{ $type: "xray.proxy.http.ServerConfig.AccountsEntry", key: key as any, value },
|
||||
writer.uint32(18).fork(),
|
||||
).join();
|
||||
});
|
||||
if (message.allowTransparent !== false) {
|
||||
writer.uint32(24).bool(message.allowTransparent);
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
writer.uint32(32).uint32(message.userLevel);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry2 = ServerConfig_AccountsEntry.decode(reader, reader.uint32());
|
||||
if (entry2.value !== undefined) {
|
||||
message.accounts[entry2.key] = entry2.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.allowTransparent = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userLevel = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig {
|
||||
return {
|
||||
$type: ServerConfig.$type,
|
||||
accounts: isObject(object.accounts)
|
||||
? (globalThis.Object.entries(object.accounts) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
allowTransparent: isSet(object.allowTransparent) ? globalThis.Boolean(object.allowTransparent) : false,
|
||||
userLevel: isSet(object.userLevel) ? globalThis.Number(object.userLevel) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.accounts) {
|
||||
const entries = globalThis.Object.entries(message.accounts) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.accounts = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.accounts[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.allowTransparent !== false) {
|
||||
obj.allowTransparent = message.allowTransparent;
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
obj.userLevel = Math.round(message.userLevel);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig>): ServerConfig {
|
||||
return ServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig>): ServerConfig {
|
||||
const message = createBaseServerConfig();
|
||||
message.accounts = (globalThis.Object.entries(object.accounts ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.allowTransparent = object.allowTransparent ?? false;
|
||||
message.userLevel = object.userLevel ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig.$type, ServerConfig);
|
||||
|
||||
function createBaseServerConfig_AccountsEntry(): ServerConfig_AccountsEntry {
|
||||
return { $type: "xray.proxy.http.ServerConfig.AccountsEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const ServerConfig_AccountsEntry: MessageFns<
|
||||
ServerConfig_AccountsEntry,
|
||||
"xray.proxy.http.ServerConfig.AccountsEntry"
|
||||
> = {
|
||||
$type: "xray.proxy.http.ServerConfig.AccountsEntry" as const,
|
||||
|
||||
encode(message: ServerConfig_AccountsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig_AccountsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig_AccountsEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig_AccountsEntry {
|
||||
return {
|
||||
$type: ServerConfig_AccountsEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig_AccountsEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig_AccountsEntry>): ServerConfig_AccountsEntry {
|
||||
return ServerConfig_AccountsEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig_AccountsEntry>): ServerConfig_AccountsEntry {
|
||||
const message = createBaseServerConfig_AccountsEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig_AccountsEntry.$type, ServerConfig_AccountsEntry);
|
||||
|
||||
function createBaseHeader(): Header {
|
||||
return { $type: "xray.proxy.http.Header", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const Header: MessageFns<Header, "xray.proxy.http.Header"> = {
|
||||
$type: "xray.proxy.http.Header" as const,
|
||||
|
||||
encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Header {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHeader();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Header {
|
||||
return {
|
||||
$type: Header.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Header): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Header>): Header {
|
||||
return Header.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Header>): Header {
|
||||
const message = createBaseHeader();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Header.$type, Header);
|
||||
|
||||
function createBaseClientConfig(): ClientConfig {
|
||||
return { $type: "xray.proxy.http.ClientConfig", server: undefined, header: [] };
|
||||
}
|
||||
|
||||
export const ClientConfig: MessageFns<ClientConfig, "xray.proxy.http.ClientConfig"> = {
|
||||
$type: "xray.proxy.http.ClientConfig" as const,
|
||||
|
||||
encode(message: ClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
for (const v of message.header) {
|
||||
Header.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ClientConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseClientConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.header.push(Header.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ClientConfig {
|
||||
return {
|
||||
$type: ClientConfig.$type,
|
||||
server: isSet(object.server) ? ServerEndpoint.fromJSON(object.server) : undefined,
|
||||
header: globalThis.Array.isArray(object?.header) ? object.header.map((e: any) => Header.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ClientConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = ServerEndpoint.toJSON(message.server);
|
||||
}
|
||||
if (message.header?.length) {
|
||||
obj.header = message.header.map((e) => Header.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ClientConfig>): ClientConfig {
|
||||
return ClientConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ClientConfig>): ClientConfig {
|
||||
const message = createBaseClientConfig();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? ServerEndpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
message.header = object.header?.map((e) => Header.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ClientConfig.$type, ClientConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
100
src/proto/proxy/loopback/config.ts
Normal file
100
src/proto/proxy/loopback/config.ts
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/loopback/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.loopback";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.loopback.Config";
|
||||
inboundTag: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.loopback.Config", inboundTag: "" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.loopback.Config"> = {
|
||||
$type: "xray.proxy.loopback.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.inboundTag !== "") {
|
||||
writer.uint32(10).string(message.inboundTag);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.inboundTag = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return { $type: Config.$type, inboundTag: isSet(object.inboundTag) ? globalThis.String(object.inboundTag) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.inboundTag !== "") {
|
||||
obj.inboundTag = message.inboundTag;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.inboundTag = object.inboundTag ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
368
src/proto/proxy/shadowsocks/config.ts
Normal file
368
src/proto/proxy/shadowsocks/config.ts
Normal file
|
|
@ -0,0 +1,368 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/shadowsocks/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Network, networkFromJSON, networkToJSON } from "../../common/net/network";
|
||||
import { ServerEndpoint } from "../../common/protocol/server_spec";
|
||||
import { User } from "../../common/protocol/user";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.shadowsocks";
|
||||
|
||||
export enum CipherType {
|
||||
UNKNOWN = 0,
|
||||
AES_128_GCM = 5,
|
||||
AES_256_GCM = 6,
|
||||
CHACHA20_POLY1305 = 7,
|
||||
XCHACHA20_POLY1305 = 8,
|
||||
NONE = 9,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function cipherTypeFromJSON(object: any): CipherType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "UNKNOWN":
|
||||
return CipherType.UNKNOWN;
|
||||
case 5:
|
||||
case "AES_128_GCM":
|
||||
return CipherType.AES_128_GCM;
|
||||
case 6:
|
||||
case "AES_256_GCM":
|
||||
return CipherType.AES_256_GCM;
|
||||
case 7:
|
||||
case "CHACHA20_POLY1305":
|
||||
return CipherType.CHACHA20_POLY1305;
|
||||
case 8:
|
||||
case "XCHACHA20_POLY1305":
|
||||
return CipherType.XCHACHA20_POLY1305;
|
||||
case 9:
|
||||
case "NONE":
|
||||
return CipherType.NONE;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return CipherType.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function cipherTypeToJSON(object: CipherType): string {
|
||||
switch (object) {
|
||||
case CipherType.UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
case CipherType.AES_128_GCM:
|
||||
return "AES_128_GCM";
|
||||
case CipherType.AES_256_GCM:
|
||||
return "AES_256_GCM";
|
||||
case CipherType.CHACHA20_POLY1305:
|
||||
return "CHACHA20_POLY1305";
|
||||
case CipherType.XCHACHA20_POLY1305:
|
||||
return "XCHACHA20_POLY1305";
|
||||
case CipherType.NONE:
|
||||
return "NONE";
|
||||
case CipherType.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.shadowsocks.Account";
|
||||
password: string;
|
||||
cipherType: CipherType;
|
||||
ivCheck: boolean;
|
||||
}
|
||||
|
||||
export interface ServerConfig {
|
||||
$type: "xray.proxy.shadowsocks.ServerConfig";
|
||||
users: User[];
|
||||
network: Network[];
|
||||
}
|
||||
|
||||
export interface ClientConfig {
|
||||
$type: "xray.proxy.shadowsocks.ClientConfig";
|
||||
server: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.shadowsocks.Account", password: "", cipherType: 0, ivCheck: false };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.shadowsocks.Account"> = {
|
||||
$type: "xray.proxy.shadowsocks.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.password !== "") {
|
||||
writer.uint32(10).string(message.password);
|
||||
}
|
||||
if (message.cipherType !== 0) {
|
||||
writer.uint32(16).int32(message.cipherType);
|
||||
}
|
||||
if (message.ivCheck !== false) {
|
||||
writer.uint32(24).bool(message.ivCheck);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.cipherType = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ivCheck = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return {
|
||||
$type: Account.$type,
|
||||
password: isSet(object.password) ? globalThis.String(object.password) : "",
|
||||
cipherType: isSet(object.cipherType) ? cipherTypeFromJSON(object.cipherType) : 0,
|
||||
ivCheck: isSet(object.ivCheck) ? globalThis.Boolean(object.ivCheck) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.password !== "") {
|
||||
obj.password = message.password;
|
||||
}
|
||||
if (message.cipherType !== 0) {
|
||||
obj.cipherType = cipherTypeToJSON(message.cipherType);
|
||||
}
|
||||
if (message.ivCheck !== false) {
|
||||
obj.ivCheck = message.ivCheck;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.password = object.password ?? "";
|
||||
message.cipherType = object.cipherType ?? 0;
|
||||
message.ivCheck = object.ivCheck ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
function createBaseServerConfig(): ServerConfig {
|
||||
return { $type: "xray.proxy.shadowsocks.ServerConfig", users: [], network: [] };
|
||||
}
|
||||
|
||||
export const ServerConfig: MessageFns<ServerConfig, "xray.proxy.shadowsocks.ServerConfig"> = {
|
||||
$type: "xray.proxy.shadowsocks.ServerConfig" as const,
|
||||
|
||||
encode(message: ServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.users) {
|
||||
User.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
writer.uint32(18).fork();
|
||||
for (const v of message.network) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.users.push(User.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag === 16) {
|
||||
message.network.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 18) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.network.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig {
|
||||
return {
|
||||
$type: ServerConfig.$type,
|
||||
users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [],
|
||||
network: globalThis.Array.isArray(object?.network) ? object.network.map((e: any) => networkFromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.users?.length) {
|
||||
obj.users = message.users.map((e) => User.toJSON(e));
|
||||
}
|
||||
if (message.network?.length) {
|
||||
obj.network = message.network.map((e) => networkToJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig>): ServerConfig {
|
||||
return ServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig>): ServerConfig {
|
||||
const message = createBaseServerConfig();
|
||||
message.users = object.users?.map((e) => User.fromPartial(e)) || [];
|
||||
message.network = object.network?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig.$type, ServerConfig);
|
||||
|
||||
function createBaseClientConfig(): ClientConfig {
|
||||
return { $type: "xray.proxy.shadowsocks.ClientConfig", server: undefined };
|
||||
}
|
||||
|
||||
export const ClientConfig: MessageFns<ClientConfig, "xray.proxy.shadowsocks.ClientConfig"> = {
|
||||
$type: "xray.proxy.shadowsocks.ClientConfig" as const,
|
||||
|
||||
encode(message: ClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ClientConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseClientConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ClientConfig {
|
||||
return {
|
||||
$type: ClientConfig.$type,
|
||||
server: isSet(object.server) ? ServerEndpoint.fromJSON(object.server) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ClientConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = ServerEndpoint.toJSON(message.server);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ClientConfig>): ClientConfig {
|
||||
return ClientConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ClientConfig>): ClientConfig {
|
||||
const message = createBaseClientConfig();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? ServerEndpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ClientConfig.$type, ClientConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
836
src/proto/proxy/shadowsocks_2022/config.ts
Normal file
836
src/proto/proxy/shadowsocks_2022/config.ts
Normal file
|
|
@ -0,0 +1,836 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/shadowsocks_2022/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { IPOrDomain } from "../../common/net/address";
|
||||
import { Network, networkFromJSON, networkToJSON } from "../../common/net/network";
|
||||
import { User } from "../../common/protocol/user";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.shadowsocks_2022";
|
||||
|
||||
export interface ServerConfig {
|
||||
$type: "xray.proxy.shadowsocks_2022.ServerConfig";
|
||||
method: string;
|
||||
key: string;
|
||||
email: string;
|
||||
level: number;
|
||||
network: Network[];
|
||||
}
|
||||
|
||||
export interface MultiUserServerConfig {
|
||||
$type: "xray.proxy.shadowsocks_2022.MultiUserServerConfig";
|
||||
method: string;
|
||||
key: string;
|
||||
users: User[];
|
||||
network: Network[];
|
||||
}
|
||||
|
||||
export interface RelayDestination {
|
||||
$type: "xray.proxy.shadowsocks_2022.RelayDestination";
|
||||
key: string;
|
||||
address: IPOrDomain | undefined;
|
||||
port: number;
|
||||
email: string;
|
||||
level: number;
|
||||
}
|
||||
|
||||
export interface RelayServerConfig {
|
||||
$type: "xray.proxy.shadowsocks_2022.RelayServerConfig";
|
||||
method: string;
|
||||
key: string;
|
||||
destinations: RelayDestination[];
|
||||
network: Network[];
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.shadowsocks_2022.Account";
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface ClientConfig {
|
||||
$type: "xray.proxy.shadowsocks_2022.ClientConfig";
|
||||
address: IPOrDomain | undefined;
|
||||
port: number;
|
||||
method: string;
|
||||
key: string;
|
||||
udpOverTcp: boolean;
|
||||
udpOverTcpVersion: number;
|
||||
}
|
||||
|
||||
function createBaseServerConfig(): ServerConfig {
|
||||
return { $type: "xray.proxy.shadowsocks_2022.ServerConfig", method: "", key: "", email: "", level: 0, network: [] };
|
||||
}
|
||||
|
||||
export const ServerConfig: MessageFns<ServerConfig, "xray.proxy.shadowsocks_2022.ServerConfig"> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.ServerConfig" as const,
|
||||
|
||||
encode(message: ServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.method !== "") {
|
||||
writer.uint32(10).string(message.method);
|
||||
}
|
||||
if (message.key !== "") {
|
||||
writer.uint32(18).string(message.key);
|
||||
}
|
||||
if (message.email !== "") {
|
||||
writer.uint32(26).string(message.email);
|
||||
}
|
||||
if (message.level !== 0) {
|
||||
writer.uint32(32).int32(message.level);
|
||||
}
|
||||
writer.uint32(42).fork();
|
||||
for (const v of message.network) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.method = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.email = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.level = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag === 40) {
|
||||
message.network.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 42) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.network.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig {
|
||||
return {
|
||||
$type: ServerConfig.$type,
|
||||
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
||||
level: isSet(object.level) ? globalThis.Number(object.level) : 0,
|
||||
network: globalThis.Array.isArray(object?.network) ? object.network.map((e: any) => networkFromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.method !== "") {
|
||||
obj.method = message.method;
|
||||
}
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.email !== "") {
|
||||
obj.email = message.email;
|
||||
}
|
||||
if (message.level !== 0) {
|
||||
obj.level = Math.round(message.level);
|
||||
}
|
||||
if (message.network?.length) {
|
||||
obj.network = message.network.map((e) => networkToJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig>): ServerConfig {
|
||||
return ServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig>): ServerConfig {
|
||||
const message = createBaseServerConfig();
|
||||
message.method = object.method ?? "";
|
||||
message.key = object.key ?? "";
|
||||
message.email = object.email ?? "";
|
||||
message.level = object.level ?? 0;
|
||||
message.network = object.network?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig.$type, ServerConfig);
|
||||
|
||||
function createBaseMultiUserServerConfig(): MultiUserServerConfig {
|
||||
return { $type: "xray.proxy.shadowsocks_2022.MultiUserServerConfig", method: "", key: "", users: [], network: [] };
|
||||
}
|
||||
|
||||
export const MultiUserServerConfig: MessageFns<
|
||||
MultiUserServerConfig,
|
||||
"xray.proxy.shadowsocks_2022.MultiUserServerConfig"
|
||||
> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.MultiUserServerConfig" as const,
|
||||
|
||||
encode(message: MultiUserServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.method !== "") {
|
||||
writer.uint32(10).string(message.method);
|
||||
}
|
||||
if (message.key !== "") {
|
||||
writer.uint32(18).string(message.key);
|
||||
}
|
||||
for (const v of message.users) {
|
||||
User.encode(v!, writer.uint32(26).fork()).join();
|
||||
}
|
||||
writer.uint32(34).fork();
|
||||
for (const v of message.network) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): MultiUserServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMultiUserServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.method = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.users.push(User.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag === 32) {
|
||||
message.network.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 34) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.network.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MultiUserServerConfig {
|
||||
return {
|
||||
$type: MultiUserServerConfig.$type,
|
||||
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [],
|
||||
network: globalThis.Array.isArray(object?.network) ? object.network.map((e: any) => networkFromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MultiUserServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.method !== "") {
|
||||
obj.method = message.method;
|
||||
}
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.users?.length) {
|
||||
obj.users = message.users.map((e) => User.toJSON(e));
|
||||
}
|
||||
if (message.network?.length) {
|
||||
obj.network = message.network.map((e) => networkToJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<MultiUserServerConfig>): MultiUserServerConfig {
|
||||
return MultiUserServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<MultiUserServerConfig>): MultiUserServerConfig {
|
||||
const message = createBaseMultiUserServerConfig();
|
||||
message.method = object.method ?? "";
|
||||
message.key = object.key ?? "";
|
||||
message.users = object.users?.map((e) => User.fromPartial(e)) || [];
|
||||
message.network = object.network?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(MultiUserServerConfig.$type, MultiUserServerConfig);
|
||||
|
||||
function createBaseRelayDestination(): RelayDestination {
|
||||
return {
|
||||
$type: "xray.proxy.shadowsocks_2022.RelayDestination",
|
||||
key: "",
|
||||
address: undefined,
|
||||
port: 0,
|
||||
email: "",
|
||||
level: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const RelayDestination: MessageFns<RelayDestination, "xray.proxy.shadowsocks_2022.RelayDestination"> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.RelayDestination" as const,
|
||||
|
||||
encode(message: RelayDestination, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
writer.uint32(24).uint32(message.port);
|
||||
}
|
||||
if (message.email !== "") {
|
||||
writer.uint32(34).string(message.email);
|
||||
}
|
||||
if (message.level !== 0) {
|
||||
writer.uint32(40).int32(message.level);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RelayDestination {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRelayDestination();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.port = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.email = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.level = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RelayDestination {
|
||||
return {
|
||||
$type: RelayDestination.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
||||
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
||||
level: isSet(object.level) ? globalThis.Number(object.level) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RelayDestination): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
obj.port = Math.round(message.port);
|
||||
}
|
||||
if (message.email !== "") {
|
||||
obj.email = message.email;
|
||||
}
|
||||
if (message.level !== 0) {
|
||||
obj.level = Math.round(message.level);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RelayDestination>): RelayDestination {
|
||||
return RelayDestination.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<RelayDestination>): RelayDestination {
|
||||
const message = createBaseRelayDestination();
|
||||
message.key = object.key ?? "";
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.port = object.port ?? 0;
|
||||
message.email = object.email ?? "";
|
||||
message.level = object.level ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RelayDestination.$type, RelayDestination);
|
||||
|
||||
function createBaseRelayServerConfig(): RelayServerConfig {
|
||||
return { $type: "xray.proxy.shadowsocks_2022.RelayServerConfig", method: "", key: "", destinations: [], network: [] };
|
||||
}
|
||||
|
||||
export const RelayServerConfig: MessageFns<RelayServerConfig, "xray.proxy.shadowsocks_2022.RelayServerConfig"> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.RelayServerConfig" as const,
|
||||
|
||||
encode(message: RelayServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.method !== "") {
|
||||
writer.uint32(10).string(message.method);
|
||||
}
|
||||
if (message.key !== "") {
|
||||
writer.uint32(18).string(message.key);
|
||||
}
|
||||
for (const v of message.destinations) {
|
||||
RelayDestination.encode(v!, writer.uint32(26).fork()).join();
|
||||
}
|
||||
writer.uint32(34).fork();
|
||||
for (const v of message.network) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RelayServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRelayServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.method = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.destinations.push(RelayDestination.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag === 32) {
|
||||
message.network.push(reader.int32() as any);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 34) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.network.push(reader.int32() as any);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RelayServerConfig {
|
||||
return {
|
||||
$type: RelayServerConfig.$type,
|
||||
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
destinations: globalThis.Array.isArray(object?.destinations)
|
||||
? object.destinations.map((e: any) => RelayDestination.fromJSON(e))
|
||||
: [],
|
||||
network: globalThis.Array.isArray(object?.network) ? object.network.map((e: any) => networkFromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RelayServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.method !== "") {
|
||||
obj.method = message.method;
|
||||
}
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.destinations?.length) {
|
||||
obj.destinations = message.destinations.map((e) => RelayDestination.toJSON(e));
|
||||
}
|
||||
if (message.network?.length) {
|
||||
obj.network = message.network.map((e) => networkToJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RelayServerConfig>): RelayServerConfig {
|
||||
return RelayServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<RelayServerConfig>): RelayServerConfig {
|
||||
const message = createBaseRelayServerConfig();
|
||||
message.method = object.method ?? "";
|
||||
message.key = object.key ?? "";
|
||||
message.destinations = object.destinations?.map((e) => RelayDestination.fromPartial(e)) || [];
|
||||
message.network = object.network?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RelayServerConfig.$type, RelayServerConfig);
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.shadowsocks_2022.Account", key: "" };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.shadowsocks_2022.Account"> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return { $type: Account.$type, key: isSet(object.key) ? globalThis.String(object.key) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.key = object.key ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
function createBaseClientConfig(): ClientConfig {
|
||||
return {
|
||||
$type: "xray.proxy.shadowsocks_2022.ClientConfig",
|
||||
address: undefined,
|
||||
port: 0,
|
||||
method: "",
|
||||
key: "",
|
||||
udpOverTcp: false,
|
||||
udpOverTcpVersion: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const ClientConfig: MessageFns<ClientConfig, "xray.proxy.shadowsocks_2022.ClientConfig"> = {
|
||||
$type: "xray.proxy.shadowsocks_2022.ClientConfig" as const,
|
||||
|
||||
encode(message: ClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
writer.uint32(16).uint32(message.port);
|
||||
}
|
||||
if (message.method !== "") {
|
||||
writer.uint32(26).string(message.method);
|
||||
}
|
||||
if (message.key !== "") {
|
||||
writer.uint32(34).string(message.key);
|
||||
}
|
||||
if (message.udpOverTcp !== false) {
|
||||
writer.uint32(40).bool(message.udpOverTcp);
|
||||
}
|
||||
if (message.udpOverTcpVersion !== 0) {
|
||||
writer.uint32(48).uint32(message.udpOverTcpVersion);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ClientConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseClientConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.port = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.method = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.udpOverTcp = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.udpOverTcpVersion = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ClientConfig {
|
||||
return {
|
||||
$type: ClientConfig.$type,
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
port: isSet(object.port) ? globalThis.Number(object.port) : 0,
|
||||
method: isSet(object.method) ? globalThis.String(object.method) : "",
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
udpOverTcp: isSet(object.udpOverTcp) ? globalThis.Boolean(object.udpOverTcp) : false,
|
||||
udpOverTcpVersion: isSet(object.udpOverTcpVersion) ? globalThis.Number(object.udpOverTcpVersion) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ClientConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.port !== 0) {
|
||||
obj.port = Math.round(message.port);
|
||||
}
|
||||
if (message.method !== "") {
|
||||
obj.method = message.method;
|
||||
}
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.udpOverTcp !== false) {
|
||||
obj.udpOverTcp = message.udpOverTcp;
|
||||
}
|
||||
if (message.udpOverTcpVersion !== 0) {
|
||||
obj.udpOverTcpVersion = Math.round(message.udpOverTcpVersion);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ClientConfig>): ClientConfig {
|
||||
return ClientConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ClientConfig>): ClientConfig {
|
||||
const message = createBaseClientConfig();
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.port = object.port ?? 0;
|
||||
message.method = object.method ?? "";
|
||||
message.key = object.key ?? "";
|
||||
message.udpOverTcp = object.udpOverTcp ?? false;
|
||||
message.udpOverTcpVersion = object.udpOverTcpVersion ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ClientConfig.$type, ClientConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
504
src/proto/proxy/socks/config.ts
Normal file
504
src/proto/proxy/socks/config.ts
Normal file
|
|
@ -0,0 +1,504 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/socks/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { IPOrDomain } from "../../common/net/address";
|
||||
import { ServerEndpoint } from "../../common/protocol/server_spec";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.socks";
|
||||
|
||||
/** AuthType is the authentication type of Socks proxy. */
|
||||
export enum AuthType {
|
||||
/** NO_AUTH - NO_AUTH is for anonymous authentication. */
|
||||
NO_AUTH = 0,
|
||||
/** PASSWORD - PASSWORD is for username/password authentication. */
|
||||
PASSWORD = 1,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function authTypeFromJSON(object: any): AuthType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "NO_AUTH":
|
||||
return AuthType.NO_AUTH;
|
||||
case 1:
|
||||
case "PASSWORD":
|
||||
return AuthType.PASSWORD;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return AuthType.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function authTypeToJSON(object: AuthType): string {
|
||||
switch (object) {
|
||||
case AuthType.NO_AUTH:
|
||||
return "NO_AUTH";
|
||||
case AuthType.PASSWORD:
|
||||
return "PASSWORD";
|
||||
case AuthType.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
/** Account represents a Socks account. */
|
||||
export interface Account {
|
||||
$type: "xray.proxy.socks.Account";
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** ServerConfig is the protobuf config for Socks server. */
|
||||
export interface ServerConfig {
|
||||
$type: "xray.proxy.socks.ServerConfig";
|
||||
authType: AuthType;
|
||||
accounts: { [key: string]: string };
|
||||
address: IPOrDomain | undefined;
|
||||
udpEnabled: boolean;
|
||||
userLevel: number;
|
||||
}
|
||||
|
||||
export interface ServerConfig_AccountsEntry {
|
||||
$type: "xray.proxy.socks.ServerConfig.AccountsEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/** ClientConfig is the protobuf config for Socks client. */
|
||||
export interface ClientConfig {
|
||||
$type: "xray.proxy.socks.ClientConfig";
|
||||
/** Sever is a list of Socks server addresses. */
|
||||
server: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.socks.Account", username: "", password: "" };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.socks.Account"> = {
|
||||
$type: "xray.proxy.socks.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.username !== "") {
|
||||
writer.uint32(10).string(message.username);
|
||||
}
|
||||
if (message.password !== "") {
|
||||
writer.uint32(18).string(message.password);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.username = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return {
|
||||
$type: Account.$type,
|
||||
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
||||
password: isSet(object.password) ? globalThis.String(object.password) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.username !== "") {
|
||||
obj.username = message.username;
|
||||
}
|
||||
if (message.password !== "") {
|
||||
obj.password = message.password;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.username = object.username ?? "";
|
||||
message.password = object.password ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
function createBaseServerConfig(): ServerConfig {
|
||||
return {
|
||||
$type: "xray.proxy.socks.ServerConfig",
|
||||
authType: 0,
|
||||
accounts: {},
|
||||
address: undefined,
|
||||
udpEnabled: false,
|
||||
userLevel: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const ServerConfig: MessageFns<ServerConfig, "xray.proxy.socks.ServerConfig"> = {
|
||||
$type: "xray.proxy.socks.ServerConfig" as const,
|
||||
|
||||
encode(message: ServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.authType !== 0) {
|
||||
writer.uint32(8).int32(message.authType);
|
||||
}
|
||||
globalThis.Object.entries(message.accounts).forEach(([key, value]: [string, string]) => {
|
||||
ServerConfig_AccountsEntry.encode({
|
||||
$type: "xray.proxy.socks.ServerConfig.AccountsEntry",
|
||||
key: key as any,
|
||||
value,
|
||||
}, writer.uint32(18).fork()).join();
|
||||
});
|
||||
if (message.address !== undefined) {
|
||||
IPOrDomain.encode(message.address, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.udpEnabled !== false) {
|
||||
writer.uint32(32).bool(message.udpEnabled);
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
writer.uint32(48).uint32(message.userLevel);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.authType = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry2 = ServerConfig_AccountsEntry.decode(reader, reader.uint32());
|
||||
if (entry2.value !== undefined) {
|
||||
message.accounts[entry2.key] = entry2.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.address = IPOrDomain.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.udpEnabled = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userLevel = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig {
|
||||
return {
|
||||
$type: ServerConfig.$type,
|
||||
authType: isSet(object.authType) ? authTypeFromJSON(object.authType) : 0,
|
||||
accounts: isObject(object.accounts)
|
||||
? (globalThis.Object.entries(object.accounts) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
address: isSet(object.address) ? IPOrDomain.fromJSON(object.address) : undefined,
|
||||
udpEnabled: isSet(object.udpEnabled) ? globalThis.Boolean(object.udpEnabled) : false,
|
||||
userLevel: isSet(object.userLevel) ? globalThis.Number(object.userLevel) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.authType !== 0) {
|
||||
obj.authType = authTypeToJSON(message.authType);
|
||||
}
|
||||
if (message.accounts) {
|
||||
const entries = globalThis.Object.entries(message.accounts) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.accounts = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.accounts[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.address !== undefined) {
|
||||
obj.address = IPOrDomain.toJSON(message.address);
|
||||
}
|
||||
if (message.udpEnabled !== false) {
|
||||
obj.udpEnabled = message.udpEnabled;
|
||||
}
|
||||
if (message.userLevel !== 0) {
|
||||
obj.userLevel = Math.round(message.userLevel);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig>): ServerConfig {
|
||||
return ServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig>): ServerConfig {
|
||||
const message = createBaseServerConfig();
|
||||
message.authType = object.authType ?? 0;
|
||||
message.accounts = (globalThis.Object.entries(object.accounts ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.address = (object.address !== undefined && object.address !== null)
|
||||
? IPOrDomain.fromPartial(object.address)
|
||||
: undefined;
|
||||
message.udpEnabled = object.udpEnabled ?? false;
|
||||
message.userLevel = object.userLevel ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig.$type, ServerConfig);
|
||||
|
||||
function createBaseServerConfig_AccountsEntry(): ServerConfig_AccountsEntry {
|
||||
return { $type: "xray.proxy.socks.ServerConfig.AccountsEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const ServerConfig_AccountsEntry: MessageFns<
|
||||
ServerConfig_AccountsEntry,
|
||||
"xray.proxy.socks.ServerConfig.AccountsEntry"
|
||||
> = {
|
||||
$type: "xray.proxy.socks.ServerConfig.AccountsEntry" as const,
|
||||
|
||||
encode(message: ServerConfig_AccountsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig_AccountsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig_AccountsEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig_AccountsEntry {
|
||||
return {
|
||||
$type: ServerConfig_AccountsEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig_AccountsEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig_AccountsEntry>): ServerConfig_AccountsEntry {
|
||||
return ServerConfig_AccountsEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig_AccountsEntry>): ServerConfig_AccountsEntry {
|
||||
const message = createBaseServerConfig_AccountsEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig_AccountsEntry.$type, ServerConfig_AccountsEntry);
|
||||
|
||||
function createBaseClientConfig(): ClientConfig {
|
||||
return { $type: "xray.proxy.socks.ClientConfig", server: undefined };
|
||||
}
|
||||
|
||||
export const ClientConfig: MessageFns<ClientConfig, "xray.proxy.socks.ClientConfig"> = {
|
||||
$type: "xray.proxy.socks.ClientConfig" as const,
|
||||
|
||||
encode(message: ClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ClientConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseClientConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ClientConfig {
|
||||
return {
|
||||
$type: ClientConfig.$type,
|
||||
server: isSet(object.server) ? ServerEndpoint.fromJSON(object.server) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ClientConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = ServerEndpoint.toJSON(message.server);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ClientConfig>): ClientConfig {
|
||||
return ClientConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ClientConfig>): ClientConfig {
|
||||
const message = createBaseClientConfig();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? ServerEndpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ClientConfig.$type, ClientConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
429
src/proto/proxy/trojan/config.ts
Normal file
429
src/proto/proxy/trojan/config.ts
Normal file
|
|
@ -0,0 +1,429 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/trojan/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ServerEndpoint } from "../../common/protocol/server_spec";
|
||||
import { User } from "../../common/protocol/user";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.trojan";
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.trojan.Account";
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface Fallback {
|
||||
$type: "xray.proxy.trojan.Fallback";
|
||||
name: string;
|
||||
alpn: string;
|
||||
path: string;
|
||||
type: string;
|
||||
dest: string;
|
||||
xver: number;
|
||||
}
|
||||
|
||||
export interface ClientConfig {
|
||||
$type: "xray.proxy.trojan.ClientConfig";
|
||||
server: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
export interface ServerConfig {
|
||||
$type: "xray.proxy.trojan.ServerConfig";
|
||||
users: User[];
|
||||
fallbacks: Fallback[];
|
||||
}
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.trojan.Account", password: "" };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.trojan.Account"> = {
|
||||
$type: "xray.proxy.trojan.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.password !== "") {
|
||||
writer.uint32(10).string(message.password);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return { $type: Account.$type, password: isSet(object.password) ? globalThis.String(object.password) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.password !== "") {
|
||||
obj.password = message.password;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.password = object.password ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
function createBaseFallback(): Fallback {
|
||||
return { $type: "xray.proxy.trojan.Fallback", name: "", alpn: "", path: "", type: "", dest: "", xver: 0 };
|
||||
}
|
||||
|
||||
export const Fallback: MessageFns<Fallback, "xray.proxy.trojan.Fallback"> = {
|
||||
$type: "xray.proxy.trojan.Fallback" as const,
|
||||
|
||||
encode(message: Fallback, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.alpn !== "") {
|
||||
writer.uint32(18).string(message.alpn);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(26).string(message.path);
|
||||
}
|
||||
if (message.type !== "") {
|
||||
writer.uint32(34).string(message.type);
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
writer.uint32(42).string(message.dest);
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
writer.uint32(48).uint64(message.xver);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Fallback {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFallback();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.alpn = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.path = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.dest = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xver = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Fallback {
|
||||
return {
|
||||
$type: Fallback.$type,
|
||||
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
||||
alpn: isSet(object.alpn) ? globalThis.String(object.alpn) : "",
|
||||
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
||||
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
||||
dest: isSet(object.dest) ? globalThis.String(object.dest) : "",
|
||||
xver: isSet(object.xver) ? globalThis.Number(object.xver) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Fallback): unknown {
|
||||
const obj: any = {};
|
||||
if (message.name !== "") {
|
||||
obj.name = message.name;
|
||||
}
|
||||
if (message.alpn !== "") {
|
||||
obj.alpn = message.alpn;
|
||||
}
|
||||
if (message.path !== "") {
|
||||
obj.path = message.path;
|
||||
}
|
||||
if (message.type !== "") {
|
||||
obj.type = message.type;
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
obj.dest = message.dest;
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
obj.xver = Math.round(message.xver);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Fallback>): Fallback {
|
||||
return Fallback.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Fallback>): Fallback {
|
||||
const message = createBaseFallback();
|
||||
message.name = object.name ?? "";
|
||||
message.alpn = object.alpn ?? "";
|
||||
message.path = object.path ?? "";
|
||||
message.type = object.type ?? "";
|
||||
message.dest = object.dest ?? "";
|
||||
message.xver = object.xver ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Fallback.$type, Fallback);
|
||||
|
||||
function createBaseClientConfig(): ClientConfig {
|
||||
return { $type: "xray.proxy.trojan.ClientConfig", server: undefined };
|
||||
}
|
||||
|
||||
export const ClientConfig: MessageFns<ClientConfig, "xray.proxy.trojan.ClientConfig"> = {
|
||||
$type: "xray.proxy.trojan.ClientConfig" as const,
|
||||
|
||||
encode(message: ClientConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.server !== undefined) {
|
||||
ServerEndpoint.encode(message.server, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ClientConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseClientConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.server = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ClientConfig {
|
||||
return {
|
||||
$type: ClientConfig.$type,
|
||||
server: isSet(object.server) ? ServerEndpoint.fromJSON(object.server) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ClientConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.server !== undefined) {
|
||||
obj.server = ServerEndpoint.toJSON(message.server);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ClientConfig>): ClientConfig {
|
||||
return ClientConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ClientConfig>): ClientConfig {
|
||||
const message = createBaseClientConfig();
|
||||
message.server = (object.server !== undefined && object.server !== null)
|
||||
? ServerEndpoint.fromPartial(object.server)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ClientConfig.$type, ClientConfig);
|
||||
|
||||
function createBaseServerConfig(): ServerConfig {
|
||||
return { $type: "xray.proxy.trojan.ServerConfig", users: [], fallbacks: [] };
|
||||
}
|
||||
|
||||
export const ServerConfig: MessageFns<ServerConfig, "xray.proxy.trojan.ServerConfig"> = {
|
||||
$type: "xray.proxy.trojan.ServerConfig" as const,
|
||||
|
||||
encode(message: ServerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.users) {
|
||||
User.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
for (const v of message.fallbacks) {
|
||||
Fallback.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ServerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseServerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.users.push(User.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.fallbacks.push(Fallback.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ServerConfig {
|
||||
return {
|
||||
$type: ServerConfig.$type,
|
||||
users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [],
|
||||
fallbacks: globalThis.Array.isArray(object?.fallbacks)
|
||||
? object.fallbacks.map((e: any) => Fallback.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ServerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.users?.length) {
|
||||
obj.users = message.users.map((e) => User.toJSON(e));
|
||||
}
|
||||
if (message.fallbacks?.length) {
|
||||
obj.fallbacks = message.fallbacks.map((e) => Fallback.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ServerConfig>): ServerConfig {
|
||||
return ServerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ServerConfig>): ServerConfig {
|
||||
const message = createBaseServerConfig();
|
||||
message.users = object.users?.map((e) => User.fromPartial(e)) || [];
|
||||
message.fallbacks = object.fallbacks?.map((e) => Fallback.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ServerConfig.$type, ServerConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
333
src/proto/proxy/vless/account.ts
Normal file
333
src/proto/proxy/vless/account.ts
Normal file
|
|
@ -0,0 +1,333 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vless/account.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vless";
|
||||
|
||||
export interface Reverse {
|
||||
$type: "xray.proxy.vless.Reverse";
|
||||
tag: string;
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.vless.Account";
|
||||
/** ID of the account, in the form of a UUID, e.g., "66ad4540-b58c-4ad2-9926-ea63445a9b57". */
|
||||
id: string;
|
||||
/** Flow settings. May be "xtls-rprx-vision". */
|
||||
flow: string;
|
||||
encryption: string;
|
||||
xorMode: number;
|
||||
seconds: number;
|
||||
padding: string;
|
||||
reverse: Reverse | undefined;
|
||||
testpre: number;
|
||||
testseed: number[];
|
||||
}
|
||||
|
||||
function createBaseReverse(): Reverse {
|
||||
return { $type: "xray.proxy.vless.Reverse", tag: "" };
|
||||
}
|
||||
|
||||
export const Reverse: MessageFns<Reverse, "xray.proxy.vless.Reverse"> = {
|
||||
$type: "xray.proxy.vless.Reverse" as const,
|
||||
|
||||
encode(message: Reverse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.tag !== "") {
|
||||
writer.uint32(10).string(message.tag);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Reverse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseReverse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tag = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Reverse {
|
||||
return { $type: Reverse.$type, tag: isSet(object.tag) ? globalThis.String(object.tag) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Reverse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tag !== "") {
|
||||
obj.tag = message.tag;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Reverse>): Reverse {
|
||||
return Reverse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Reverse>): Reverse {
|
||||
const message = createBaseReverse();
|
||||
message.tag = object.tag ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Reverse.$type, Reverse);
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return {
|
||||
$type: "xray.proxy.vless.Account",
|
||||
id: "",
|
||||
flow: "",
|
||||
encryption: "",
|
||||
xorMode: 0,
|
||||
seconds: 0,
|
||||
padding: "",
|
||||
reverse: undefined,
|
||||
testpre: 0,
|
||||
testseed: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.vless.Account"> = {
|
||||
$type: "xray.proxy.vless.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.flow !== "") {
|
||||
writer.uint32(18).string(message.flow);
|
||||
}
|
||||
if (message.encryption !== "") {
|
||||
writer.uint32(26).string(message.encryption);
|
||||
}
|
||||
if (message.xorMode !== 0) {
|
||||
writer.uint32(32).uint32(message.xorMode);
|
||||
}
|
||||
if (message.seconds !== 0) {
|
||||
writer.uint32(40).uint32(message.seconds);
|
||||
}
|
||||
if (message.padding !== "") {
|
||||
writer.uint32(50).string(message.padding);
|
||||
}
|
||||
if (message.reverse !== undefined) {
|
||||
Reverse.encode(message.reverse, writer.uint32(58).fork()).join();
|
||||
}
|
||||
if (message.testpre !== 0) {
|
||||
writer.uint32(64).uint32(message.testpre);
|
||||
}
|
||||
writer.uint32(74).fork();
|
||||
for (const v of message.testseed) {
|
||||
writer.uint32(v);
|
||||
}
|
||||
writer.join();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.id = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.flow = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.encryption = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xorMode = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.seconds = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.padding = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.reverse = Reverse.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.testpre = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag === 72) {
|
||||
message.testseed.push(reader.uint32());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 74) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.testseed.push(reader.uint32());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return {
|
||||
$type: Account.$type,
|
||||
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
||||
flow: isSet(object.flow) ? globalThis.String(object.flow) : "",
|
||||
encryption: isSet(object.encryption) ? globalThis.String(object.encryption) : "",
|
||||
xorMode: isSet(object.xorMode) ? globalThis.Number(object.xorMode) : 0,
|
||||
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
||||
padding: isSet(object.padding) ? globalThis.String(object.padding) : "",
|
||||
reverse: isSet(object.reverse) ? Reverse.fromJSON(object.reverse) : undefined,
|
||||
testpre: isSet(object.testpre) ? globalThis.Number(object.testpre) : 0,
|
||||
testseed: globalThis.Array.isArray(object?.testseed) ? object.testseed.map((e: any) => globalThis.Number(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== "") {
|
||||
obj.id = message.id;
|
||||
}
|
||||
if (message.flow !== "") {
|
||||
obj.flow = message.flow;
|
||||
}
|
||||
if (message.encryption !== "") {
|
||||
obj.encryption = message.encryption;
|
||||
}
|
||||
if (message.xorMode !== 0) {
|
||||
obj.xorMode = Math.round(message.xorMode);
|
||||
}
|
||||
if (message.seconds !== 0) {
|
||||
obj.seconds = Math.round(message.seconds);
|
||||
}
|
||||
if (message.padding !== "") {
|
||||
obj.padding = message.padding;
|
||||
}
|
||||
if (message.reverse !== undefined) {
|
||||
obj.reverse = Reverse.toJSON(message.reverse);
|
||||
}
|
||||
if (message.testpre !== 0) {
|
||||
obj.testpre = Math.round(message.testpre);
|
||||
}
|
||||
if (message.testseed?.length) {
|
||||
obj.testseed = message.testseed.map((e) => Math.round(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.id = object.id ?? "";
|
||||
message.flow = object.flow ?? "";
|
||||
message.encryption = object.encryption ?? "";
|
||||
message.xorMode = object.xorMode ?? 0;
|
||||
message.seconds = object.seconds ?? 0;
|
||||
message.padding = object.padding ?? "";
|
||||
message.reverse = (object.reverse !== undefined && object.reverse !== null)
|
||||
? Reverse.fromPartial(object.reverse)
|
||||
: undefined;
|
||||
message.testpre = object.testpre ?? 0;
|
||||
message.testseed = object.testseed?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
145
src/proto/proxy/vless/encoding/addons.ts
Normal file
145
src/proto/proxy/vless/encoding/addons.ts
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vless/encoding/addons.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vless.encoding";
|
||||
|
||||
export interface Addons {
|
||||
$type: "xray.proxy.vless.encoding.Addons";
|
||||
Flow: string;
|
||||
Seed: Uint8Array;
|
||||
}
|
||||
|
||||
function createBaseAddons(): Addons {
|
||||
return { $type: "xray.proxy.vless.encoding.Addons", Flow: "", Seed: new Uint8Array(0) };
|
||||
}
|
||||
|
||||
export const Addons: MessageFns<Addons, "xray.proxy.vless.encoding.Addons"> = {
|
||||
$type: "xray.proxy.vless.encoding.Addons" as const,
|
||||
|
||||
encode(message: Addons, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.Flow !== "") {
|
||||
writer.uint32(10).string(message.Flow);
|
||||
}
|
||||
if (message.Seed.length !== 0) {
|
||||
writer.uint32(18).bytes(message.Seed);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Addons {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAddons();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.Flow = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.Seed = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Addons {
|
||||
return {
|
||||
$type: Addons.$type,
|
||||
Flow: isSet(object.Flow) ? globalThis.String(object.Flow) : "",
|
||||
Seed: isSet(object.Seed) ? bytesFromBase64(object.Seed) : new Uint8Array(0),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Addons): unknown {
|
||||
const obj: any = {};
|
||||
if (message.Flow !== "") {
|
||||
obj.Flow = message.Flow;
|
||||
}
|
||||
if (message.Seed.length !== 0) {
|
||||
obj.Seed = base64FromBytes(message.Seed);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Addons>): Addons {
|
||||
return Addons.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Addons>): Addons {
|
||||
const message = createBaseAddons();
|
||||
message.Flow = object.Flow ?? "";
|
||||
message.Seed = object.Seed ?? new Uint8Array(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Addons.$type, Addons);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
383
src/proto/proxy/vless/inbound/config.ts
Normal file
383
src/proto/proxy/vless/inbound/config.ts
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vless/inbound/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { User } from "../../../common/protocol/user";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vless.inbound";
|
||||
|
||||
export interface Fallback {
|
||||
$type: "xray.proxy.vless.inbound.Fallback";
|
||||
name: string;
|
||||
alpn: string;
|
||||
path: string;
|
||||
type: string;
|
||||
dest: string;
|
||||
xver: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.vless.inbound.Config";
|
||||
clients: User[];
|
||||
fallbacks: Fallback[];
|
||||
decryption: string;
|
||||
xorMode: number;
|
||||
secondsFrom: number;
|
||||
secondsTo: number;
|
||||
padding: string;
|
||||
}
|
||||
|
||||
function createBaseFallback(): Fallback {
|
||||
return { $type: "xray.proxy.vless.inbound.Fallback", name: "", alpn: "", path: "", type: "", dest: "", xver: 0 };
|
||||
}
|
||||
|
||||
export const Fallback: MessageFns<Fallback, "xray.proxy.vless.inbound.Fallback"> = {
|
||||
$type: "xray.proxy.vless.inbound.Fallback" as const,
|
||||
|
||||
encode(message: Fallback, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.alpn !== "") {
|
||||
writer.uint32(18).string(message.alpn);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(26).string(message.path);
|
||||
}
|
||||
if (message.type !== "") {
|
||||
writer.uint32(34).string(message.type);
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
writer.uint32(42).string(message.dest);
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
writer.uint32(48).uint64(message.xver);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Fallback {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFallback();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.alpn = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.path = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.dest = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xver = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Fallback {
|
||||
return {
|
||||
$type: Fallback.$type,
|
||||
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
||||
alpn: isSet(object.alpn) ? globalThis.String(object.alpn) : "",
|
||||
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
||||
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
||||
dest: isSet(object.dest) ? globalThis.String(object.dest) : "",
|
||||
xver: isSet(object.xver) ? globalThis.Number(object.xver) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Fallback): unknown {
|
||||
const obj: any = {};
|
||||
if (message.name !== "") {
|
||||
obj.name = message.name;
|
||||
}
|
||||
if (message.alpn !== "") {
|
||||
obj.alpn = message.alpn;
|
||||
}
|
||||
if (message.path !== "") {
|
||||
obj.path = message.path;
|
||||
}
|
||||
if (message.type !== "") {
|
||||
obj.type = message.type;
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
obj.dest = message.dest;
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
obj.xver = Math.round(message.xver);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Fallback>): Fallback {
|
||||
return Fallback.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Fallback>): Fallback {
|
||||
const message = createBaseFallback();
|
||||
message.name = object.name ?? "";
|
||||
message.alpn = object.alpn ?? "";
|
||||
message.path = object.path ?? "";
|
||||
message.type = object.type ?? "";
|
||||
message.dest = object.dest ?? "";
|
||||
message.xver = object.xver ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Fallback.$type, Fallback);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.proxy.vless.inbound.Config",
|
||||
clients: [],
|
||||
fallbacks: [],
|
||||
decryption: "",
|
||||
xorMode: 0,
|
||||
secondsFrom: 0,
|
||||
secondsTo: 0,
|
||||
padding: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.vless.inbound.Config"> = {
|
||||
$type: "xray.proxy.vless.inbound.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.clients) {
|
||||
User.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
for (const v of message.fallbacks) {
|
||||
Fallback.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.decryption !== "") {
|
||||
writer.uint32(26).string(message.decryption);
|
||||
}
|
||||
if (message.xorMode !== 0) {
|
||||
writer.uint32(32).uint32(message.xorMode);
|
||||
}
|
||||
if (message.secondsFrom !== 0) {
|
||||
writer.uint32(40).int64(message.secondsFrom);
|
||||
}
|
||||
if (message.secondsTo !== 0) {
|
||||
writer.uint32(48).int64(message.secondsTo);
|
||||
}
|
||||
if (message.padding !== "") {
|
||||
writer.uint32(58).string(message.padding);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.clients.push(User.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.fallbacks.push(Fallback.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.decryption = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xorMode = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.secondsFrom = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.secondsTo = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.padding = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
clients: globalThis.Array.isArray(object?.clients) ? object.clients.map((e: any) => User.fromJSON(e)) : [],
|
||||
fallbacks: globalThis.Array.isArray(object?.fallbacks)
|
||||
? object.fallbacks.map((e: any) => Fallback.fromJSON(e))
|
||||
: [],
|
||||
decryption: isSet(object.decryption) ? globalThis.String(object.decryption) : "",
|
||||
xorMode: isSet(object.xorMode) ? globalThis.Number(object.xorMode) : 0,
|
||||
secondsFrom: isSet(object.secondsFrom) ? globalThis.Number(object.secondsFrom) : 0,
|
||||
secondsTo: isSet(object.secondsTo) ? globalThis.Number(object.secondsTo) : 0,
|
||||
padding: isSet(object.padding) ? globalThis.String(object.padding) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.clients?.length) {
|
||||
obj.clients = message.clients.map((e) => User.toJSON(e));
|
||||
}
|
||||
if (message.fallbacks?.length) {
|
||||
obj.fallbacks = message.fallbacks.map((e) => Fallback.toJSON(e));
|
||||
}
|
||||
if (message.decryption !== "") {
|
||||
obj.decryption = message.decryption;
|
||||
}
|
||||
if (message.xorMode !== 0) {
|
||||
obj.xorMode = Math.round(message.xorMode);
|
||||
}
|
||||
if (message.secondsFrom !== 0) {
|
||||
obj.secondsFrom = Math.round(message.secondsFrom);
|
||||
}
|
||||
if (message.secondsTo !== 0) {
|
||||
obj.secondsTo = Math.round(message.secondsTo);
|
||||
}
|
||||
if (message.padding !== "") {
|
||||
obj.padding = message.padding;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.clients = object.clients?.map((e) => User.fromPartial(e)) || [];
|
||||
message.fallbacks = object.fallbacks?.map((e) => Fallback.fromPartial(e)) || [];
|
||||
message.decryption = object.decryption ?? "";
|
||||
message.xorMode = object.xorMode ?? 0;
|
||||
message.secondsFrom = object.secondsFrom ?? 0;
|
||||
message.secondsTo = object.secondsTo ?? 0;
|
||||
message.padding = object.padding ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
103
src/proto/proxy/vless/outbound/config.ts
Normal file
103
src/proto/proxy/vless/outbound/config.ts
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vless/outbound/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ServerEndpoint } from "../../../common/protocol/server_spec";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vless.outbound";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.vless.outbound.Config";
|
||||
vnext: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.vless.outbound.Config", vnext: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.vless.outbound.Config"> = {
|
||||
$type: "xray.proxy.vless.outbound.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.vnext !== undefined) {
|
||||
ServerEndpoint.encode(message.vnext, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.vnext = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return { $type: Config.$type, vnext: isSet(object.vnext) ? ServerEndpoint.fromJSON(object.vnext) : undefined };
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.vnext !== undefined) {
|
||||
obj.vnext = ServerEndpoint.toJSON(message.vnext);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.vnext = (object.vnext !== undefined && object.vnext !== null)
|
||||
? ServerEndpoint.fromPartial(object.vnext)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
148
src/proto/proxy/vmess/account.ts
Normal file
148
src/proto/proxy/vmess/account.ts
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vmess/account.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { SecurityConfig } from "../../common/protocol/headers";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vmess";
|
||||
|
||||
export interface Account {
|
||||
$type: "xray.proxy.vmess.Account";
|
||||
/**
|
||||
* ID of the account, in the form of a UUID, e.g.,
|
||||
* "66ad4540-b58c-4ad2-9926-ea63445a9b57".
|
||||
*/
|
||||
id: string;
|
||||
/** Security settings. Only applies to client side. */
|
||||
securitySettings:
|
||||
| SecurityConfig
|
||||
| undefined;
|
||||
/** Define tests enabled for this account */
|
||||
testsEnabled: string;
|
||||
}
|
||||
|
||||
function createBaseAccount(): Account {
|
||||
return { $type: "xray.proxy.vmess.Account", id: "", securitySettings: undefined, testsEnabled: "" };
|
||||
}
|
||||
|
||||
export const Account: MessageFns<Account, "xray.proxy.vmess.Account"> = {
|
||||
$type: "xray.proxy.vmess.Account" as const,
|
||||
|
||||
encode(message: Account, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.securitySettings !== undefined) {
|
||||
SecurityConfig.encode(message.securitySettings, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.testsEnabled !== "") {
|
||||
writer.uint32(34).string(message.testsEnabled);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Account {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAccount();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.id = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.securitySettings = SecurityConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.testsEnabled = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Account {
|
||||
return {
|
||||
$type: Account.$type,
|
||||
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
||||
securitySettings: isSet(object.securitySettings) ? SecurityConfig.fromJSON(object.securitySettings) : undefined,
|
||||
testsEnabled: isSet(object.testsEnabled) ? globalThis.String(object.testsEnabled) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Account): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== "") {
|
||||
obj.id = message.id;
|
||||
}
|
||||
if (message.securitySettings !== undefined) {
|
||||
obj.securitySettings = SecurityConfig.toJSON(message.securitySettings);
|
||||
}
|
||||
if (message.testsEnabled !== "") {
|
||||
obj.testsEnabled = message.testsEnabled;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Account>): Account {
|
||||
return Account.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Account>): Account {
|
||||
const message = createBaseAccount();
|
||||
message.id = object.id ?? "";
|
||||
message.securitySettings = (object.securitySettings !== undefined && object.securitySettings !== null)
|
||||
? SecurityConfig.fromPartial(object.securitySettings)
|
||||
: undefined;
|
||||
message.testsEnabled = object.testsEnabled ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Account.$type, Account);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
257
src/proto/proxy/vmess/inbound/config.ts
Normal file
257
src/proto/proxy/vmess/inbound/config.ts
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vmess/inbound/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { User } from "../../../common/protocol/user";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vmess.inbound";
|
||||
|
||||
export interface DetourConfig {
|
||||
$type: "xray.proxy.vmess.inbound.DetourConfig";
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface DefaultConfig {
|
||||
$type: "xray.proxy.vmess.inbound.DefaultConfig";
|
||||
level: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.vmess.inbound.Config";
|
||||
user: User[];
|
||||
default: DefaultConfig | undefined;
|
||||
}
|
||||
|
||||
function createBaseDetourConfig(): DetourConfig {
|
||||
return { $type: "xray.proxy.vmess.inbound.DetourConfig", to: "" };
|
||||
}
|
||||
|
||||
export const DetourConfig: MessageFns<DetourConfig, "xray.proxy.vmess.inbound.DetourConfig"> = {
|
||||
$type: "xray.proxy.vmess.inbound.DetourConfig" as const,
|
||||
|
||||
encode(message: DetourConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.to !== "") {
|
||||
writer.uint32(10).string(message.to);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DetourConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDetourConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.to = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DetourConfig {
|
||||
return { $type: DetourConfig.$type, to: isSet(object.to) ? globalThis.String(object.to) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: DetourConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.to !== "") {
|
||||
obj.to = message.to;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DetourConfig>): DetourConfig {
|
||||
return DetourConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DetourConfig>): DetourConfig {
|
||||
const message = createBaseDetourConfig();
|
||||
message.to = object.to ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(DetourConfig.$type, DetourConfig);
|
||||
|
||||
function createBaseDefaultConfig(): DefaultConfig {
|
||||
return { $type: "xray.proxy.vmess.inbound.DefaultConfig", level: 0 };
|
||||
}
|
||||
|
||||
export const DefaultConfig: MessageFns<DefaultConfig, "xray.proxy.vmess.inbound.DefaultConfig"> = {
|
||||
$type: "xray.proxy.vmess.inbound.DefaultConfig" as const,
|
||||
|
||||
encode(message: DefaultConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.level !== 0) {
|
||||
writer.uint32(16).uint32(message.level);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DefaultConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDefaultConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.level = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DefaultConfig {
|
||||
return { $type: DefaultConfig.$type, level: isSet(object.level) ? globalThis.Number(object.level) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: DefaultConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.level !== 0) {
|
||||
obj.level = Math.round(message.level);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DefaultConfig>): DefaultConfig {
|
||||
return DefaultConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DefaultConfig>): DefaultConfig {
|
||||
const message = createBaseDefaultConfig();
|
||||
message.level = object.level ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(DefaultConfig.$type, DefaultConfig);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.vmess.inbound.Config", user: [], default: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.vmess.inbound.Config"> = {
|
||||
$type: "xray.proxy.vmess.inbound.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.user) {
|
||||
User.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.default !== undefined) {
|
||||
DefaultConfig.encode(message.default, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.user.push(User.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.default = DefaultConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
user: globalThis.Array.isArray(object?.user) ? object.user.map((e: any) => User.fromJSON(e)) : [],
|
||||
default: isSet(object.default) ? DefaultConfig.fromJSON(object.default) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.user?.length) {
|
||||
obj.user = message.user.map((e) => User.toJSON(e));
|
||||
}
|
||||
if (message.default !== undefined) {
|
||||
obj.default = DefaultConfig.toJSON(message.default);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.user = object.user?.map((e) => User.fromPartial(e)) || [];
|
||||
message.default = (object.default !== undefined && object.default !== null)
|
||||
? DefaultConfig.fromPartial(object.default)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
106
src/proto/proxy/vmess/outbound/config.ts
Normal file
106
src/proto/proxy/vmess/outbound/config.ts
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/vmess/outbound/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ServerEndpoint } from "../../../common/protocol/server_spec";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.vmess.outbound";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.proxy.vmess.outbound.Config";
|
||||
Receiver: ServerEndpoint | undefined;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.proxy.vmess.outbound.Config", Receiver: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.proxy.vmess.outbound.Config"> = {
|
||||
$type: "xray.proxy.vmess.outbound.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.Receiver !== undefined) {
|
||||
ServerEndpoint.encode(message.Receiver, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.Receiver = ServerEndpoint.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
Receiver: isSet(object.Receiver) ? ServerEndpoint.fromJSON(object.Receiver) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.Receiver !== undefined) {
|
||||
obj.Receiver = ServerEndpoint.toJSON(message.Receiver);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.Receiver = (object.Receiver !== undefined && object.Receiver !== null)
|
||||
? ServerEndpoint.fromPartial(object.Receiver)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
473
src/proto/proxy/wireguard/config.ts
Normal file
473
src/proto/proxy/wireguard/config.ts
Normal file
|
|
@ -0,0 +1,473 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: proxy/wireguard/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.proxy.wireguard";
|
||||
|
||||
export interface PeerConfig {
|
||||
$type: "xray.proxy.wireguard.PeerConfig";
|
||||
publicKey: string;
|
||||
preSharedKey: string;
|
||||
endpoint: string;
|
||||
keepAlive: number;
|
||||
allowedIps: string[];
|
||||
}
|
||||
|
||||
export interface DeviceConfig {
|
||||
$type: "xray.proxy.wireguard.DeviceConfig";
|
||||
secretKey: string;
|
||||
endpoint: string[];
|
||||
peers: PeerConfig[];
|
||||
mtu: number;
|
||||
numWorkers: number;
|
||||
reserved: Uint8Array;
|
||||
domainStrategy: DeviceConfig_DomainStrategy;
|
||||
isClient: boolean;
|
||||
noKernelTun: boolean;
|
||||
}
|
||||
|
||||
export enum DeviceConfig_DomainStrategy {
|
||||
FORCE_IP = 0,
|
||||
FORCE_IP4 = 1,
|
||||
FORCE_IP6 = 2,
|
||||
FORCE_IP46 = 3,
|
||||
FORCE_IP64 = 4,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function deviceConfig_DomainStrategyFromJSON(object: any): DeviceConfig_DomainStrategy {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "FORCE_IP":
|
||||
return DeviceConfig_DomainStrategy.FORCE_IP;
|
||||
case 1:
|
||||
case "FORCE_IP4":
|
||||
return DeviceConfig_DomainStrategy.FORCE_IP4;
|
||||
case 2:
|
||||
case "FORCE_IP6":
|
||||
return DeviceConfig_DomainStrategy.FORCE_IP6;
|
||||
case 3:
|
||||
case "FORCE_IP46":
|
||||
return DeviceConfig_DomainStrategy.FORCE_IP46;
|
||||
case 4:
|
||||
case "FORCE_IP64":
|
||||
return DeviceConfig_DomainStrategy.FORCE_IP64;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return DeviceConfig_DomainStrategy.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function deviceConfig_DomainStrategyToJSON(object: DeviceConfig_DomainStrategy): string {
|
||||
switch (object) {
|
||||
case DeviceConfig_DomainStrategy.FORCE_IP:
|
||||
return "FORCE_IP";
|
||||
case DeviceConfig_DomainStrategy.FORCE_IP4:
|
||||
return "FORCE_IP4";
|
||||
case DeviceConfig_DomainStrategy.FORCE_IP6:
|
||||
return "FORCE_IP6";
|
||||
case DeviceConfig_DomainStrategy.FORCE_IP46:
|
||||
return "FORCE_IP46";
|
||||
case DeviceConfig_DomainStrategy.FORCE_IP64:
|
||||
return "FORCE_IP64";
|
||||
case DeviceConfig_DomainStrategy.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
function createBasePeerConfig(): PeerConfig {
|
||||
return {
|
||||
$type: "xray.proxy.wireguard.PeerConfig",
|
||||
publicKey: "",
|
||||
preSharedKey: "",
|
||||
endpoint: "",
|
||||
keepAlive: 0,
|
||||
allowedIps: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const PeerConfig: MessageFns<PeerConfig, "xray.proxy.wireguard.PeerConfig"> = {
|
||||
$type: "xray.proxy.wireguard.PeerConfig" as const,
|
||||
|
||||
encode(message: PeerConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.publicKey !== "") {
|
||||
writer.uint32(10).string(message.publicKey);
|
||||
}
|
||||
if (message.preSharedKey !== "") {
|
||||
writer.uint32(18).string(message.preSharedKey);
|
||||
}
|
||||
if (message.endpoint !== "") {
|
||||
writer.uint32(26).string(message.endpoint);
|
||||
}
|
||||
if (message.keepAlive !== 0) {
|
||||
writer.uint32(32).uint32(message.keepAlive);
|
||||
}
|
||||
for (const v of message.allowedIps) {
|
||||
writer.uint32(42).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PeerConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePeerConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.publicKey = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.preSharedKey = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.endpoint = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.keepAlive = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.allowedIps.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PeerConfig {
|
||||
return {
|
||||
$type: PeerConfig.$type,
|
||||
publicKey: isSet(object.publicKey) ? globalThis.String(object.publicKey) : "",
|
||||
preSharedKey: isSet(object.preSharedKey) ? globalThis.String(object.preSharedKey) : "",
|
||||
endpoint: isSet(object.endpoint) ? globalThis.String(object.endpoint) : "",
|
||||
keepAlive: isSet(object.keepAlive) ? globalThis.Number(object.keepAlive) : 0,
|
||||
allowedIps: globalThis.Array.isArray(object?.allowedIps)
|
||||
? object.allowedIps.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PeerConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.publicKey !== "") {
|
||||
obj.publicKey = message.publicKey;
|
||||
}
|
||||
if (message.preSharedKey !== "") {
|
||||
obj.preSharedKey = message.preSharedKey;
|
||||
}
|
||||
if (message.endpoint !== "") {
|
||||
obj.endpoint = message.endpoint;
|
||||
}
|
||||
if (message.keepAlive !== 0) {
|
||||
obj.keepAlive = Math.round(message.keepAlive);
|
||||
}
|
||||
if (message.allowedIps?.length) {
|
||||
obj.allowedIps = message.allowedIps;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PeerConfig>): PeerConfig {
|
||||
return PeerConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<PeerConfig>): PeerConfig {
|
||||
const message = createBasePeerConfig();
|
||||
message.publicKey = object.publicKey ?? "";
|
||||
message.preSharedKey = object.preSharedKey ?? "";
|
||||
message.endpoint = object.endpoint ?? "";
|
||||
message.keepAlive = object.keepAlive ?? 0;
|
||||
message.allowedIps = object.allowedIps?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(PeerConfig.$type, PeerConfig);
|
||||
|
||||
function createBaseDeviceConfig(): DeviceConfig {
|
||||
return {
|
||||
$type: "xray.proxy.wireguard.DeviceConfig",
|
||||
secretKey: "",
|
||||
endpoint: [],
|
||||
peers: [],
|
||||
mtu: 0,
|
||||
numWorkers: 0,
|
||||
reserved: new Uint8Array(0),
|
||||
domainStrategy: 0,
|
||||
isClient: false,
|
||||
noKernelTun: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const DeviceConfig: MessageFns<DeviceConfig, "xray.proxy.wireguard.DeviceConfig"> = {
|
||||
$type: "xray.proxy.wireguard.DeviceConfig" as const,
|
||||
|
||||
encode(message: DeviceConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.secretKey !== "") {
|
||||
writer.uint32(10).string(message.secretKey);
|
||||
}
|
||||
for (const v of message.endpoint) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
for (const v of message.peers) {
|
||||
PeerConfig.encode(v!, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.mtu !== 0) {
|
||||
writer.uint32(32).int32(message.mtu);
|
||||
}
|
||||
if (message.numWorkers !== 0) {
|
||||
writer.uint32(40).int32(message.numWorkers);
|
||||
}
|
||||
if (message.reserved.length !== 0) {
|
||||
writer.uint32(50).bytes(message.reserved);
|
||||
}
|
||||
if (message.domainStrategy !== 0) {
|
||||
writer.uint32(56).int32(message.domainStrategy);
|
||||
}
|
||||
if (message.isClient !== false) {
|
||||
writer.uint32(64).bool(message.isClient);
|
||||
}
|
||||
if (message.noKernelTun !== false) {
|
||||
writer.uint32(72).bool(message.noKernelTun);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DeviceConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDeviceConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.secretKey = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.endpoint.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.peers.push(PeerConfig.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mtu = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.numWorkers = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.reserved = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domainStrategy = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.isClient = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag !== 72) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.noKernelTun = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DeviceConfig {
|
||||
return {
|
||||
$type: DeviceConfig.$type,
|
||||
secretKey: isSet(object.secretKey) ? globalThis.String(object.secretKey) : "",
|
||||
endpoint: globalThis.Array.isArray(object?.endpoint) ? object.endpoint.map((e: any) => globalThis.String(e)) : [],
|
||||
peers: globalThis.Array.isArray(object?.peers) ? object.peers.map((e: any) => PeerConfig.fromJSON(e)) : [],
|
||||
mtu: isSet(object.mtu) ? globalThis.Number(object.mtu) : 0,
|
||||
numWorkers: isSet(object.numWorkers) ? globalThis.Number(object.numWorkers) : 0,
|
||||
reserved: isSet(object.reserved) ? bytesFromBase64(object.reserved) : new Uint8Array(0),
|
||||
domainStrategy: isSet(object.domainStrategy) ? deviceConfig_DomainStrategyFromJSON(object.domainStrategy) : 0,
|
||||
isClient: isSet(object.isClient) ? globalThis.Boolean(object.isClient) : false,
|
||||
noKernelTun: isSet(object.noKernelTun) ? globalThis.Boolean(object.noKernelTun) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: DeviceConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.secretKey !== "") {
|
||||
obj.secretKey = message.secretKey;
|
||||
}
|
||||
if (message.endpoint?.length) {
|
||||
obj.endpoint = message.endpoint;
|
||||
}
|
||||
if (message.peers?.length) {
|
||||
obj.peers = message.peers.map((e) => PeerConfig.toJSON(e));
|
||||
}
|
||||
if (message.mtu !== 0) {
|
||||
obj.mtu = Math.round(message.mtu);
|
||||
}
|
||||
if (message.numWorkers !== 0) {
|
||||
obj.numWorkers = Math.round(message.numWorkers);
|
||||
}
|
||||
if (message.reserved.length !== 0) {
|
||||
obj.reserved = base64FromBytes(message.reserved);
|
||||
}
|
||||
if (message.domainStrategy !== 0) {
|
||||
obj.domainStrategy = deviceConfig_DomainStrategyToJSON(message.domainStrategy);
|
||||
}
|
||||
if (message.isClient !== false) {
|
||||
obj.isClient = message.isClient;
|
||||
}
|
||||
if (message.noKernelTun !== false) {
|
||||
obj.noKernelTun = message.noKernelTun;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DeviceConfig>): DeviceConfig {
|
||||
return DeviceConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DeviceConfig>): DeviceConfig {
|
||||
const message = createBaseDeviceConfig();
|
||||
message.secretKey = object.secretKey ?? "";
|
||||
message.endpoint = object.endpoint?.map((e) => e) || [];
|
||||
message.peers = object.peers?.map((e) => PeerConfig.fromPartial(e)) || [];
|
||||
message.mtu = object.mtu ?? 0;
|
||||
message.numWorkers = object.numWorkers ?? 0;
|
||||
message.reserved = object.reserved ?? new Uint8Array(0);
|
||||
message.domainStrategy = object.domainStrategy ?? 0;
|
||||
message.isClient = object.isClient ?? false;
|
||||
message.noKernelTun = object.noKernelTun ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(DeviceConfig.$type, DeviceConfig);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
1410
src/proto/transport/internet/config.ts
Normal file
1410
src/proto/transport/internet/config.ts
Normal file
File diff suppressed because it is too large
Load diff
232
src/proto/transport/internet/grpc/config.ts
Normal file
232
src/proto/transport/internet/grpc/config.ts
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/grpc/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.grpc.encoding";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.grpc.encoding.Config";
|
||||
authority: string;
|
||||
serviceName: string;
|
||||
multiMode: boolean;
|
||||
idleTimeout: number;
|
||||
healthCheckTimeout: number;
|
||||
permitWithoutStream: boolean;
|
||||
initialWindowsSize: number;
|
||||
userAgent: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.grpc.encoding.Config",
|
||||
authority: "",
|
||||
serviceName: "",
|
||||
multiMode: false,
|
||||
idleTimeout: 0,
|
||||
healthCheckTimeout: 0,
|
||||
permitWithoutStream: false,
|
||||
initialWindowsSize: 0,
|
||||
userAgent: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.grpc.encoding.Config"> = {
|
||||
$type: "xray.transport.internet.grpc.encoding.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.authority !== "") {
|
||||
writer.uint32(10).string(message.authority);
|
||||
}
|
||||
if (message.serviceName !== "") {
|
||||
writer.uint32(18).string(message.serviceName);
|
||||
}
|
||||
if (message.multiMode !== false) {
|
||||
writer.uint32(24).bool(message.multiMode);
|
||||
}
|
||||
if (message.idleTimeout !== 0) {
|
||||
writer.uint32(32).int32(message.idleTimeout);
|
||||
}
|
||||
if (message.healthCheckTimeout !== 0) {
|
||||
writer.uint32(40).int32(message.healthCheckTimeout);
|
||||
}
|
||||
if (message.permitWithoutStream !== false) {
|
||||
writer.uint32(48).bool(message.permitWithoutStream);
|
||||
}
|
||||
if (message.initialWindowsSize !== 0) {
|
||||
writer.uint32(56).int32(message.initialWindowsSize);
|
||||
}
|
||||
if (message.userAgent !== "") {
|
||||
writer.uint32(66).string(message.userAgent);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.authority = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.serviceName = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.multiMode = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.idleTimeout = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.healthCheckTimeout = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.permitWithoutStream = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.initialWindowsSize = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 66) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.userAgent = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
|
||||
serviceName: isSet(object.serviceName) ? globalThis.String(object.serviceName) : "",
|
||||
multiMode: isSet(object.multiMode) ? globalThis.Boolean(object.multiMode) : false,
|
||||
idleTimeout: isSet(object.idleTimeout) ? globalThis.Number(object.idleTimeout) : 0,
|
||||
healthCheckTimeout: isSet(object.healthCheckTimeout) ? globalThis.Number(object.healthCheckTimeout) : 0,
|
||||
permitWithoutStream: isSet(object.permitWithoutStream) ? globalThis.Boolean(object.permitWithoutStream) : false,
|
||||
initialWindowsSize: isSet(object.initialWindowsSize) ? globalThis.Number(object.initialWindowsSize) : 0,
|
||||
userAgent: isSet(object.userAgent) ? globalThis.String(object.userAgent) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.authority !== "") {
|
||||
obj.authority = message.authority;
|
||||
}
|
||||
if (message.serviceName !== "") {
|
||||
obj.serviceName = message.serviceName;
|
||||
}
|
||||
if (message.multiMode !== false) {
|
||||
obj.multiMode = message.multiMode;
|
||||
}
|
||||
if (message.idleTimeout !== 0) {
|
||||
obj.idleTimeout = Math.round(message.idleTimeout);
|
||||
}
|
||||
if (message.healthCheckTimeout !== 0) {
|
||||
obj.healthCheckTimeout = Math.round(message.healthCheckTimeout);
|
||||
}
|
||||
if (message.permitWithoutStream !== false) {
|
||||
obj.permitWithoutStream = message.permitWithoutStream;
|
||||
}
|
||||
if (message.initialWindowsSize !== 0) {
|
||||
obj.initialWindowsSize = Math.round(message.initialWindowsSize);
|
||||
}
|
||||
if (message.userAgent !== "") {
|
||||
obj.userAgent = message.userAgent;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.authority = object.authority ?? "";
|
||||
message.serviceName = object.serviceName ?? "";
|
||||
message.multiMode = object.multiMode ?? false;
|
||||
message.idleTimeout = object.idleTimeout ?? 0;
|
||||
message.healthCheckTimeout = object.healthCheckTimeout ?? 0;
|
||||
message.permitWithoutStream = object.permitWithoutStream ?? false;
|
||||
message.initialWindowsSize = object.initialWindowsSize ?? 0;
|
||||
message.userAgent = object.userAgent ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
234
src/proto/transport/internet/grpc/encoding/stream.ts
Normal file
234
src/proto/transport/internet/grpc/encoding/stream.ts
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/grpc/encoding/stream.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { CallContext, CallOptions } from "nice-grpc-common";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.grpc.encoding";
|
||||
|
||||
export interface Hunk {
|
||||
$type: "xray.transport.internet.grpc.encoding.Hunk";
|
||||
data: Uint8Array;
|
||||
}
|
||||
|
||||
export interface MultiHunk {
|
||||
$type: "xray.transport.internet.grpc.encoding.MultiHunk";
|
||||
data: Uint8Array[];
|
||||
}
|
||||
|
||||
function createBaseHunk(): Hunk {
|
||||
return { $type: "xray.transport.internet.grpc.encoding.Hunk", data: new Uint8Array(0) };
|
||||
}
|
||||
|
||||
export const Hunk: MessageFns<Hunk, "xray.transport.internet.grpc.encoding.Hunk"> = {
|
||||
$type: "xray.transport.internet.grpc.encoding.Hunk" as const,
|
||||
|
||||
encode(message: Hunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.data.length !== 0) {
|
||||
writer.uint32(10).bytes(message.data);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Hunk {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHunk();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.data = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Hunk {
|
||||
return { $type: Hunk.$type, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) };
|
||||
},
|
||||
|
||||
toJSON(message: Hunk): unknown {
|
||||
const obj: any = {};
|
||||
if (message.data.length !== 0) {
|
||||
obj.data = base64FromBytes(message.data);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Hunk>): Hunk {
|
||||
return Hunk.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Hunk>): Hunk {
|
||||
const message = createBaseHunk();
|
||||
message.data = object.data ?? new Uint8Array(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Hunk.$type, Hunk);
|
||||
|
||||
function createBaseMultiHunk(): MultiHunk {
|
||||
return { $type: "xray.transport.internet.grpc.encoding.MultiHunk", data: [] };
|
||||
}
|
||||
|
||||
export const MultiHunk: MessageFns<MultiHunk, "xray.transport.internet.grpc.encoding.MultiHunk"> = {
|
||||
$type: "xray.transport.internet.grpc.encoding.MultiHunk" as const,
|
||||
|
||||
encode(message: MultiHunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.data) {
|
||||
writer.uint32(10).bytes(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): MultiHunk {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMultiHunk();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.data.push(reader.bytes());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MultiHunk {
|
||||
return {
|
||||
$type: MultiHunk.$type,
|
||||
data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => bytesFromBase64(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MultiHunk): unknown {
|
||||
const obj: any = {};
|
||||
if (message.data?.length) {
|
||||
obj.data = message.data.map((e) => base64FromBytes(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<MultiHunk>): MultiHunk {
|
||||
return MultiHunk.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<MultiHunk>): MultiHunk {
|
||||
const message = createBaseMultiHunk();
|
||||
message.data = object.data?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(MultiHunk.$type, MultiHunk);
|
||||
|
||||
export type GRPCServiceDefinition = typeof GRPCServiceDefinition;
|
||||
export const GRPCServiceDefinition = {
|
||||
name: "GRPCService",
|
||||
fullName: "xray.transport.internet.grpc.encoding.GRPCService",
|
||||
methods: {
|
||||
tun: { name: "Tun", requestType: Hunk, requestStream: true, responseType: Hunk, responseStream: true, options: {} },
|
||||
tunMulti: {
|
||||
name: "TunMulti",
|
||||
requestType: MultiHunk,
|
||||
requestStream: true,
|
||||
responseType: MultiHunk,
|
||||
responseStream: true,
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export interface GRPCServiceImplementation<CallContextExt = {}> {
|
||||
tun(
|
||||
request: AsyncIterable<Hunk>,
|
||||
context: CallContext & CallContextExt,
|
||||
): ServerStreamingMethodResult<DeepPartial<Hunk>>;
|
||||
tunMulti(
|
||||
request: AsyncIterable<MultiHunk>,
|
||||
context: CallContext & CallContextExt,
|
||||
): ServerStreamingMethodResult<DeepPartial<MultiHunk>>;
|
||||
}
|
||||
|
||||
export interface GRPCServiceClient<CallOptionsExt = {}> {
|
||||
tun(request: AsyncIterable<DeepPartial<Hunk>>, options?: CallOptions & CallOptionsExt): AsyncIterable<Hunk>;
|
||||
tunMulti(
|
||||
request: AsyncIterable<DeepPartial<MultiHunk>>,
|
||||
options?: CallOptions & CallOptionsExt,
|
||||
): AsyncIterable<MultiHunk>;
|
||||
}
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
100
src/proto/transport/internet/headers/dns/config.ts
Normal file
100
src/proto/transport/internet/headers/dns/config.ts
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/dns/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.dns";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.headers.dns.Config";
|
||||
domain: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.headers.dns.Config", domain: "" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.headers.dns.Config"> = {
|
||||
$type: "xray.transport.internet.headers.dns.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.domain !== "") {
|
||||
writer.uint32(10).string(message.domain);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.domain = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return { $type: Config.$type, domain: isSet(object.domain) ? globalThis.String(object.domain) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.domain !== "") {
|
||||
obj.domain = message.domain;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.domain = object.domain ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
702
src/proto/transport/internet/headers/http/config.ts
Normal file
702
src/proto/transport/internet/headers/http/config.ts
Normal file
|
|
@ -0,0 +1,702 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/http/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.http";
|
||||
|
||||
export interface Header {
|
||||
$type: "xray.transport.internet.headers.http.Header";
|
||||
/** "Accept", "Cookie", etc */
|
||||
name: string;
|
||||
/**
|
||||
* Each entry must be valid in one piece. Random entry will be chosen if
|
||||
* multiple entries present.
|
||||
*/
|
||||
value: string[];
|
||||
}
|
||||
|
||||
/** HTTP version. Default value "1.1". */
|
||||
export interface Version {
|
||||
$type: "xray.transport.internet.headers.http.Version";
|
||||
value: string;
|
||||
}
|
||||
|
||||
/** HTTP method. Default value "GET". */
|
||||
export interface Method {
|
||||
$type: "xray.transport.internet.headers.http.Method";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface RequestConfig {
|
||||
$type: "xray.transport.internet.headers.http.RequestConfig";
|
||||
/** Full HTTP version like "1.1". */
|
||||
version:
|
||||
| Version
|
||||
| undefined;
|
||||
/** GET, POST, CONNECT etc */
|
||||
method:
|
||||
| Method
|
||||
| undefined;
|
||||
/** URI like "/login.php" */
|
||||
uri: string[];
|
||||
header: Header[];
|
||||
}
|
||||
|
||||
export interface Status {
|
||||
$type: "xray.transport.internet.headers.http.Status";
|
||||
/** Status code. Default "200". */
|
||||
code: string;
|
||||
/** Statue reason. Default "OK". */
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface ResponseConfig {
|
||||
$type: "xray.transport.internet.headers.http.ResponseConfig";
|
||||
version: Version | undefined;
|
||||
status: Status | undefined;
|
||||
header: Header[];
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.headers.http.Config";
|
||||
/**
|
||||
* Settings for authenticating requests. If not set, client side will not send
|
||||
* authentication header, and server side will bypass authentication.
|
||||
*/
|
||||
request:
|
||||
| RequestConfig
|
||||
| undefined;
|
||||
/**
|
||||
* Settings for authenticating responses. If not set, client side will bypass
|
||||
* authentication, and server side will not send authentication header.
|
||||
*/
|
||||
response: ResponseConfig | undefined;
|
||||
}
|
||||
|
||||
function createBaseHeader(): Header {
|
||||
return { $type: "xray.transport.internet.headers.http.Header", name: "", value: [] };
|
||||
}
|
||||
|
||||
export const Header: MessageFns<Header, "xray.transport.internet.headers.http.Header"> = {
|
||||
$type: "xray.transport.internet.headers.http.Header" as const,
|
||||
|
||||
encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
for (const v of message.value) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Header {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHeader();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Header {
|
||||
return {
|
||||
$type: Header.$type,
|
||||
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
||||
value: globalThis.Array.isArray(object?.value) ? object.value.map((e: any) => globalThis.String(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Header): unknown {
|
||||
const obj: any = {};
|
||||
if (message.name !== "") {
|
||||
obj.name = message.name;
|
||||
}
|
||||
if (message.value?.length) {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Header>): Header {
|
||||
return Header.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Header>): Header {
|
||||
const message = createBaseHeader();
|
||||
message.name = object.name ?? "";
|
||||
message.value = object.value?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Header.$type, Header);
|
||||
|
||||
function createBaseVersion(): Version {
|
||||
return { $type: "xray.transport.internet.headers.http.Version", value: "" };
|
||||
}
|
||||
|
||||
export const Version: MessageFns<Version, "xray.transport.internet.headers.http.Version"> = {
|
||||
$type: "xray.transport.internet.headers.http.Version" as const,
|
||||
|
||||
encode(message: Version, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== "") {
|
||||
writer.uint32(10).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Version {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseVersion();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Version {
|
||||
return { $type: Version.$type, value: isSet(object.value) ? globalThis.String(object.value) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Version): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Version>): Version {
|
||||
return Version.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Version>): Version {
|
||||
const message = createBaseVersion();
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Version.$type, Version);
|
||||
|
||||
function createBaseMethod(): Method {
|
||||
return { $type: "xray.transport.internet.headers.http.Method", value: "" };
|
||||
}
|
||||
|
||||
export const Method: MessageFns<Method, "xray.transport.internet.headers.http.Method"> = {
|
||||
$type: "xray.transport.internet.headers.http.Method" as const,
|
||||
|
||||
encode(message: Method, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== "") {
|
||||
writer.uint32(10).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Method {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMethod();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Method {
|
||||
return { $type: Method.$type, value: isSet(object.value) ? globalThis.String(object.value) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: Method): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Method>): Method {
|
||||
return Method.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Method>): Method {
|
||||
const message = createBaseMethod();
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Method.$type, Method);
|
||||
|
||||
function createBaseRequestConfig(): RequestConfig {
|
||||
return {
|
||||
$type: "xray.transport.internet.headers.http.RequestConfig",
|
||||
version: undefined,
|
||||
method: undefined,
|
||||
uri: [],
|
||||
header: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const RequestConfig: MessageFns<RequestConfig, "xray.transport.internet.headers.http.RequestConfig"> = {
|
||||
$type: "xray.transport.internet.headers.http.RequestConfig" as const,
|
||||
|
||||
encode(message: RequestConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== undefined) {
|
||||
Version.encode(message.version, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.method !== undefined) {
|
||||
Method.encode(message.method, writer.uint32(18).fork()).join();
|
||||
}
|
||||
for (const v of message.uri) {
|
||||
writer.uint32(26).string(v!);
|
||||
}
|
||||
for (const v of message.header) {
|
||||
Header.encode(v!, writer.uint32(34).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RequestConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRequestConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = Version.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.method = Method.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.uri.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.header.push(Header.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RequestConfig {
|
||||
return {
|
||||
$type: RequestConfig.$type,
|
||||
version: isSet(object.version) ? Version.fromJSON(object.version) : undefined,
|
||||
method: isSet(object.method) ? Method.fromJSON(object.method) : undefined,
|
||||
uri: globalThis.Array.isArray(object?.uri) ? object.uri.map((e: any) => globalThis.String(e)) : [],
|
||||
header: globalThis.Array.isArray(object?.header) ? object.header.map((e: any) => Header.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RequestConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== undefined) {
|
||||
obj.version = Version.toJSON(message.version);
|
||||
}
|
||||
if (message.method !== undefined) {
|
||||
obj.method = Method.toJSON(message.method);
|
||||
}
|
||||
if (message.uri?.length) {
|
||||
obj.uri = message.uri;
|
||||
}
|
||||
if (message.header?.length) {
|
||||
obj.header = message.header.map((e) => Header.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RequestConfig>): RequestConfig {
|
||||
return RequestConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<RequestConfig>): RequestConfig {
|
||||
const message = createBaseRequestConfig();
|
||||
message.version = (object.version !== undefined && object.version !== null)
|
||||
? Version.fromPartial(object.version)
|
||||
: undefined;
|
||||
message.method = (object.method !== undefined && object.method !== null)
|
||||
? Method.fromPartial(object.method)
|
||||
: undefined;
|
||||
message.uri = object.uri?.map((e) => e) || [];
|
||||
message.header = object.header?.map((e) => Header.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RequestConfig.$type, RequestConfig);
|
||||
|
||||
function createBaseStatus(): Status {
|
||||
return { $type: "xray.transport.internet.headers.http.Status", code: "", reason: "" };
|
||||
}
|
||||
|
||||
export const Status: MessageFns<Status, "xray.transport.internet.headers.http.Status"> = {
|
||||
$type: "xray.transport.internet.headers.http.Status" as const,
|
||||
|
||||
encode(message: Status, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.code !== "") {
|
||||
writer.uint32(10).string(message.code);
|
||||
}
|
||||
if (message.reason !== "") {
|
||||
writer.uint32(18).string(message.reason);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Status {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseStatus();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.code = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.reason = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Status {
|
||||
return {
|
||||
$type: Status.$type,
|
||||
code: isSet(object.code) ? globalThis.String(object.code) : "",
|
||||
reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Status): unknown {
|
||||
const obj: any = {};
|
||||
if (message.code !== "") {
|
||||
obj.code = message.code;
|
||||
}
|
||||
if (message.reason !== "") {
|
||||
obj.reason = message.reason;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Status>): Status {
|
||||
return Status.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Status>): Status {
|
||||
const message = createBaseStatus();
|
||||
message.code = object.code ?? "";
|
||||
message.reason = object.reason ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Status.$type, Status);
|
||||
|
||||
function createBaseResponseConfig(): ResponseConfig {
|
||||
return {
|
||||
$type: "xray.transport.internet.headers.http.ResponseConfig",
|
||||
version: undefined,
|
||||
status: undefined,
|
||||
header: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const ResponseConfig: MessageFns<ResponseConfig, "xray.transport.internet.headers.http.ResponseConfig"> = {
|
||||
$type: "xray.transport.internet.headers.http.ResponseConfig" as const,
|
||||
|
||||
encode(message: ResponseConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== undefined) {
|
||||
Version.encode(message.version, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.status !== undefined) {
|
||||
Status.encode(message.status, writer.uint32(18).fork()).join();
|
||||
}
|
||||
for (const v of message.header) {
|
||||
Header.encode(v!, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ResponseConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseResponseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = Version.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.status = Status.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.header.push(Header.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ResponseConfig {
|
||||
return {
|
||||
$type: ResponseConfig.$type,
|
||||
version: isSet(object.version) ? Version.fromJSON(object.version) : undefined,
|
||||
status: isSet(object.status) ? Status.fromJSON(object.status) : undefined,
|
||||
header: globalThis.Array.isArray(object?.header) ? object.header.map((e: any) => Header.fromJSON(e)) : [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ResponseConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== undefined) {
|
||||
obj.version = Version.toJSON(message.version);
|
||||
}
|
||||
if (message.status !== undefined) {
|
||||
obj.status = Status.toJSON(message.status);
|
||||
}
|
||||
if (message.header?.length) {
|
||||
obj.header = message.header.map((e) => Header.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ResponseConfig>): ResponseConfig {
|
||||
return ResponseConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ResponseConfig>): ResponseConfig {
|
||||
const message = createBaseResponseConfig();
|
||||
message.version = (object.version !== undefined && object.version !== null)
|
||||
? Version.fromPartial(object.version)
|
||||
: undefined;
|
||||
message.status = (object.status !== undefined && object.status !== null)
|
||||
? Status.fromPartial(object.status)
|
||||
: undefined;
|
||||
message.header = object.header?.map((e) => Header.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ResponseConfig.$type, ResponseConfig);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.headers.http.Config", request: undefined, response: undefined };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.headers.http.Config"> = {
|
||||
$type: "xray.transport.internet.headers.http.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.request !== undefined) {
|
||||
RequestConfig.encode(message.request, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.response !== undefined) {
|
||||
ResponseConfig.encode(message.response, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.request = RequestConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.response = ResponseConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
request: isSet(object.request) ? RequestConfig.fromJSON(object.request) : undefined,
|
||||
response: isSet(object.response) ? ResponseConfig.fromJSON(object.response) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.request !== undefined) {
|
||||
obj.request = RequestConfig.toJSON(message.request);
|
||||
}
|
||||
if (message.response !== undefined) {
|
||||
obj.response = ResponseConfig.toJSON(message.response);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.request = (object.request !== undefined && object.request !== null)
|
||||
? RequestConfig.fromPartial(object.request)
|
||||
: undefined;
|
||||
message.response = (object.response !== undefined && object.response !== null)
|
||||
? ResponseConfig.fromPartial(object.response)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
131
src/proto/transport/internet/headers/noop/config.ts
Normal file
131
src/proto/transport/internet/headers/noop/config.ts
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/noop/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.noop";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.headers.noop.Config";
|
||||
}
|
||||
|
||||
export interface ConnectionConfig {
|
||||
$type: "xray.transport.internet.headers.noop.ConnectionConfig";
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.headers.noop.Config" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.headers.noop.Config"> = {
|
||||
$type: "xray.transport.internet.headers.noop.Config" as const,
|
||||
|
||||
encode(_: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Config {
|
||||
return { $type: Config.$type };
|
||||
},
|
||||
|
||||
toJSON(_: Config): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConnectionConfig(): ConnectionConfig {
|
||||
return { $type: "xray.transport.internet.headers.noop.ConnectionConfig" };
|
||||
}
|
||||
|
||||
export const ConnectionConfig: MessageFns<ConnectionConfig, "xray.transport.internet.headers.noop.ConnectionConfig"> = {
|
||||
$type: "xray.transport.internet.headers.noop.ConnectionConfig" as const,
|
||||
|
||||
encode(_: ConnectionConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ConnectionConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConnectionConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): ConnectionConfig {
|
||||
return { $type: ConnectionConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: ConnectionConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ConnectionConfig>): ConnectionConfig {
|
||||
return ConnectionConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<ConnectionConfig>): ConnectionConfig {
|
||||
const message = createBaseConnectionConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ConnectionConfig.$type, ConnectionConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
196
src/proto/transport/internet/headers/srtp/config.ts
Normal file
196
src/proto/transport/internet/headers/srtp/config.ts
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/srtp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.srtp";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.headers.srtp.Config";
|
||||
version: number;
|
||||
padding: boolean;
|
||||
extension: boolean;
|
||||
csrcCount: number;
|
||||
marker: boolean;
|
||||
payloadType: number;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.headers.srtp.Config",
|
||||
version: 0,
|
||||
padding: false,
|
||||
extension: false,
|
||||
csrcCount: 0,
|
||||
marker: false,
|
||||
payloadType: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.headers.srtp.Config"> = {
|
||||
$type: "xray.transport.internet.headers.srtp.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== 0) {
|
||||
writer.uint32(8).uint32(message.version);
|
||||
}
|
||||
if (message.padding !== false) {
|
||||
writer.uint32(16).bool(message.padding);
|
||||
}
|
||||
if (message.extension !== false) {
|
||||
writer.uint32(24).bool(message.extension);
|
||||
}
|
||||
if (message.csrcCount !== 0) {
|
||||
writer.uint32(32).uint32(message.csrcCount);
|
||||
}
|
||||
if (message.marker !== false) {
|
||||
writer.uint32(40).bool(message.marker);
|
||||
}
|
||||
if (message.payloadType !== 0) {
|
||||
writer.uint32(48).uint32(message.payloadType);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.padding = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.extension = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.csrcCount = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.marker = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.payloadType = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
version: isSet(object.version) ? globalThis.Number(object.version) : 0,
|
||||
padding: isSet(object.padding) ? globalThis.Boolean(object.padding) : false,
|
||||
extension: isSet(object.extension) ? globalThis.Boolean(object.extension) : false,
|
||||
csrcCount: isSet(object.csrcCount) ? globalThis.Number(object.csrcCount) : 0,
|
||||
marker: isSet(object.marker) ? globalThis.Boolean(object.marker) : false,
|
||||
payloadType: isSet(object.payloadType) ? globalThis.Number(object.payloadType) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== 0) {
|
||||
obj.version = Math.round(message.version);
|
||||
}
|
||||
if (message.padding !== false) {
|
||||
obj.padding = message.padding;
|
||||
}
|
||||
if (message.extension !== false) {
|
||||
obj.extension = message.extension;
|
||||
}
|
||||
if (message.csrcCount !== 0) {
|
||||
obj.csrcCount = Math.round(message.csrcCount);
|
||||
}
|
||||
if (message.marker !== false) {
|
||||
obj.marker = message.marker;
|
||||
}
|
||||
if (message.payloadType !== 0) {
|
||||
obj.payloadType = Math.round(message.payloadType);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.version = object.version ?? 0;
|
||||
message.padding = object.padding ?? false;
|
||||
message.extension = object.extension ?? false;
|
||||
message.csrcCount = object.csrcCount ?? 0;
|
||||
message.marker = object.marker ?? false;
|
||||
message.payloadType = object.payloadType ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
80
src/proto/transport/internet/headers/tls/config.ts
Normal file
80
src/proto/transport/internet/headers/tls/config.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/tls/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.tls";
|
||||
|
||||
export interface PacketConfig {
|
||||
$type: "xray.transport.internet.headers.tls.PacketConfig";
|
||||
}
|
||||
|
||||
function createBasePacketConfig(): PacketConfig {
|
||||
return { $type: "xray.transport.internet.headers.tls.PacketConfig" };
|
||||
}
|
||||
|
||||
export const PacketConfig: MessageFns<PacketConfig, "xray.transport.internet.headers.tls.PacketConfig"> = {
|
||||
$type: "xray.transport.internet.headers.tls.PacketConfig" as const,
|
||||
|
||||
encode(_: PacketConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PacketConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePacketConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): PacketConfig {
|
||||
return { $type: PacketConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: PacketConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PacketConfig>): PacketConfig {
|
||||
return PacketConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<PacketConfig>): PacketConfig {
|
||||
const message = createBasePacketConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(PacketConfig.$type, PacketConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
100
src/proto/transport/internet/headers/utp/config.ts
Normal file
100
src/proto/transport/internet/headers/utp/config.ts
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/utp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.utp";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.headers.utp.Config";
|
||||
version: number;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.headers.utp.Config", version: 0 };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.headers.utp.Config"> = {
|
||||
$type: "xray.transport.internet.headers.utp.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== 0) {
|
||||
writer.uint32(8).uint32(message.version);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return { $type: Config.$type, version: isSet(object.version) ? globalThis.Number(object.version) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== 0) {
|
||||
obj.version = Math.round(message.version);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.version = object.version ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
80
src/proto/transport/internet/headers/wechat/config.ts
Normal file
80
src/proto/transport/internet/headers/wechat/config.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/wechat/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.wechat";
|
||||
|
||||
export interface VideoConfig {
|
||||
$type: "xray.transport.internet.headers.wechat.VideoConfig";
|
||||
}
|
||||
|
||||
function createBaseVideoConfig(): VideoConfig {
|
||||
return { $type: "xray.transport.internet.headers.wechat.VideoConfig" };
|
||||
}
|
||||
|
||||
export const VideoConfig: MessageFns<VideoConfig, "xray.transport.internet.headers.wechat.VideoConfig"> = {
|
||||
$type: "xray.transport.internet.headers.wechat.VideoConfig" as const,
|
||||
|
||||
encode(_: VideoConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): VideoConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseVideoConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): VideoConfig {
|
||||
return { $type: VideoConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: VideoConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<VideoConfig>): VideoConfig {
|
||||
return VideoConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<VideoConfig>): VideoConfig {
|
||||
const message = createBaseVideoConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(VideoConfig.$type, VideoConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
81
src/proto/transport/internet/headers/wireguard/config.ts
Normal file
81
src/proto/transport/internet/headers/wireguard/config.ts
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/headers/wireguard/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.headers.wireguard";
|
||||
|
||||
export interface WireguardConfig {
|
||||
$type: "xray.transport.internet.headers.wireguard.WireguardConfig";
|
||||
}
|
||||
|
||||
function createBaseWireguardConfig(): WireguardConfig {
|
||||
return { $type: "xray.transport.internet.headers.wireguard.WireguardConfig" };
|
||||
}
|
||||
|
||||
export const WireguardConfig: MessageFns<WireguardConfig, "xray.transport.internet.headers.wireguard.WireguardConfig"> =
|
||||
{
|
||||
$type: "xray.transport.internet.headers.wireguard.WireguardConfig" as const,
|
||||
|
||||
encode(_: WireguardConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): WireguardConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseWireguardConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): WireguardConfig {
|
||||
return { $type: WireguardConfig.$type };
|
||||
},
|
||||
|
||||
toJSON(_: WireguardConfig): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<WireguardConfig>): WireguardConfig {
|
||||
return WireguardConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<WireguardConfig>): WireguardConfig {
|
||||
const message = createBaseWireguardConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(WireguardConfig.$type, WireguardConfig);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
301
src/proto/transport/internet/httpupgrade/config.ts
Normal file
301
src/proto/transport/internet/httpupgrade/config.ts
Normal file
|
|
@ -0,0 +1,301 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/httpupgrade/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.httpupgrade";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.httpupgrade.Config";
|
||||
host: string;
|
||||
path: string;
|
||||
header: { [key: string]: string };
|
||||
acceptProxyProtocol: boolean;
|
||||
ed: number;
|
||||
}
|
||||
|
||||
export interface Config_HeaderEntry {
|
||||
$type: "xray.transport.internet.httpupgrade.Config.HeaderEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.httpupgrade.Config",
|
||||
host: "",
|
||||
path: "",
|
||||
header: {},
|
||||
acceptProxyProtocol: false,
|
||||
ed: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.httpupgrade.Config"> = {
|
||||
$type: "xray.transport.internet.httpupgrade.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.host !== "") {
|
||||
writer.uint32(10).string(message.host);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(18).string(message.path);
|
||||
}
|
||||
globalThis.Object.entries(message.header).forEach(([key, value]: [string, string]) => {
|
||||
Config_HeaderEntry.encode({
|
||||
$type: "xray.transport.internet.httpupgrade.Config.HeaderEntry",
|
||||
key: key as any,
|
||||
value,
|
||||
}, writer.uint32(26).fork()).join();
|
||||
});
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
writer.uint32(32).bool(message.acceptProxyProtocol);
|
||||
}
|
||||
if (message.ed !== 0) {
|
||||
writer.uint32(40).uint32(message.ed);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.host = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.path = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry3 = Config_HeaderEntry.decode(reader, reader.uint32());
|
||||
if (entry3.value !== undefined) {
|
||||
message.header[entry3.key] = entry3.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.acceptProxyProtocol = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ed = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
host: isSet(object.host) ? globalThis.String(object.host) : "",
|
||||
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
||||
header: isObject(object.header)
|
||||
? (globalThis.Object.entries(object.header) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
acceptProxyProtocol: isSet(object.acceptProxyProtocol) ? globalThis.Boolean(object.acceptProxyProtocol) : false,
|
||||
ed: isSet(object.ed) ? globalThis.Number(object.ed) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.host !== "") {
|
||||
obj.host = message.host;
|
||||
}
|
||||
if (message.path !== "") {
|
||||
obj.path = message.path;
|
||||
}
|
||||
if (message.header) {
|
||||
const entries = globalThis.Object.entries(message.header) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.header = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.header[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
obj.acceptProxyProtocol = message.acceptProxyProtocol;
|
||||
}
|
||||
if (message.ed !== 0) {
|
||||
obj.ed = Math.round(message.ed);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.host = object.host ?? "";
|
||||
message.path = object.path ?? "";
|
||||
message.header = (globalThis.Object.entries(object.header ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.acceptProxyProtocol = object.acceptProxyProtocol ?? false;
|
||||
message.ed = object.ed ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConfig_HeaderEntry(): Config_HeaderEntry {
|
||||
return { $type: "xray.transport.internet.httpupgrade.Config.HeaderEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const Config_HeaderEntry: MessageFns<
|
||||
Config_HeaderEntry,
|
||||
"xray.transport.internet.httpupgrade.Config.HeaderEntry"
|
||||
> = {
|
||||
$type: "xray.transport.internet.httpupgrade.Config.HeaderEntry" as const,
|
||||
|
||||
encode(message: Config_HeaderEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config_HeaderEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig_HeaderEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config_HeaderEntry {
|
||||
return {
|
||||
$type: Config_HeaderEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config_HeaderEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config_HeaderEntry>): Config_HeaderEntry {
|
||||
return Config_HeaderEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config_HeaderEntry>): Config_HeaderEntry {
|
||||
const message = createBaseConfig_HeaderEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config_HeaderEntry.$type, Config_HeaderEntry);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
810
src/proto/transport/internet/kcp/config.ts
Normal file
810
src/proto/transport/internet/kcp/config.ts
Normal file
|
|
@ -0,0 +1,810 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/kcp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { TypedMessage } from "../../../common/serial/typed_message";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.kcp";
|
||||
|
||||
/** Maximum Transmission Unit, in bytes. */
|
||||
export interface MTU {
|
||||
$type: "xray.transport.internet.kcp.MTU";
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Transmission Time Interview, in milli-sec. */
|
||||
export interface TTI {
|
||||
$type: "xray.transport.internet.kcp.TTI";
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Uplink capacity, in MB. */
|
||||
export interface UplinkCapacity {
|
||||
$type: "xray.transport.internet.kcp.UplinkCapacity";
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Downlink capacity, in MB. */
|
||||
export interface DownlinkCapacity {
|
||||
$type: "xray.transport.internet.kcp.DownlinkCapacity";
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface WriteBuffer {
|
||||
$type: "xray.transport.internet.kcp.WriteBuffer";
|
||||
/** Buffer size in bytes. */
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface ReadBuffer {
|
||||
$type: "xray.transport.internet.kcp.ReadBuffer";
|
||||
/** Buffer size in bytes. */
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface ConnectionReuse {
|
||||
$type: "xray.transport.internet.kcp.ConnectionReuse";
|
||||
enable: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-shared secret between client and server. It is used for traffic obfuscation.
|
||||
* Note that if seed is absent in the config, the traffic will still be obfuscated,
|
||||
* but by a predefined algorithm.
|
||||
*/
|
||||
export interface EncryptionSeed {
|
||||
$type: "xray.transport.internet.kcp.EncryptionSeed";
|
||||
seed: string;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.kcp.Config";
|
||||
mtu: MTU | undefined;
|
||||
tti: TTI | undefined;
|
||||
uplinkCapacity: UplinkCapacity | undefined;
|
||||
downlinkCapacity: DownlinkCapacity | undefined;
|
||||
congestion: boolean;
|
||||
writeBuffer: WriteBuffer | undefined;
|
||||
readBuffer: ReadBuffer | undefined;
|
||||
headerConfig: TypedMessage | undefined;
|
||||
seed: EncryptionSeed | undefined;
|
||||
}
|
||||
|
||||
function createBaseMTU(): MTU {
|
||||
return { $type: "xray.transport.internet.kcp.MTU", value: 0 };
|
||||
}
|
||||
|
||||
export const MTU: MessageFns<MTU, "xray.transport.internet.kcp.MTU"> = {
|
||||
$type: "xray.transport.internet.kcp.MTU" as const,
|
||||
|
||||
encode(message: MTU, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): MTU {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMTU();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MTU {
|
||||
return { $type: MTU.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: MTU): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<MTU>): MTU {
|
||||
return MTU.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<MTU>): MTU {
|
||||
const message = createBaseMTU();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(MTU.$type, MTU);
|
||||
|
||||
function createBaseTTI(): TTI {
|
||||
return { $type: "xray.transport.internet.kcp.TTI", value: 0 };
|
||||
}
|
||||
|
||||
export const TTI: MessageFns<TTI, "xray.transport.internet.kcp.TTI"> = {
|
||||
$type: "xray.transport.internet.kcp.TTI" as const,
|
||||
|
||||
encode(message: TTI, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TTI {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTTI();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TTI {
|
||||
return { $type: TTI.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: TTI): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<TTI>): TTI {
|
||||
return TTI.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<TTI>): TTI {
|
||||
const message = createBaseTTI();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(TTI.$type, TTI);
|
||||
|
||||
function createBaseUplinkCapacity(): UplinkCapacity {
|
||||
return { $type: "xray.transport.internet.kcp.UplinkCapacity", value: 0 };
|
||||
}
|
||||
|
||||
export const UplinkCapacity: MessageFns<UplinkCapacity, "xray.transport.internet.kcp.UplinkCapacity"> = {
|
||||
$type: "xray.transport.internet.kcp.UplinkCapacity" as const,
|
||||
|
||||
encode(message: UplinkCapacity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UplinkCapacity {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseUplinkCapacity();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): UplinkCapacity {
|
||||
return { $type: UplinkCapacity.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: UplinkCapacity): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<UplinkCapacity>): UplinkCapacity {
|
||||
return UplinkCapacity.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<UplinkCapacity>): UplinkCapacity {
|
||||
const message = createBaseUplinkCapacity();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(UplinkCapacity.$type, UplinkCapacity);
|
||||
|
||||
function createBaseDownlinkCapacity(): DownlinkCapacity {
|
||||
return { $type: "xray.transport.internet.kcp.DownlinkCapacity", value: 0 };
|
||||
}
|
||||
|
||||
export const DownlinkCapacity: MessageFns<DownlinkCapacity, "xray.transport.internet.kcp.DownlinkCapacity"> = {
|
||||
$type: "xray.transport.internet.kcp.DownlinkCapacity" as const,
|
||||
|
||||
encode(message: DownlinkCapacity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DownlinkCapacity {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDownlinkCapacity();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DownlinkCapacity {
|
||||
return { $type: DownlinkCapacity.$type, value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: DownlinkCapacity): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DownlinkCapacity>): DownlinkCapacity {
|
||||
return DownlinkCapacity.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DownlinkCapacity>): DownlinkCapacity {
|
||||
const message = createBaseDownlinkCapacity();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(DownlinkCapacity.$type, DownlinkCapacity);
|
||||
|
||||
function createBaseWriteBuffer(): WriteBuffer {
|
||||
return { $type: "xray.transport.internet.kcp.WriteBuffer", size: 0 };
|
||||
}
|
||||
|
||||
export const WriteBuffer: MessageFns<WriteBuffer, "xray.transport.internet.kcp.WriteBuffer"> = {
|
||||
$type: "xray.transport.internet.kcp.WriteBuffer" as const,
|
||||
|
||||
encode(message: WriteBuffer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.size !== 0) {
|
||||
writer.uint32(8).uint32(message.size);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): WriteBuffer {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseWriteBuffer();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.size = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): WriteBuffer {
|
||||
return { $type: WriteBuffer.$type, size: isSet(object.size) ? globalThis.Number(object.size) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: WriteBuffer): unknown {
|
||||
const obj: any = {};
|
||||
if (message.size !== 0) {
|
||||
obj.size = Math.round(message.size);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<WriteBuffer>): WriteBuffer {
|
||||
return WriteBuffer.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<WriteBuffer>): WriteBuffer {
|
||||
const message = createBaseWriteBuffer();
|
||||
message.size = object.size ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(WriteBuffer.$type, WriteBuffer);
|
||||
|
||||
function createBaseReadBuffer(): ReadBuffer {
|
||||
return { $type: "xray.transport.internet.kcp.ReadBuffer", size: 0 };
|
||||
}
|
||||
|
||||
export const ReadBuffer: MessageFns<ReadBuffer, "xray.transport.internet.kcp.ReadBuffer"> = {
|
||||
$type: "xray.transport.internet.kcp.ReadBuffer" as const,
|
||||
|
||||
encode(message: ReadBuffer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.size !== 0) {
|
||||
writer.uint32(8).uint32(message.size);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ReadBuffer {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseReadBuffer();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.size = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ReadBuffer {
|
||||
return { $type: ReadBuffer.$type, size: isSet(object.size) ? globalThis.Number(object.size) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: ReadBuffer): unknown {
|
||||
const obj: any = {};
|
||||
if (message.size !== 0) {
|
||||
obj.size = Math.round(message.size);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ReadBuffer>): ReadBuffer {
|
||||
return ReadBuffer.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ReadBuffer>): ReadBuffer {
|
||||
const message = createBaseReadBuffer();
|
||||
message.size = object.size ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ReadBuffer.$type, ReadBuffer);
|
||||
|
||||
function createBaseConnectionReuse(): ConnectionReuse {
|
||||
return { $type: "xray.transport.internet.kcp.ConnectionReuse", enable: false };
|
||||
}
|
||||
|
||||
export const ConnectionReuse: MessageFns<ConnectionReuse, "xray.transport.internet.kcp.ConnectionReuse"> = {
|
||||
$type: "xray.transport.internet.kcp.ConnectionReuse" as const,
|
||||
|
||||
encode(message: ConnectionReuse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.enable !== false) {
|
||||
writer.uint32(8).bool(message.enable);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ConnectionReuse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConnectionReuse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enable = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ConnectionReuse {
|
||||
return { $type: ConnectionReuse.$type, enable: isSet(object.enable) ? globalThis.Boolean(object.enable) : false };
|
||||
},
|
||||
|
||||
toJSON(message: ConnectionReuse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.enable !== false) {
|
||||
obj.enable = message.enable;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ConnectionReuse>): ConnectionReuse {
|
||||
return ConnectionReuse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ConnectionReuse>): ConnectionReuse {
|
||||
const message = createBaseConnectionReuse();
|
||||
message.enable = object.enable ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(ConnectionReuse.$type, ConnectionReuse);
|
||||
|
||||
function createBaseEncryptionSeed(): EncryptionSeed {
|
||||
return { $type: "xray.transport.internet.kcp.EncryptionSeed", seed: "" };
|
||||
}
|
||||
|
||||
export const EncryptionSeed: MessageFns<EncryptionSeed, "xray.transport.internet.kcp.EncryptionSeed"> = {
|
||||
$type: "xray.transport.internet.kcp.EncryptionSeed" as const,
|
||||
|
||||
encode(message: EncryptionSeed, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.seed !== "") {
|
||||
writer.uint32(10).string(message.seed);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): EncryptionSeed {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseEncryptionSeed();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.seed = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): EncryptionSeed {
|
||||
return { $type: EncryptionSeed.$type, seed: isSet(object.seed) ? globalThis.String(object.seed) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: EncryptionSeed): unknown {
|
||||
const obj: any = {};
|
||||
if (message.seed !== "") {
|
||||
obj.seed = message.seed;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<EncryptionSeed>): EncryptionSeed {
|
||||
return EncryptionSeed.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<EncryptionSeed>): EncryptionSeed {
|
||||
const message = createBaseEncryptionSeed();
|
||||
message.seed = object.seed ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(EncryptionSeed.$type, EncryptionSeed);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.kcp.Config",
|
||||
mtu: undefined,
|
||||
tti: undefined,
|
||||
uplinkCapacity: undefined,
|
||||
downlinkCapacity: undefined,
|
||||
congestion: false,
|
||||
writeBuffer: undefined,
|
||||
readBuffer: undefined,
|
||||
headerConfig: undefined,
|
||||
seed: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.kcp.Config"> = {
|
||||
$type: "xray.transport.internet.kcp.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.mtu !== undefined) {
|
||||
MTU.encode(message.mtu, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.tti !== undefined) {
|
||||
TTI.encode(message.tti, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.uplinkCapacity !== undefined) {
|
||||
UplinkCapacity.encode(message.uplinkCapacity, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.downlinkCapacity !== undefined) {
|
||||
DownlinkCapacity.encode(message.downlinkCapacity, writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.congestion !== false) {
|
||||
writer.uint32(40).bool(message.congestion);
|
||||
}
|
||||
if (message.writeBuffer !== undefined) {
|
||||
WriteBuffer.encode(message.writeBuffer, writer.uint32(50).fork()).join();
|
||||
}
|
||||
if (message.readBuffer !== undefined) {
|
||||
ReadBuffer.encode(message.readBuffer, writer.uint32(58).fork()).join();
|
||||
}
|
||||
if (message.headerConfig !== undefined) {
|
||||
TypedMessage.encode(message.headerConfig, writer.uint32(66).fork()).join();
|
||||
}
|
||||
if (message.seed !== undefined) {
|
||||
EncryptionSeed.encode(message.seed, writer.uint32(82).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mtu = MTU.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tti = TTI.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.uplinkCapacity = UplinkCapacity.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.downlinkCapacity = DownlinkCapacity.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.congestion = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.writeBuffer = WriteBuffer.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.readBuffer = ReadBuffer.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 66) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.headerConfig = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 10: {
|
||||
if (tag !== 82) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.seed = EncryptionSeed.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
mtu: isSet(object.mtu) ? MTU.fromJSON(object.mtu) : undefined,
|
||||
tti: isSet(object.tti) ? TTI.fromJSON(object.tti) : undefined,
|
||||
uplinkCapacity: isSet(object.uplinkCapacity) ? UplinkCapacity.fromJSON(object.uplinkCapacity) : undefined,
|
||||
downlinkCapacity: isSet(object.downlinkCapacity) ? DownlinkCapacity.fromJSON(object.downlinkCapacity) : undefined,
|
||||
congestion: isSet(object.congestion) ? globalThis.Boolean(object.congestion) : false,
|
||||
writeBuffer: isSet(object.writeBuffer) ? WriteBuffer.fromJSON(object.writeBuffer) : undefined,
|
||||
readBuffer: isSet(object.readBuffer) ? ReadBuffer.fromJSON(object.readBuffer) : undefined,
|
||||
headerConfig: isSet(object.headerConfig) ? TypedMessage.fromJSON(object.headerConfig) : undefined,
|
||||
seed: isSet(object.seed) ? EncryptionSeed.fromJSON(object.seed) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.mtu !== undefined) {
|
||||
obj.mtu = MTU.toJSON(message.mtu);
|
||||
}
|
||||
if (message.tti !== undefined) {
|
||||
obj.tti = TTI.toJSON(message.tti);
|
||||
}
|
||||
if (message.uplinkCapacity !== undefined) {
|
||||
obj.uplinkCapacity = UplinkCapacity.toJSON(message.uplinkCapacity);
|
||||
}
|
||||
if (message.downlinkCapacity !== undefined) {
|
||||
obj.downlinkCapacity = DownlinkCapacity.toJSON(message.downlinkCapacity);
|
||||
}
|
||||
if (message.congestion !== false) {
|
||||
obj.congestion = message.congestion;
|
||||
}
|
||||
if (message.writeBuffer !== undefined) {
|
||||
obj.writeBuffer = WriteBuffer.toJSON(message.writeBuffer);
|
||||
}
|
||||
if (message.readBuffer !== undefined) {
|
||||
obj.readBuffer = ReadBuffer.toJSON(message.readBuffer);
|
||||
}
|
||||
if (message.headerConfig !== undefined) {
|
||||
obj.headerConfig = TypedMessage.toJSON(message.headerConfig);
|
||||
}
|
||||
if (message.seed !== undefined) {
|
||||
obj.seed = EncryptionSeed.toJSON(message.seed);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.mtu = (object.mtu !== undefined && object.mtu !== null) ? MTU.fromPartial(object.mtu) : undefined;
|
||||
message.tti = (object.tti !== undefined && object.tti !== null) ? TTI.fromPartial(object.tti) : undefined;
|
||||
message.uplinkCapacity = (object.uplinkCapacity !== undefined && object.uplinkCapacity !== null)
|
||||
? UplinkCapacity.fromPartial(object.uplinkCapacity)
|
||||
: undefined;
|
||||
message.downlinkCapacity = (object.downlinkCapacity !== undefined && object.downlinkCapacity !== null)
|
||||
? DownlinkCapacity.fromPartial(object.downlinkCapacity)
|
||||
: undefined;
|
||||
message.congestion = object.congestion ?? false;
|
||||
message.writeBuffer = (object.writeBuffer !== undefined && object.writeBuffer !== null)
|
||||
? WriteBuffer.fromPartial(object.writeBuffer)
|
||||
: undefined;
|
||||
message.readBuffer = (object.readBuffer !== undefined && object.readBuffer !== null)
|
||||
? ReadBuffer.fromPartial(object.readBuffer)
|
||||
: undefined;
|
||||
message.headerConfig = (object.headerConfig !== undefined && object.headerConfig !== null)
|
||||
? TypedMessage.fromPartial(object.headerConfig)
|
||||
: undefined;
|
||||
message.seed = (object.seed !== undefined && object.seed !== null)
|
||||
? EncryptionSeed.fromPartial(object.seed)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
629
src/proto/transport/internet/reality/config.ts
Normal file
629
src/proto/transport/internet/reality/config.ts
Normal file
|
|
@ -0,0 +1,629 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/reality/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.reality";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.reality.Config";
|
||||
show: boolean;
|
||||
dest: string;
|
||||
type: string;
|
||||
xver: number;
|
||||
serverNames: string[];
|
||||
privateKey: Uint8Array;
|
||||
minClientVer: Uint8Array;
|
||||
maxClientVer: Uint8Array;
|
||||
maxTimeDiff: number;
|
||||
shortIds: Uint8Array[];
|
||||
mldsa65Seed: Uint8Array;
|
||||
limitFallbackUpload: LimitFallback | undefined;
|
||||
limitFallbackDownload: LimitFallback | undefined;
|
||||
Fingerprint: string;
|
||||
serverName: string;
|
||||
publicKey: Uint8Array;
|
||||
shortId: Uint8Array;
|
||||
mldsa65Verify: Uint8Array;
|
||||
spiderX: string;
|
||||
spiderY: number[];
|
||||
masterKeyLog: string;
|
||||
}
|
||||
|
||||
export interface LimitFallback {
|
||||
$type: "xray.transport.internet.reality.LimitFallback";
|
||||
afterBytes: number;
|
||||
bytesPerSec: number;
|
||||
burstBytesPerSec: number;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.reality.Config",
|
||||
show: false,
|
||||
dest: "",
|
||||
type: "",
|
||||
xver: 0,
|
||||
serverNames: [],
|
||||
privateKey: new Uint8Array(0),
|
||||
minClientVer: new Uint8Array(0),
|
||||
maxClientVer: new Uint8Array(0),
|
||||
maxTimeDiff: 0,
|
||||
shortIds: [],
|
||||
mldsa65Seed: new Uint8Array(0),
|
||||
limitFallbackUpload: undefined,
|
||||
limitFallbackDownload: undefined,
|
||||
Fingerprint: "",
|
||||
serverName: "",
|
||||
publicKey: new Uint8Array(0),
|
||||
shortId: new Uint8Array(0),
|
||||
mldsa65Verify: new Uint8Array(0),
|
||||
spiderX: "",
|
||||
spiderY: [],
|
||||
masterKeyLog: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.reality.Config"> = {
|
||||
$type: "xray.transport.internet.reality.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.show !== false) {
|
||||
writer.uint32(8).bool(message.show);
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
writer.uint32(18).string(message.dest);
|
||||
}
|
||||
if (message.type !== "") {
|
||||
writer.uint32(26).string(message.type);
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
writer.uint32(32).uint64(message.xver);
|
||||
}
|
||||
for (const v of message.serverNames) {
|
||||
writer.uint32(42).string(v!);
|
||||
}
|
||||
if (message.privateKey.length !== 0) {
|
||||
writer.uint32(50).bytes(message.privateKey);
|
||||
}
|
||||
if (message.minClientVer.length !== 0) {
|
||||
writer.uint32(58).bytes(message.minClientVer);
|
||||
}
|
||||
if (message.maxClientVer.length !== 0) {
|
||||
writer.uint32(66).bytes(message.maxClientVer);
|
||||
}
|
||||
if (message.maxTimeDiff !== 0) {
|
||||
writer.uint32(72).uint64(message.maxTimeDiff);
|
||||
}
|
||||
for (const v of message.shortIds) {
|
||||
writer.uint32(82).bytes(v!);
|
||||
}
|
||||
if (message.mldsa65Seed.length !== 0) {
|
||||
writer.uint32(90).bytes(message.mldsa65Seed);
|
||||
}
|
||||
if (message.limitFallbackUpload !== undefined) {
|
||||
LimitFallback.encode(message.limitFallbackUpload, writer.uint32(98).fork()).join();
|
||||
}
|
||||
if (message.limitFallbackDownload !== undefined) {
|
||||
LimitFallback.encode(message.limitFallbackDownload, writer.uint32(106).fork()).join();
|
||||
}
|
||||
if (message.Fingerprint !== "") {
|
||||
writer.uint32(170).string(message.Fingerprint);
|
||||
}
|
||||
if (message.serverName !== "") {
|
||||
writer.uint32(178).string(message.serverName);
|
||||
}
|
||||
if (message.publicKey.length !== 0) {
|
||||
writer.uint32(186).bytes(message.publicKey);
|
||||
}
|
||||
if (message.shortId.length !== 0) {
|
||||
writer.uint32(194).bytes(message.shortId);
|
||||
}
|
||||
if (message.mldsa65Verify.length !== 0) {
|
||||
writer.uint32(202).bytes(message.mldsa65Verify);
|
||||
}
|
||||
if (message.spiderX !== "") {
|
||||
writer.uint32(210).string(message.spiderX);
|
||||
}
|
||||
writer.uint32(218).fork();
|
||||
for (const v of message.spiderY) {
|
||||
writer.int64(v);
|
||||
}
|
||||
writer.join();
|
||||
if (message.masterKeyLog !== "") {
|
||||
writer.uint32(250).string(message.masterKeyLog);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.show = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.dest = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xver = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.serverNames.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.privateKey = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.minClientVer = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 66) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxClientVer = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag !== 72) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxTimeDiff = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 10: {
|
||||
if (tag !== 82) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.shortIds.push(reader.bytes());
|
||||
continue;
|
||||
}
|
||||
case 11: {
|
||||
if (tag !== 90) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mldsa65Seed = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 12: {
|
||||
if (tag !== 98) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.limitFallbackUpload = LimitFallback.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 13: {
|
||||
if (tag !== 106) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.limitFallbackDownload = LimitFallback.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 21: {
|
||||
if (tag !== 170) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.Fingerprint = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 22: {
|
||||
if (tag !== 178) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.serverName = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 23: {
|
||||
if (tag !== 186) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.publicKey = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 24: {
|
||||
if (tag !== 194) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.shortId = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 25: {
|
||||
if (tag !== 202) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mldsa65Verify = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 26: {
|
||||
if (tag !== 210) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.spiderX = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 27: {
|
||||
if (tag === 216) {
|
||||
message.spiderY.push(longToNumber(reader.int64()));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tag === 218) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.spiderY.push(longToNumber(reader.int64()));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 31: {
|
||||
if (tag !== 250) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.masterKeyLog = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
show: isSet(object.show) ? globalThis.Boolean(object.show) : false,
|
||||
dest: isSet(object.dest) ? globalThis.String(object.dest) : "",
|
||||
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
||||
xver: isSet(object.xver) ? globalThis.Number(object.xver) : 0,
|
||||
serverNames: globalThis.Array.isArray(object?.serverNames)
|
||||
? object.serverNames.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
privateKey: isSet(object.privateKey) ? bytesFromBase64(object.privateKey) : new Uint8Array(0),
|
||||
minClientVer: isSet(object.minClientVer) ? bytesFromBase64(object.minClientVer) : new Uint8Array(0),
|
||||
maxClientVer: isSet(object.maxClientVer) ? bytesFromBase64(object.maxClientVer) : new Uint8Array(0),
|
||||
maxTimeDiff: isSet(object.maxTimeDiff) ? globalThis.Number(object.maxTimeDiff) : 0,
|
||||
shortIds: globalThis.Array.isArray(object?.shortIds) ? object.shortIds.map((e: any) => bytesFromBase64(e)) : [],
|
||||
mldsa65Seed: isSet(object.mldsa65Seed) ? bytesFromBase64(object.mldsa65Seed) : new Uint8Array(0),
|
||||
limitFallbackUpload: isSet(object.limitFallbackUpload)
|
||||
? LimitFallback.fromJSON(object.limitFallbackUpload)
|
||||
: undefined,
|
||||
limitFallbackDownload: isSet(object.limitFallbackDownload)
|
||||
? LimitFallback.fromJSON(object.limitFallbackDownload)
|
||||
: undefined,
|
||||
Fingerprint: isSet(object.Fingerprint) ? globalThis.String(object.Fingerprint) : "",
|
||||
serverName: isSet(object.serverName) ? globalThis.String(object.serverName) : "",
|
||||
publicKey: isSet(object.publicKey) ? bytesFromBase64(object.publicKey) : new Uint8Array(0),
|
||||
shortId: isSet(object.shortId) ? bytesFromBase64(object.shortId) : new Uint8Array(0),
|
||||
mldsa65Verify: isSet(object.mldsa65Verify) ? bytesFromBase64(object.mldsa65Verify) : new Uint8Array(0),
|
||||
spiderX: isSet(object.spiderX) ? globalThis.String(object.spiderX) : "",
|
||||
spiderY: globalThis.Array.isArray(object?.spiderY) ? object.spiderY.map((e: any) => globalThis.Number(e)) : [],
|
||||
masterKeyLog: isSet(object.masterKeyLog) ? globalThis.String(object.masterKeyLog) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.show !== false) {
|
||||
obj.show = message.show;
|
||||
}
|
||||
if (message.dest !== "") {
|
||||
obj.dest = message.dest;
|
||||
}
|
||||
if (message.type !== "") {
|
||||
obj.type = message.type;
|
||||
}
|
||||
if (message.xver !== 0) {
|
||||
obj.xver = Math.round(message.xver);
|
||||
}
|
||||
if (message.serverNames?.length) {
|
||||
obj.serverNames = message.serverNames;
|
||||
}
|
||||
if (message.privateKey.length !== 0) {
|
||||
obj.privateKey = base64FromBytes(message.privateKey);
|
||||
}
|
||||
if (message.minClientVer.length !== 0) {
|
||||
obj.minClientVer = base64FromBytes(message.minClientVer);
|
||||
}
|
||||
if (message.maxClientVer.length !== 0) {
|
||||
obj.maxClientVer = base64FromBytes(message.maxClientVer);
|
||||
}
|
||||
if (message.maxTimeDiff !== 0) {
|
||||
obj.maxTimeDiff = Math.round(message.maxTimeDiff);
|
||||
}
|
||||
if (message.shortIds?.length) {
|
||||
obj.shortIds = message.shortIds.map((e) => base64FromBytes(e));
|
||||
}
|
||||
if (message.mldsa65Seed.length !== 0) {
|
||||
obj.mldsa65Seed = base64FromBytes(message.mldsa65Seed);
|
||||
}
|
||||
if (message.limitFallbackUpload !== undefined) {
|
||||
obj.limitFallbackUpload = LimitFallback.toJSON(message.limitFallbackUpload);
|
||||
}
|
||||
if (message.limitFallbackDownload !== undefined) {
|
||||
obj.limitFallbackDownload = LimitFallback.toJSON(message.limitFallbackDownload);
|
||||
}
|
||||
if (message.Fingerprint !== "") {
|
||||
obj.Fingerprint = message.Fingerprint;
|
||||
}
|
||||
if (message.serverName !== "") {
|
||||
obj.serverName = message.serverName;
|
||||
}
|
||||
if (message.publicKey.length !== 0) {
|
||||
obj.publicKey = base64FromBytes(message.publicKey);
|
||||
}
|
||||
if (message.shortId.length !== 0) {
|
||||
obj.shortId = base64FromBytes(message.shortId);
|
||||
}
|
||||
if (message.mldsa65Verify.length !== 0) {
|
||||
obj.mldsa65Verify = base64FromBytes(message.mldsa65Verify);
|
||||
}
|
||||
if (message.spiderX !== "") {
|
||||
obj.spiderX = message.spiderX;
|
||||
}
|
||||
if (message.spiderY?.length) {
|
||||
obj.spiderY = message.spiderY.map((e) => Math.round(e));
|
||||
}
|
||||
if (message.masterKeyLog !== "") {
|
||||
obj.masterKeyLog = message.masterKeyLog;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.show = object.show ?? false;
|
||||
message.dest = object.dest ?? "";
|
||||
message.type = object.type ?? "";
|
||||
message.xver = object.xver ?? 0;
|
||||
message.serverNames = object.serverNames?.map((e) => e) || [];
|
||||
message.privateKey = object.privateKey ?? new Uint8Array(0);
|
||||
message.minClientVer = object.minClientVer ?? new Uint8Array(0);
|
||||
message.maxClientVer = object.maxClientVer ?? new Uint8Array(0);
|
||||
message.maxTimeDiff = object.maxTimeDiff ?? 0;
|
||||
message.shortIds = object.shortIds?.map((e) => e) || [];
|
||||
message.mldsa65Seed = object.mldsa65Seed ?? new Uint8Array(0);
|
||||
message.limitFallbackUpload = (object.limitFallbackUpload !== undefined && object.limitFallbackUpload !== null)
|
||||
? LimitFallback.fromPartial(object.limitFallbackUpload)
|
||||
: undefined;
|
||||
message.limitFallbackDownload =
|
||||
(object.limitFallbackDownload !== undefined && object.limitFallbackDownload !== null)
|
||||
? LimitFallback.fromPartial(object.limitFallbackDownload)
|
||||
: undefined;
|
||||
message.Fingerprint = object.Fingerprint ?? "";
|
||||
message.serverName = object.serverName ?? "";
|
||||
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
||||
message.shortId = object.shortId ?? new Uint8Array(0);
|
||||
message.mldsa65Verify = object.mldsa65Verify ?? new Uint8Array(0);
|
||||
message.spiderX = object.spiderX ?? "";
|
||||
message.spiderY = object.spiderY?.map((e) => e) || [];
|
||||
message.masterKeyLog = object.masterKeyLog ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseLimitFallback(): LimitFallback {
|
||||
return { $type: "xray.transport.internet.reality.LimitFallback", afterBytes: 0, bytesPerSec: 0, burstBytesPerSec: 0 };
|
||||
}
|
||||
|
||||
export const LimitFallback: MessageFns<LimitFallback, "xray.transport.internet.reality.LimitFallback"> = {
|
||||
$type: "xray.transport.internet.reality.LimitFallback" as const,
|
||||
|
||||
encode(message: LimitFallback, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.afterBytes !== 0) {
|
||||
writer.uint32(8).uint64(message.afterBytes);
|
||||
}
|
||||
if (message.bytesPerSec !== 0) {
|
||||
writer.uint32(16).uint64(message.bytesPerSec);
|
||||
}
|
||||
if (message.burstBytesPerSec !== 0) {
|
||||
writer.uint32(24).uint64(message.burstBytesPerSec);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): LimitFallback {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseLimitFallback();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.afterBytes = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.bytesPerSec = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.burstBytesPerSec = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): LimitFallback {
|
||||
return {
|
||||
$type: LimitFallback.$type,
|
||||
afterBytes: isSet(object.afterBytes) ? globalThis.Number(object.afterBytes) : 0,
|
||||
bytesPerSec: isSet(object.bytesPerSec) ? globalThis.Number(object.bytesPerSec) : 0,
|
||||
burstBytesPerSec: isSet(object.burstBytesPerSec) ? globalThis.Number(object.burstBytesPerSec) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: LimitFallback): unknown {
|
||||
const obj: any = {};
|
||||
if (message.afterBytes !== 0) {
|
||||
obj.afterBytes = Math.round(message.afterBytes);
|
||||
}
|
||||
if (message.bytesPerSec !== 0) {
|
||||
obj.bytesPerSec = Math.round(message.bytesPerSec);
|
||||
}
|
||||
if (message.burstBytesPerSec !== 0) {
|
||||
obj.burstBytesPerSec = Math.round(message.burstBytesPerSec);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<LimitFallback>): LimitFallback {
|
||||
return LimitFallback.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<LimitFallback>): LimitFallback {
|
||||
const message = createBaseLimitFallback();
|
||||
message.afterBytes = object.afterBytes ?? 0;
|
||||
message.bytesPerSec = object.bytesPerSec ?? 0;
|
||||
message.burstBytesPerSec = object.burstBytesPerSec ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(LimitFallback.$type, LimitFallback);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
735
src/proto/transport/internet/splithttp/config.ts
Normal file
735
src/proto/transport/internet/splithttp/config.ts
Normal file
|
|
@ -0,0 +1,735 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/splithttp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
import { StreamConfig } from "../config";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.splithttp";
|
||||
|
||||
export interface RangeConfig {
|
||||
$type: "xray.transport.internet.splithttp.RangeConfig";
|
||||
from: number;
|
||||
to: number;
|
||||
}
|
||||
|
||||
export interface XmuxConfig {
|
||||
$type: "xray.transport.internet.splithttp.XmuxConfig";
|
||||
maxConcurrency: RangeConfig | undefined;
|
||||
maxConnections: RangeConfig | undefined;
|
||||
cMaxReuseTimes: RangeConfig | undefined;
|
||||
hMaxRequestTimes: RangeConfig | undefined;
|
||||
hMaxReusableSecs: RangeConfig | undefined;
|
||||
hKeepAlivePeriod: number;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.splithttp.Config";
|
||||
host: string;
|
||||
path: string;
|
||||
mode: string;
|
||||
headers: { [key: string]: string };
|
||||
xPaddingBytes: RangeConfig | undefined;
|
||||
noGRPCHeader: boolean;
|
||||
noSSEHeader: boolean;
|
||||
scMaxEachPostBytes: RangeConfig | undefined;
|
||||
scMinPostsIntervalMs: RangeConfig | undefined;
|
||||
scMaxBufferedPosts: number;
|
||||
scStreamUpServerSecs: RangeConfig | undefined;
|
||||
xmux: XmuxConfig | undefined;
|
||||
downloadSettings: StreamConfig | undefined;
|
||||
}
|
||||
|
||||
export interface Config_HeadersEntry {
|
||||
$type: "xray.transport.internet.splithttp.Config.HeadersEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function createBaseRangeConfig(): RangeConfig {
|
||||
return { $type: "xray.transport.internet.splithttp.RangeConfig", from: 0, to: 0 };
|
||||
}
|
||||
|
||||
export const RangeConfig: MessageFns<RangeConfig, "xray.transport.internet.splithttp.RangeConfig"> = {
|
||||
$type: "xray.transport.internet.splithttp.RangeConfig" as const,
|
||||
|
||||
encode(message: RangeConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.from !== 0) {
|
||||
writer.uint32(8).int32(message.from);
|
||||
}
|
||||
if (message.to !== 0) {
|
||||
writer.uint32(16).int32(message.to);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RangeConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRangeConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.from = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.to = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RangeConfig {
|
||||
return {
|
||||
$type: RangeConfig.$type,
|
||||
from: isSet(object.from) ? globalThis.Number(object.from) : 0,
|
||||
to: isSet(object.to) ? globalThis.Number(object.to) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RangeConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.from !== 0) {
|
||||
obj.from = Math.round(message.from);
|
||||
}
|
||||
if (message.to !== 0) {
|
||||
obj.to = Math.round(message.to);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<RangeConfig>): RangeConfig {
|
||||
return RangeConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<RangeConfig>): RangeConfig {
|
||||
const message = createBaseRangeConfig();
|
||||
message.from = object.from ?? 0;
|
||||
message.to = object.to ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(RangeConfig.$type, RangeConfig);
|
||||
|
||||
function createBaseXmuxConfig(): XmuxConfig {
|
||||
return {
|
||||
$type: "xray.transport.internet.splithttp.XmuxConfig",
|
||||
maxConcurrency: undefined,
|
||||
maxConnections: undefined,
|
||||
cMaxReuseTimes: undefined,
|
||||
hMaxRequestTimes: undefined,
|
||||
hMaxReusableSecs: undefined,
|
||||
hKeepAlivePeriod: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const XmuxConfig: MessageFns<XmuxConfig, "xray.transport.internet.splithttp.XmuxConfig"> = {
|
||||
$type: "xray.transport.internet.splithttp.XmuxConfig" as const,
|
||||
|
||||
encode(message: XmuxConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.maxConcurrency !== undefined) {
|
||||
RangeConfig.encode(message.maxConcurrency, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.maxConnections !== undefined) {
|
||||
RangeConfig.encode(message.maxConnections, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.cMaxReuseTimes !== undefined) {
|
||||
RangeConfig.encode(message.cMaxReuseTimes, writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.hMaxRequestTimes !== undefined) {
|
||||
RangeConfig.encode(message.hMaxRequestTimes, writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.hMaxReusableSecs !== undefined) {
|
||||
RangeConfig.encode(message.hMaxReusableSecs, writer.uint32(42).fork()).join();
|
||||
}
|
||||
if (message.hKeepAlivePeriod !== 0) {
|
||||
writer.uint32(48).int64(message.hKeepAlivePeriod);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): XmuxConfig {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseXmuxConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxConcurrency = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxConnections = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.cMaxReuseTimes = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.hMaxRequestTimes = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.hMaxReusableSecs = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.hKeepAlivePeriod = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): XmuxConfig {
|
||||
return {
|
||||
$type: XmuxConfig.$type,
|
||||
maxConcurrency: isSet(object.maxConcurrency) ? RangeConfig.fromJSON(object.maxConcurrency) : undefined,
|
||||
maxConnections: isSet(object.maxConnections) ? RangeConfig.fromJSON(object.maxConnections) : undefined,
|
||||
cMaxReuseTimes: isSet(object.cMaxReuseTimes) ? RangeConfig.fromJSON(object.cMaxReuseTimes) : undefined,
|
||||
hMaxRequestTimes: isSet(object.hMaxRequestTimes) ? RangeConfig.fromJSON(object.hMaxRequestTimes) : undefined,
|
||||
hMaxReusableSecs: isSet(object.hMaxReusableSecs) ? RangeConfig.fromJSON(object.hMaxReusableSecs) : undefined,
|
||||
hKeepAlivePeriod: isSet(object.hKeepAlivePeriod) ? globalThis.Number(object.hKeepAlivePeriod) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: XmuxConfig): unknown {
|
||||
const obj: any = {};
|
||||
if (message.maxConcurrency !== undefined) {
|
||||
obj.maxConcurrency = RangeConfig.toJSON(message.maxConcurrency);
|
||||
}
|
||||
if (message.maxConnections !== undefined) {
|
||||
obj.maxConnections = RangeConfig.toJSON(message.maxConnections);
|
||||
}
|
||||
if (message.cMaxReuseTimes !== undefined) {
|
||||
obj.cMaxReuseTimes = RangeConfig.toJSON(message.cMaxReuseTimes);
|
||||
}
|
||||
if (message.hMaxRequestTimes !== undefined) {
|
||||
obj.hMaxRequestTimes = RangeConfig.toJSON(message.hMaxRequestTimes);
|
||||
}
|
||||
if (message.hMaxReusableSecs !== undefined) {
|
||||
obj.hMaxReusableSecs = RangeConfig.toJSON(message.hMaxReusableSecs);
|
||||
}
|
||||
if (message.hKeepAlivePeriod !== 0) {
|
||||
obj.hKeepAlivePeriod = Math.round(message.hKeepAlivePeriod);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<XmuxConfig>): XmuxConfig {
|
||||
return XmuxConfig.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<XmuxConfig>): XmuxConfig {
|
||||
const message = createBaseXmuxConfig();
|
||||
message.maxConcurrency = (object.maxConcurrency !== undefined && object.maxConcurrency !== null)
|
||||
? RangeConfig.fromPartial(object.maxConcurrency)
|
||||
: undefined;
|
||||
message.maxConnections = (object.maxConnections !== undefined && object.maxConnections !== null)
|
||||
? RangeConfig.fromPartial(object.maxConnections)
|
||||
: undefined;
|
||||
message.cMaxReuseTimes = (object.cMaxReuseTimes !== undefined && object.cMaxReuseTimes !== null)
|
||||
? RangeConfig.fromPartial(object.cMaxReuseTimes)
|
||||
: undefined;
|
||||
message.hMaxRequestTimes = (object.hMaxRequestTimes !== undefined && object.hMaxRequestTimes !== null)
|
||||
? RangeConfig.fromPartial(object.hMaxRequestTimes)
|
||||
: undefined;
|
||||
message.hMaxReusableSecs = (object.hMaxReusableSecs !== undefined && object.hMaxReusableSecs !== null)
|
||||
? RangeConfig.fromPartial(object.hMaxReusableSecs)
|
||||
: undefined;
|
||||
message.hKeepAlivePeriod = object.hKeepAlivePeriod ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(XmuxConfig.$type, XmuxConfig);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.splithttp.Config",
|
||||
host: "",
|
||||
path: "",
|
||||
mode: "",
|
||||
headers: {},
|
||||
xPaddingBytes: undefined,
|
||||
noGRPCHeader: false,
|
||||
noSSEHeader: false,
|
||||
scMaxEachPostBytes: undefined,
|
||||
scMinPostsIntervalMs: undefined,
|
||||
scMaxBufferedPosts: 0,
|
||||
scStreamUpServerSecs: undefined,
|
||||
xmux: undefined,
|
||||
downloadSettings: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.splithttp.Config"> = {
|
||||
$type: "xray.transport.internet.splithttp.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.host !== "") {
|
||||
writer.uint32(10).string(message.host);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(18).string(message.path);
|
||||
}
|
||||
if (message.mode !== "") {
|
||||
writer.uint32(26).string(message.mode);
|
||||
}
|
||||
globalThis.Object.entries(message.headers).forEach(([key, value]: [string, string]) => {
|
||||
Config_HeadersEntry.encode({
|
||||
$type: "xray.transport.internet.splithttp.Config.HeadersEntry",
|
||||
key: key as any,
|
||||
value,
|
||||
}, writer.uint32(34).fork()).join();
|
||||
});
|
||||
if (message.xPaddingBytes !== undefined) {
|
||||
RangeConfig.encode(message.xPaddingBytes, writer.uint32(42).fork()).join();
|
||||
}
|
||||
if (message.noGRPCHeader !== false) {
|
||||
writer.uint32(48).bool(message.noGRPCHeader);
|
||||
}
|
||||
if (message.noSSEHeader !== false) {
|
||||
writer.uint32(56).bool(message.noSSEHeader);
|
||||
}
|
||||
if (message.scMaxEachPostBytes !== undefined) {
|
||||
RangeConfig.encode(message.scMaxEachPostBytes, writer.uint32(66).fork()).join();
|
||||
}
|
||||
if (message.scMinPostsIntervalMs !== undefined) {
|
||||
RangeConfig.encode(message.scMinPostsIntervalMs, writer.uint32(74).fork()).join();
|
||||
}
|
||||
if (message.scMaxBufferedPosts !== 0) {
|
||||
writer.uint32(80).int64(message.scMaxBufferedPosts);
|
||||
}
|
||||
if (message.scStreamUpServerSecs !== undefined) {
|
||||
RangeConfig.encode(message.scStreamUpServerSecs, writer.uint32(90).fork()).join();
|
||||
}
|
||||
if (message.xmux !== undefined) {
|
||||
XmuxConfig.encode(message.xmux, writer.uint32(98).fork()).join();
|
||||
}
|
||||
if (message.downloadSettings !== undefined) {
|
||||
StreamConfig.encode(message.downloadSettings, writer.uint32(106).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.host = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.path = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mode = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry4 = Config_HeadersEntry.decode(reader, reader.uint32());
|
||||
if (entry4.value !== undefined) {
|
||||
message.headers[entry4.key] = entry4.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xPaddingBytes = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.noGRPCHeader = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.noSSEHeader = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 66) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.scMaxEachPostBytes = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag !== 74) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.scMinPostsIntervalMs = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 10: {
|
||||
if (tag !== 80) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.scMaxBufferedPosts = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 11: {
|
||||
if (tag !== 90) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.scStreamUpServerSecs = RangeConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 12: {
|
||||
if (tag !== 98) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.xmux = XmuxConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 13: {
|
||||
if (tag !== 106) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.downloadSettings = StreamConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
host: isSet(object.host) ? globalThis.String(object.host) : "",
|
||||
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
||||
mode: isSet(object.mode) ? globalThis.String(object.mode) : "",
|
||||
headers: isObject(object.headers)
|
||||
? (globalThis.Object.entries(object.headers) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
xPaddingBytes: isSet(object.xPaddingBytes) ? RangeConfig.fromJSON(object.xPaddingBytes) : undefined,
|
||||
noGRPCHeader: isSet(object.noGRPCHeader) ? globalThis.Boolean(object.noGRPCHeader) : false,
|
||||
noSSEHeader: isSet(object.noSSEHeader) ? globalThis.Boolean(object.noSSEHeader) : false,
|
||||
scMaxEachPostBytes: isSet(object.scMaxEachPostBytes)
|
||||
? RangeConfig.fromJSON(object.scMaxEachPostBytes)
|
||||
: undefined,
|
||||
scMinPostsIntervalMs: isSet(object.scMinPostsIntervalMs)
|
||||
? RangeConfig.fromJSON(object.scMinPostsIntervalMs)
|
||||
: undefined,
|
||||
scMaxBufferedPosts: isSet(object.scMaxBufferedPosts) ? globalThis.Number(object.scMaxBufferedPosts) : 0,
|
||||
scStreamUpServerSecs: isSet(object.scStreamUpServerSecs)
|
||||
? RangeConfig.fromJSON(object.scStreamUpServerSecs)
|
||||
: undefined,
|
||||
xmux: isSet(object.xmux) ? XmuxConfig.fromJSON(object.xmux) : undefined,
|
||||
downloadSettings: isSet(object.downloadSettings) ? StreamConfig.fromJSON(object.downloadSettings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.host !== "") {
|
||||
obj.host = message.host;
|
||||
}
|
||||
if (message.path !== "") {
|
||||
obj.path = message.path;
|
||||
}
|
||||
if (message.mode !== "") {
|
||||
obj.mode = message.mode;
|
||||
}
|
||||
if (message.headers) {
|
||||
const entries = globalThis.Object.entries(message.headers) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.headers = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.headers[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.xPaddingBytes !== undefined) {
|
||||
obj.xPaddingBytes = RangeConfig.toJSON(message.xPaddingBytes);
|
||||
}
|
||||
if (message.noGRPCHeader !== false) {
|
||||
obj.noGRPCHeader = message.noGRPCHeader;
|
||||
}
|
||||
if (message.noSSEHeader !== false) {
|
||||
obj.noSSEHeader = message.noSSEHeader;
|
||||
}
|
||||
if (message.scMaxEachPostBytes !== undefined) {
|
||||
obj.scMaxEachPostBytes = RangeConfig.toJSON(message.scMaxEachPostBytes);
|
||||
}
|
||||
if (message.scMinPostsIntervalMs !== undefined) {
|
||||
obj.scMinPostsIntervalMs = RangeConfig.toJSON(message.scMinPostsIntervalMs);
|
||||
}
|
||||
if (message.scMaxBufferedPosts !== 0) {
|
||||
obj.scMaxBufferedPosts = Math.round(message.scMaxBufferedPosts);
|
||||
}
|
||||
if (message.scStreamUpServerSecs !== undefined) {
|
||||
obj.scStreamUpServerSecs = RangeConfig.toJSON(message.scStreamUpServerSecs);
|
||||
}
|
||||
if (message.xmux !== undefined) {
|
||||
obj.xmux = XmuxConfig.toJSON(message.xmux);
|
||||
}
|
||||
if (message.downloadSettings !== undefined) {
|
||||
obj.downloadSettings = StreamConfig.toJSON(message.downloadSettings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.host = object.host ?? "";
|
||||
message.path = object.path ?? "";
|
||||
message.mode = object.mode ?? "";
|
||||
message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.xPaddingBytes = (object.xPaddingBytes !== undefined && object.xPaddingBytes !== null)
|
||||
? RangeConfig.fromPartial(object.xPaddingBytes)
|
||||
: undefined;
|
||||
message.noGRPCHeader = object.noGRPCHeader ?? false;
|
||||
message.noSSEHeader = object.noSSEHeader ?? false;
|
||||
message.scMaxEachPostBytes = (object.scMaxEachPostBytes !== undefined && object.scMaxEachPostBytes !== null)
|
||||
? RangeConfig.fromPartial(object.scMaxEachPostBytes)
|
||||
: undefined;
|
||||
message.scMinPostsIntervalMs = (object.scMinPostsIntervalMs !== undefined && object.scMinPostsIntervalMs !== null)
|
||||
? RangeConfig.fromPartial(object.scMinPostsIntervalMs)
|
||||
: undefined;
|
||||
message.scMaxBufferedPosts = object.scMaxBufferedPosts ?? 0;
|
||||
message.scStreamUpServerSecs = (object.scStreamUpServerSecs !== undefined && object.scStreamUpServerSecs !== null)
|
||||
? RangeConfig.fromPartial(object.scStreamUpServerSecs)
|
||||
: undefined;
|
||||
message.xmux = (object.xmux !== undefined && object.xmux !== null)
|
||||
? XmuxConfig.fromPartial(object.xmux)
|
||||
: undefined;
|
||||
message.downloadSettings = (object.downloadSettings !== undefined && object.downloadSettings !== null)
|
||||
? StreamConfig.fromPartial(object.downloadSettings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConfig_HeadersEntry(): Config_HeadersEntry {
|
||||
return { $type: "xray.transport.internet.splithttp.Config.HeadersEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const Config_HeadersEntry: MessageFns<
|
||||
Config_HeadersEntry,
|
||||
"xray.transport.internet.splithttp.Config.HeadersEntry"
|
||||
> = {
|
||||
$type: "xray.transport.internet.splithttp.Config.HeadersEntry" as const,
|
||||
|
||||
encode(message: Config_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config_HeadersEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig_HeadersEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config_HeadersEntry {
|
||||
return {
|
||||
$type: Config_HeadersEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config_HeadersEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config_HeadersEntry>): Config_HeadersEntry {
|
||||
return Config_HeadersEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config_HeadersEntry>): Config_HeadersEntry {
|
||||
const message = createBaseConfig_HeadersEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config_HeadersEntry.$type, Config_HeadersEntry);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
123
src/proto/transport/internet/tcp/config.ts
Normal file
123
src/proto/transport/internet/tcp/config.ts
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/tcp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { TypedMessage } from "../../../common/serial/typed_message";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.tcp";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.tcp.Config";
|
||||
headerSettings: TypedMessage | undefined;
|
||||
acceptProxyProtocol: boolean;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.tcp.Config", headerSettings: undefined, acceptProxyProtocol: false };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.tcp.Config"> = {
|
||||
$type: "xray.transport.internet.tcp.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.headerSettings !== undefined) {
|
||||
TypedMessage.encode(message.headerSettings, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
writer.uint32(24).bool(message.acceptProxyProtocol);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.headerSettings = TypedMessage.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.acceptProxyProtocol = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
headerSettings: isSet(object.headerSettings) ? TypedMessage.fromJSON(object.headerSettings) : undefined,
|
||||
acceptProxyProtocol: isSet(object.acceptProxyProtocol) ? globalThis.Boolean(object.acceptProxyProtocol) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.headerSettings !== undefined) {
|
||||
obj.headerSettings = TypedMessage.toJSON(message.headerSettings);
|
||||
}
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
obj.acceptProxyProtocol = message.acceptProxyProtocol;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.headerSettings = (object.headerSettings !== undefined && object.headerSettings !== null)
|
||||
? TypedMessage.fromPartial(object.headerSettings)
|
||||
: undefined;
|
||||
message.acceptProxyProtocol = object.acceptProxyProtocol ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
775
src/proto/transport/internet/tls/config.ts
Normal file
775
src/proto/transport/internet/tls/config.ts
Normal file
|
|
@ -0,0 +1,775 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/tls/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
import { SocketConfig } from "../config";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.tls";
|
||||
|
||||
export interface Certificate {
|
||||
$type: "xray.transport.internet.tls.Certificate";
|
||||
/** TLS certificate in x509 format. */
|
||||
certificate: Uint8Array;
|
||||
/** TLS key in x509 format. */
|
||||
key: Uint8Array;
|
||||
usage: Certificate_Usage;
|
||||
ocspStapling: number;
|
||||
/** TLS certificate path */
|
||||
certificatePath: string;
|
||||
/** TLS Key path */
|
||||
keyPath: string;
|
||||
/** If true, one-Time Loading */
|
||||
OneTimeLoading: boolean;
|
||||
buildChain: boolean;
|
||||
}
|
||||
|
||||
export enum Certificate_Usage {
|
||||
ENCIPHERMENT = 0,
|
||||
AUTHORITY_VERIFY = 1,
|
||||
AUTHORITY_ISSUE = 2,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function certificate_UsageFromJSON(object: any): Certificate_Usage {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "ENCIPHERMENT":
|
||||
return Certificate_Usage.ENCIPHERMENT;
|
||||
case 1:
|
||||
case "AUTHORITY_VERIFY":
|
||||
return Certificate_Usage.AUTHORITY_VERIFY;
|
||||
case 2:
|
||||
case "AUTHORITY_ISSUE":
|
||||
return Certificate_Usage.AUTHORITY_ISSUE;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Certificate_Usage.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function certificate_UsageToJSON(object: Certificate_Usage): string {
|
||||
switch (object) {
|
||||
case Certificate_Usage.ENCIPHERMENT:
|
||||
return "ENCIPHERMENT";
|
||||
case Certificate_Usage.AUTHORITY_VERIFY:
|
||||
return "AUTHORITY_VERIFY";
|
||||
case Certificate_Usage.AUTHORITY_ISSUE:
|
||||
return "AUTHORITY_ISSUE";
|
||||
case Certificate_Usage.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.tls.Config";
|
||||
/** Whether or not to allow self-signed certificates. */
|
||||
allowInsecure: boolean;
|
||||
/** List of certificates to be served on server. */
|
||||
certificate: Certificate[];
|
||||
/** Override server name. */
|
||||
serverName: string;
|
||||
/** Lists of string as ALPN values. */
|
||||
nextProtocol: string[];
|
||||
/** Whether or not to enable session (ticket) resumption. */
|
||||
enableSessionResumption: boolean;
|
||||
/**
|
||||
* If true, root certificates on the system will not be loaded for
|
||||
* verification.
|
||||
*/
|
||||
disableSystemRoot: boolean;
|
||||
/** The minimum TLS version. */
|
||||
minVersion: string;
|
||||
/** The maximum TLS version. */
|
||||
maxVersion: string;
|
||||
/** Specify cipher suites, except for TLS 1.3. */
|
||||
cipherSuites: string;
|
||||
/** TLS Client Hello fingerprint (uTLS). */
|
||||
fingerprint: string;
|
||||
rejectUnknownSni: boolean;
|
||||
/**
|
||||
* @Document Some certificate chain sha256 hashes.
|
||||
* @Document After normal validation or allow_insecure, if the server's cert chain hash does not match any of these values, the connection will be aborted.
|
||||
* @Critical
|
||||
*/
|
||||
pinnedPeerCertificateChainSha256: Uint8Array[];
|
||||
/**
|
||||
* @Document Some certificate public key sha256 hashes.
|
||||
* @Document After normal validation (required), if one of certs in verified chain matches one of these values, the connection will be eventually accepted.
|
||||
* @Critical
|
||||
*/
|
||||
pinnedPeerCertificatePublicKeySha256: Uint8Array[];
|
||||
masterKeyLog: string;
|
||||
/** Lists of string as CurvePreferences values. */
|
||||
curvePreferences: string[];
|
||||
/**
|
||||
* @Document Replaces server_name to verify the peer cert.
|
||||
* @Document After allow_insecure (automatically), if the server's cert can't be verified by any of these names, pinned_peer_certificate_chain_sha256 will be tried.
|
||||
* @Critical
|
||||
*/
|
||||
verifyPeerCertInNames: string[];
|
||||
echServerKeys: Uint8Array;
|
||||
echConfigList: string;
|
||||
echForceQuery: string;
|
||||
echSocketSettings: SocketConfig | undefined;
|
||||
}
|
||||
|
||||
function createBaseCertificate(): Certificate {
|
||||
return {
|
||||
$type: "xray.transport.internet.tls.Certificate",
|
||||
certificate: new Uint8Array(0),
|
||||
key: new Uint8Array(0),
|
||||
usage: 0,
|
||||
ocspStapling: 0,
|
||||
certificatePath: "",
|
||||
keyPath: "",
|
||||
OneTimeLoading: false,
|
||||
buildChain: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const Certificate: MessageFns<Certificate, "xray.transport.internet.tls.Certificate"> = {
|
||||
$type: "xray.transport.internet.tls.Certificate" as const,
|
||||
|
||||
encode(message: Certificate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.certificate.length !== 0) {
|
||||
writer.uint32(10).bytes(message.certificate);
|
||||
}
|
||||
if (message.key.length !== 0) {
|
||||
writer.uint32(18).bytes(message.key);
|
||||
}
|
||||
if (message.usage !== 0) {
|
||||
writer.uint32(24).int32(message.usage);
|
||||
}
|
||||
if (message.ocspStapling !== 0) {
|
||||
writer.uint32(32).uint64(message.ocspStapling);
|
||||
}
|
||||
if (message.certificatePath !== "") {
|
||||
writer.uint32(42).string(message.certificatePath);
|
||||
}
|
||||
if (message.keyPath !== "") {
|
||||
writer.uint32(50).string(message.keyPath);
|
||||
}
|
||||
if (message.OneTimeLoading !== false) {
|
||||
writer.uint32(56).bool(message.OneTimeLoading);
|
||||
}
|
||||
if (message.buildChain !== false) {
|
||||
writer.uint32(64).bool(message.buildChain);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Certificate {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseCertificate();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.certificate = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.usage = reader.int32() as any;
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ocspStapling = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.certificatePath = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.keyPath = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.OneTimeLoading = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.buildChain = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Certificate {
|
||||
return {
|
||||
$type: Certificate.$type,
|
||||
certificate: isSet(object.certificate) ? bytesFromBase64(object.certificate) : new Uint8Array(0),
|
||||
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
||||
usage: isSet(object.usage) ? certificate_UsageFromJSON(object.usage) : 0,
|
||||
ocspStapling: isSet(object.ocspStapling) ? globalThis.Number(object.ocspStapling) : 0,
|
||||
certificatePath: isSet(object.certificatePath) ? globalThis.String(object.certificatePath) : "",
|
||||
keyPath: isSet(object.keyPath) ? globalThis.String(object.keyPath) : "",
|
||||
OneTimeLoading: isSet(object.OneTimeLoading) ? globalThis.Boolean(object.OneTimeLoading) : false,
|
||||
buildChain: isSet(object.buildChain) ? globalThis.Boolean(object.buildChain) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Certificate): unknown {
|
||||
const obj: any = {};
|
||||
if (message.certificate.length !== 0) {
|
||||
obj.certificate = base64FromBytes(message.certificate);
|
||||
}
|
||||
if (message.key.length !== 0) {
|
||||
obj.key = base64FromBytes(message.key);
|
||||
}
|
||||
if (message.usage !== 0) {
|
||||
obj.usage = certificate_UsageToJSON(message.usage);
|
||||
}
|
||||
if (message.ocspStapling !== 0) {
|
||||
obj.ocspStapling = Math.round(message.ocspStapling);
|
||||
}
|
||||
if (message.certificatePath !== "") {
|
||||
obj.certificatePath = message.certificatePath;
|
||||
}
|
||||
if (message.keyPath !== "") {
|
||||
obj.keyPath = message.keyPath;
|
||||
}
|
||||
if (message.OneTimeLoading !== false) {
|
||||
obj.OneTimeLoading = message.OneTimeLoading;
|
||||
}
|
||||
if (message.buildChain !== false) {
|
||||
obj.buildChain = message.buildChain;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Certificate>): Certificate {
|
||||
return Certificate.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Certificate>): Certificate {
|
||||
const message = createBaseCertificate();
|
||||
message.certificate = object.certificate ?? new Uint8Array(0);
|
||||
message.key = object.key ?? new Uint8Array(0);
|
||||
message.usage = object.usage ?? 0;
|
||||
message.ocspStapling = object.ocspStapling ?? 0;
|
||||
message.certificatePath = object.certificatePath ?? "";
|
||||
message.keyPath = object.keyPath ?? "";
|
||||
message.OneTimeLoading = object.OneTimeLoading ?? false;
|
||||
message.buildChain = object.buildChain ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Certificate.$type, Certificate);
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.tls.Config",
|
||||
allowInsecure: false,
|
||||
certificate: [],
|
||||
serverName: "",
|
||||
nextProtocol: [],
|
||||
enableSessionResumption: false,
|
||||
disableSystemRoot: false,
|
||||
minVersion: "",
|
||||
maxVersion: "",
|
||||
cipherSuites: "",
|
||||
fingerprint: "",
|
||||
rejectUnknownSni: false,
|
||||
pinnedPeerCertificateChainSha256: [],
|
||||
pinnedPeerCertificatePublicKeySha256: [],
|
||||
masterKeyLog: "",
|
||||
curvePreferences: [],
|
||||
verifyPeerCertInNames: [],
|
||||
echServerKeys: new Uint8Array(0),
|
||||
echConfigList: "",
|
||||
echForceQuery: "",
|
||||
echSocketSettings: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.tls.Config"> = {
|
||||
$type: "xray.transport.internet.tls.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.allowInsecure !== false) {
|
||||
writer.uint32(8).bool(message.allowInsecure);
|
||||
}
|
||||
for (const v of message.certificate) {
|
||||
Certificate.encode(v!, writer.uint32(18).fork()).join();
|
||||
}
|
||||
if (message.serverName !== "") {
|
||||
writer.uint32(26).string(message.serverName);
|
||||
}
|
||||
for (const v of message.nextProtocol) {
|
||||
writer.uint32(34).string(v!);
|
||||
}
|
||||
if (message.enableSessionResumption !== false) {
|
||||
writer.uint32(40).bool(message.enableSessionResumption);
|
||||
}
|
||||
if (message.disableSystemRoot !== false) {
|
||||
writer.uint32(48).bool(message.disableSystemRoot);
|
||||
}
|
||||
if (message.minVersion !== "") {
|
||||
writer.uint32(58).string(message.minVersion);
|
||||
}
|
||||
if (message.maxVersion !== "") {
|
||||
writer.uint32(66).string(message.maxVersion);
|
||||
}
|
||||
if (message.cipherSuites !== "") {
|
||||
writer.uint32(74).string(message.cipherSuites);
|
||||
}
|
||||
if (message.fingerprint !== "") {
|
||||
writer.uint32(90).string(message.fingerprint);
|
||||
}
|
||||
if (message.rejectUnknownSni !== false) {
|
||||
writer.uint32(96).bool(message.rejectUnknownSni);
|
||||
}
|
||||
for (const v of message.pinnedPeerCertificateChainSha256) {
|
||||
writer.uint32(106).bytes(v!);
|
||||
}
|
||||
for (const v of message.pinnedPeerCertificatePublicKeySha256) {
|
||||
writer.uint32(114).bytes(v!);
|
||||
}
|
||||
if (message.masterKeyLog !== "") {
|
||||
writer.uint32(122).string(message.masterKeyLog);
|
||||
}
|
||||
for (const v of message.curvePreferences) {
|
||||
writer.uint32(130).string(v!);
|
||||
}
|
||||
for (const v of message.verifyPeerCertInNames) {
|
||||
writer.uint32(138).string(v!);
|
||||
}
|
||||
if (message.echServerKeys.length !== 0) {
|
||||
writer.uint32(146).bytes(message.echServerKeys);
|
||||
}
|
||||
if (message.echConfigList !== "") {
|
||||
writer.uint32(154).string(message.echConfigList);
|
||||
}
|
||||
if (message.echForceQuery !== "") {
|
||||
writer.uint32(162).string(message.echForceQuery);
|
||||
}
|
||||
if (message.echSocketSettings !== undefined) {
|
||||
SocketConfig.encode(message.echSocketSettings, writer.uint32(170).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.allowInsecure = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.certificate.push(Certificate.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.serverName = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nextProtocol.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.enableSessionResumption = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.disableSystemRoot = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.minVersion = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 66) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.maxVersion = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag !== 74) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.cipherSuites = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 11: {
|
||||
if (tag !== 90) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.fingerprint = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 12: {
|
||||
if (tag !== 96) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.rejectUnknownSni = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 13: {
|
||||
if (tag !== 106) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pinnedPeerCertificateChainSha256.push(reader.bytes());
|
||||
continue;
|
||||
}
|
||||
case 14: {
|
||||
if (tag !== 114) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pinnedPeerCertificatePublicKeySha256.push(reader.bytes());
|
||||
continue;
|
||||
}
|
||||
case 15: {
|
||||
if (tag !== 122) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.masterKeyLog = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 16: {
|
||||
if (tag !== 130) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.curvePreferences.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 17: {
|
||||
if (tag !== 138) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.verifyPeerCertInNames.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
case 18: {
|
||||
if (tag !== 146) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.echServerKeys = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 19: {
|
||||
if (tag !== 154) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.echConfigList = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 20: {
|
||||
if (tag !== 162) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.echForceQuery = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 21: {
|
||||
if (tag !== 170) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.echSocketSettings = SocketConfig.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
allowInsecure: isSet(object.allowInsecure) ? globalThis.Boolean(object.allowInsecure) : false,
|
||||
certificate: globalThis.Array.isArray(object?.certificate)
|
||||
? object.certificate.map((e: any) => Certificate.fromJSON(e))
|
||||
: [],
|
||||
serverName: isSet(object.serverName) ? globalThis.String(object.serverName) : "",
|
||||
nextProtocol: globalThis.Array.isArray(object?.nextProtocol)
|
||||
? object.nextProtocol.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
enableSessionResumption: isSet(object.enableSessionResumption)
|
||||
? globalThis.Boolean(object.enableSessionResumption)
|
||||
: false,
|
||||
disableSystemRoot: isSet(object.disableSystemRoot) ? globalThis.Boolean(object.disableSystemRoot) : false,
|
||||
minVersion: isSet(object.minVersion) ? globalThis.String(object.minVersion) : "",
|
||||
maxVersion: isSet(object.maxVersion) ? globalThis.String(object.maxVersion) : "",
|
||||
cipherSuites: isSet(object.cipherSuites) ? globalThis.String(object.cipherSuites) : "",
|
||||
fingerprint: isSet(object.fingerprint) ? globalThis.String(object.fingerprint) : "",
|
||||
rejectUnknownSni: isSet(object.rejectUnknownSni) ? globalThis.Boolean(object.rejectUnknownSni) : false,
|
||||
pinnedPeerCertificateChainSha256: globalThis.Array.isArray(object?.pinnedPeerCertificateChainSha256)
|
||||
? object.pinnedPeerCertificateChainSha256.map((e: any) => bytesFromBase64(e))
|
||||
: [],
|
||||
pinnedPeerCertificatePublicKeySha256: globalThis.Array.isArray(object?.pinnedPeerCertificatePublicKeySha256)
|
||||
? object.pinnedPeerCertificatePublicKeySha256.map((e: any) => bytesFromBase64(e))
|
||||
: [],
|
||||
masterKeyLog: isSet(object.masterKeyLog) ? globalThis.String(object.masterKeyLog) : "",
|
||||
curvePreferences: globalThis.Array.isArray(object?.curvePreferences)
|
||||
? object.curvePreferences.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
verifyPeerCertInNames: globalThis.Array.isArray(object?.verifyPeerCertInNames)
|
||||
? object.verifyPeerCertInNames.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
echServerKeys: isSet(object.echServerKeys) ? bytesFromBase64(object.echServerKeys) : new Uint8Array(0),
|
||||
echConfigList: isSet(object.echConfigList) ? globalThis.String(object.echConfigList) : "",
|
||||
echForceQuery: isSet(object.echForceQuery) ? globalThis.String(object.echForceQuery) : "",
|
||||
echSocketSettings: isSet(object.echSocketSettings) ? SocketConfig.fromJSON(object.echSocketSettings) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.allowInsecure !== false) {
|
||||
obj.allowInsecure = message.allowInsecure;
|
||||
}
|
||||
if (message.certificate?.length) {
|
||||
obj.certificate = message.certificate.map((e) => Certificate.toJSON(e));
|
||||
}
|
||||
if (message.serverName !== "") {
|
||||
obj.serverName = message.serverName;
|
||||
}
|
||||
if (message.nextProtocol?.length) {
|
||||
obj.nextProtocol = message.nextProtocol;
|
||||
}
|
||||
if (message.enableSessionResumption !== false) {
|
||||
obj.enableSessionResumption = message.enableSessionResumption;
|
||||
}
|
||||
if (message.disableSystemRoot !== false) {
|
||||
obj.disableSystemRoot = message.disableSystemRoot;
|
||||
}
|
||||
if (message.minVersion !== "") {
|
||||
obj.minVersion = message.minVersion;
|
||||
}
|
||||
if (message.maxVersion !== "") {
|
||||
obj.maxVersion = message.maxVersion;
|
||||
}
|
||||
if (message.cipherSuites !== "") {
|
||||
obj.cipherSuites = message.cipherSuites;
|
||||
}
|
||||
if (message.fingerprint !== "") {
|
||||
obj.fingerprint = message.fingerprint;
|
||||
}
|
||||
if (message.rejectUnknownSni !== false) {
|
||||
obj.rejectUnknownSni = message.rejectUnknownSni;
|
||||
}
|
||||
if (message.pinnedPeerCertificateChainSha256?.length) {
|
||||
obj.pinnedPeerCertificateChainSha256 = message.pinnedPeerCertificateChainSha256.map((e) => base64FromBytes(e));
|
||||
}
|
||||
if (message.pinnedPeerCertificatePublicKeySha256?.length) {
|
||||
obj.pinnedPeerCertificatePublicKeySha256 = message.pinnedPeerCertificatePublicKeySha256.map((e) =>
|
||||
base64FromBytes(e)
|
||||
);
|
||||
}
|
||||
if (message.masterKeyLog !== "") {
|
||||
obj.masterKeyLog = message.masterKeyLog;
|
||||
}
|
||||
if (message.curvePreferences?.length) {
|
||||
obj.curvePreferences = message.curvePreferences;
|
||||
}
|
||||
if (message.verifyPeerCertInNames?.length) {
|
||||
obj.verifyPeerCertInNames = message.verifyPeerCertInNames;
|
||||
}
|
||||
if (message.echServerKeys.length !== 0) {
|
||||
obj.echServerKeys = base64FromBytes(message.echServerKeys);
|
||||
}
|
||||
if (message.echConfigList !== "") {
|
||||
obj.echConfigList = message.echConfigList;
|
||||
}
|
||||
if (message.echForceQuery !== "") {
|
||||
obj.echForceQuery = message.echForceQuery;
|
||||
}
|
||||
if (message.echSocketSettings !== undefined) {
|
||||
obj.echSocketSettings = SocketConfig.toJSON(message.echSocketSettings);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.allowInsecure = object.allowInsecure ?? false;
|
||||
message.certificate = object.certificate?.map((e) => Certificate.fromPartial(e)) || [];
|
||||
message.serverName = object.serverName ?? "";
|
||||
message.nextProtocol = object.nextProtocol?.map((e) => e) || [];
|
||||
message.enableSessionResumption = object.enableSessionResumption ?? false;
|
||||
message.disableSystemRoot = object.disableSystemRoot ?? false;
|
||||
message.minVersion = object.minVersion ?? "";
|
||||
message.maxVersion = object.maxVersion ?? "";
|
||||
message.cipherSuites = object.cipherSuites ?? "";
|
||||
message.fingerprint = object.fingerprint ?? "";
|
||||
message.rejectUnknownSni = object.rejectUnknownSni ?? false;
|
||||
message.pinnedPeerCertificateChainSha256 = object.pinnedPeerCertificateChainSha256?.map((e) => e) || [];
|
||||
message.pinnedPeerCertificatePublicKeySha256 = object.pinnedPeerCertificatePublicKeySha256?.map((e) => e) || [];
|
||||
message.masterKeyLog = object.masterKeyLog ?? "";
|
||||
message.curvePreferences = object.curvePreferences?.map((e) => e) || [];
|
||||
message.verifyPeerCertInNames = object.verifyPeerCertInNames?.map((e) => e) || [];
|
||||
message.echServerKeys = object.echServerKeys ?? new Uint8Array(0);
|
||||
message.echConfigList = object.echConfigList ?? "";
|
||||
message.echForceQuery = object.echForceQuery ?? "";
|
||||
message.echSocketSettings = (object.echSocketSettings !== undefined && object.echSocketSettings !== null)
|
||||
? SocketConfig.fromPartial(object.echSocketSettings)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if ((globalThis as any).Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(globalThis.String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
80
src/proto/transport/internet/udp/config.ts
Normal file
80
src/proto/transport/internet/udp/config.ts
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/udp/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.udp";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.udp.Config";
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return { $type: "xray.transport.internet.udp.Config" };
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.udp.Config"> = {
|
||||
$type: "xray.transport.internet.udp.Config" as const,
|
||||
|
||||
encode(_: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Config {
|
||||
return { $type: Config.$type };
|
||||
},
|
||||
|
||||
toJSON(_: Config): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
320
src/proto/transport/internet/websocket/config.ts
Normal file
320
src/proto/transport/internet/websocket/config.ts
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
// source: transport/internet/websocket/config.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { messageTypeRegistry } from "../../../typeRegistry";
|
||||
|
||||
export const protobufPackage = "xray.transport.internet.websocket";
|
||||
|
||||
export interface Config {
|
||||
$type: "xray.transport.internet.websocket.Config";
|
||||
host: string;
|
||||
/** URL path to the WebSocket service. Empty value means root(/). */
|
||||
path: string;
|
||||
header: { [key: string]: string };
|
||||
acceptProxyProtocol: boolean;
|
||||
ed: number;
|
||||
heartbeatPeriod: number;
|
||||
}
|
||||
|
||||
export interface Config_HeaderEntry {
|
||||
$type: "xray.transport.internet.websocket.Config.HeaderEntry";
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function createBaseConfig(): Config {
|
||||
return {
|
||||
$type: "xray.transport.internet.websocket.Config",
|
||||
host: "",
|
||||
path: "",
|
||||
header: {},
|
||||
acceptProxyProtocol: false,
|
||||
ed: 0,
|
||||
heartbeatPeriod: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export const Config: MessageFns<Config, "xray.transport.internet.websocket.Config"> = {
|
||||
$type: "xray.transport.internet.websocket.Config" as const,
|
||||
|
||||
encode(message: Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.host !== "") {
|
||||
writer.uint32(10).string(message.host);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(18).string(message.path);
|
||||
}
|
||||
globalThis.Object.entries(message.header).forEach(([key, value]: [string, string]) => {
|
||||
Config_HeaderEntry.encode({
|
||||
$type: "xray.transport.internet.websocket.Config.HeaderEntry",
|
||||
key: key as any,
|
||||
value,
|
||||
}, writer.uint32(26).fork()).join();
|
||||
});
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
writer.uint32(32).bool(message.acceptProxyProtocol);
|
||||
}
|
||||
if (message.ed !== 0) {
|
||||
writer.uint32(40).uint32(message.ed);
|
||||
}
|
||||
if (message.heartbeatPeriod !== 0) {
|
||||
writer.uint32(48).uint32(message.heartbeatPeriod);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.host = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.path = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry3 = Config_HeaderEntry.decode(reader, reader.uint32());
|
||||
if (entry3.value !== undefined) {
|
||||
message.header[entry3.key] = entry3.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.acceptProxyProtocol = reader.bool();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.ed = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.heartbeatPeriod = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config {
|
||||
return {
|
||||
$type: Config.$type,
|
||||
host: isSet(object.host) ? globalThis.String(object.host) : "",
|
||||
path: isSet(object.path) ? globalThis.String(object.path) : "",
|
||||
header: isObject(object.header)
|
||||
? (globalThis.Object.entries(object.header) as [string, any][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
||||
acc[key] = globalThis.String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
acceptProxyProtocol: isSet(object.acceptProxyProtocol) ? globalThis.Boolean(object.acceptProxyProtocol) : false,
|
||||
ed: isSet(object.ed) ? globalThis.Number(object.ed) : 0,
|
||||
heartbeatPeriod: isSet(object.heartbeatPeriod) ? globalThis.Number(object.heartbeatPeriod) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config): unknown {
|
||||
const obj: any = {};
|
||||
if (message.host !== "") {
|
||||
obj.host = message.host;
|
||||
}
|
||||
if (message.path !== "") {
|
||||
obj.path = message.path;
|
||||
}
|
||||
if (message.header) {
|
||||
const entries = globalThis.Object.entries(message.header) as [string, string][];
|
||||
if (entries.length > 0) {
|
||||
obj.header = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.header[k] = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.acceptProxyProtocol !== false) {
|
||||
obj.acceptProxyProtocol = message.acceptProxyProtocol;
|
||||
}
|
||||
if (message.ed !== 0) {
|
||||
obj.ed = Math.round(message.ed);
|
||||
}
|
||||
if (message.heartbeatPeriod !== 0) {
|
||||
obj.heartbeatPeriod = Math.round(message.heartbeatPeriod);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config>): Config {
|
||||
return Config.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config>): Config {
|
||||
const message = createBaseConfig();
|
||||
message.host = object.host ?? "";
|
||||
message.path = object.path ?? "";
|
||||
message.header = (globalThis.Object.entries(object.header ?? {}) as [string, string][]).reduce(
|
||||
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.acceptProxyProtocol = object.acceptProxyProtocol ?? false;
|
||||
message.ed = object.ed ?? 0;
|
||||
message.heartbeatPeriod = object.heartbeatPeriod ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config.$type, Config);
|
||||
|
||||
function createBaseConfig_HeaderEntry(): Config_HeaderEntry {
|
||||
return { $type: "xray.transport.internet.websocket.Config.HeaderEntry", key: "", value: "" };
|
||||
}
|
||||
|
||||
export const Config_HeaderEntry: MessageFns<
|
||||
Config_HeaderEntry,
|
||||
"xray.transport.internet.websocket.Config.HeaderEntry"
|
||||
> = {
|
||||
$type: "xray.transport.internet.websocket.Config.HeaderEntry" as const,
|
||||
|
||||
encode(message: Config_HeaderEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== "") {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== "") {
|
||||
writer.uint32(18).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Config_HeaderEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseConfig_HeaderEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Config_HeaderEntry {
|
||||
return {
|
||||
$type: Config_HeaderEntry.$type,
|
||||
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
||||
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Config_HeaderEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== "") {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Config_HeaderEntry>): Config_HeaderEntry {
|
||||
return Config_HeaderEntry.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Config_HeaderEntry>): Config_HeaderEntry {
|
||||
const message = createBaseConfig_HeaderEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
messageTypeRegistry.set(Config_HeaderEntry.$type, Config_HeaderEntry);
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T, V extends string> {
|
||||
readonly $type: V;
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
27
src/proto/typeRegistry.ts
Normal file
27
src/proto/typeRegistry.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.10.1
|
||||
// protoc v6.32.1
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export interface MessageType<Message extends UnknownMessage = UnknownMessage> {
|
||||
$type: Message["$type"];
|
||||
encode(message: Message, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Message;
|
||||
fromJSON(object: any): Message;
|
||||
toJSON(message: Message): unknown;
|
||||
fromPartial(object: DeepPartial<Message>): Message;
|
||||
}
|
||||
|
||||
export type UnknownMessage = { $type: string };
|
||||
|
||||
export const messageTypeRegistry = new Map<string, MessageType>();
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
8
src/services/handler/dto/add-user.ts
Normal file
8
src/services/handler/dto/add-user.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { ProtoAccount } from '../../../common/protos';
|
||||
import { ProtoInfer } from '../../../common/types';
|
||||
|
||||
export type AddUserDto<T extends ProtoAccount> = {
|
||||
tag: string;
|
||||
email: string;
|
||||
level: number;
|
||||
} & Partial<ProtoInfer<T>['account']>;
|
||||
1
src/services/handler/dto/index.ts
Normal file
1
src/services/handler/dto/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './add-user';
|
||||
1
src/services/handler/index.ts
Normal file
1
src/services/handler/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './service';
|
||||
128
src/services/handler/service.ts
Normal file
128
src/services/handler/service.ts
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import { createClient, Channel, Client } from 'nice-grpc';
|
||||
|
||||
import { decodeUser, createTypedMessage, tryCall } from '../../common/utils';
|
||||
|
||||
import {
|
||||
ProtoShadowsocks2022Account,
|
||||
ProtoShadowsocksAccount,
|
||||
ProtoTrojanAccount,
|
||||
ProtoVlessAccount,
|
||||
ProtoVmessAccount,
|
||||
ProtoSocksAccount,
|
||||
ProtoHttpAccount,
|
||||
ProtoAccount,
|
||||
} from '../../common/protos';
|
||||
import {
|
||||
AddUserOperation,
|
||||
HandlerServiceDefinition,
|
||||
RemoveUserOperation,
|
||||
} from '../../proto/app/proxyman/command/command';
|
||||
import { ApiResponse, Account, ApiEmptyResponse } from '../../common/types';
|
||||
import { User } from '../../proto/common/protocol/user';
|
||||
import { AddUserDto } from './dto';
|
||||
|
||||
export class HandlerService {
|
||||
public readonly client: Client<typeof HandlerServiceDefinition>;
|
||||
|
||||
constructor(channel: Channel) {
|
||||
this.client = createClient(HandlerServiceDefinition, channel);
|
||||
}
|
||||
|
||||
public async getInboundUsers(tag: string): Promise<ApiResponse<Account[]>> {
|
||||
const res = await tryCall(this.client.getInboundUsers({ tag }));
|
||||
if (!res.isOk) return res;
|
||||
return {
|
||||
isOk: true,
|
||||
data: res.data.users.map(decodeUser),
|
||||
};
|
||||
}
|
||||
|
||||
public async getInboundUsersCount(tag: string): Promise<ApiResponse<number>> {
|
||||
const res = await tryCall(this.client.getInboundUsersCount({ tag }));
|
||||
if (!res.isOk) return res;
|
||||
return {
|
||||
isOk: true,
|
||||
data: res.data.count,
|
||||
};
|
||||
}
|
||||
|
||||
// public async listInbounds(dto: InferTypedMessage<ListInboundsRequest>) {
|
||||
// const res = await tryCall(this.client.listInbounds(dto));
|
||||
// if (!res.isOk) return res;
|
||||
// const inbounds = res.data.inbounds.map((inbound) =>
|
||||
// decodeTypedMessage(
|
||||
// {
|
||||
// receiverSettings: ReceiverConfig,
|
||||
// proxySettings: ProxyConfig,
|
||||
// },
|
||||
// inbound,
|
||||
// ),
|
||||
// );
|
||||
// return {
|
||||
// isOk: true,
|
||||
// data: inbounds,
|
||||
// };
|
||||
// }
|
||||
|
||||
public async removeUser(tag: string, username: string): Promise<ApiEmptyResponse> {
|
||||
const res = await tryCall(
|
||||
this.client.alterInbound({
|
||||
tag: tag,
|
||||
operation: createTypedMessage(RemoveUserOperation, { email: username }),
|
||||
}),
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
public async addHttpUser(data: AddUserDto<ProtoHttpAccount>): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoHttpAccount, data);
|
||||
}
|
||||
|
||||
public async addShadowsocksUser(
|
||||
data: AddUserDto<ProtoShadowsocksAccount>,
|
||||
): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoShadowsocksAccount, data);
|
||||
}
|
||||
|
||||
public async addShadowsocks2022User(
|
||||
data: AddUserDto<ProtoShadowsocks2022Account>,
|
||||
): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoShadowsocks2022Account, data);
|
||||
}
|
||||
|
||||
public async addSocksUser(data: AddUserDto<ProtoSocksAccount>): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoSocksAccount, data);
|
||||
}
|
||||
|
||||
public async addTrojanUser(data: AddUserDto<ProtoTrojanAccount>): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoTrojanAccount, data);
|
||||
}
|
||||
|
||||
public async addVlessUser(data: AddUserDto<ProtoVlessAccount>): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoVlessAccount, data);
|
||||
}
|
||||
|
||||
public async addVmessUser(data: AddUserDto<ProtoVmessAccount>): Promise<ApiEmptyResponse> {
|
||||
return this.addUserOperation(ProtoVmessAccount, data);
|
||||
}
|
||||
|
||||
private async addUserOperation<T extends ProtoAccount>(
|
||||
proto: T,
|
||||
data: AddUserDto<T>,
|
||||
): Promise<ApiEmptyResponse> {
|
||||
const { tag, email, level, ...account } = data;
|
||||
const res = await tryCall(
|
||||
this.client.alterInbound({
|
||||
tag,
|
||||
operation: createTypedMessage(AddUserOperation, {
|
||||
user: User.create({
|
||||
email,
|
||||
level,
|
||||
account: createTypedMessage(proto, account),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
1
src/services/index.ts
Normal file
1
src/services/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './handler';
|
||||
37
tsconfig.json
Normal file
37
tsconfig.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
// Environment setup & latest features
|
||||
"lib": [
|
||||
"ESNext"
|
||||
],
|
||||
"target": "ESNext",
|
||||
"module": "esnext",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"resolveJsonModule": true,
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"verbatimModuleSyntax": false,
|
||||
// Best practices
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
// other
|
||||
"outDir": "./dist",
|
||||
"declaration": true,
|
||||
"incremental": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test.ts"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue