diff --git a/.gitignore b/.gitignore
index 0f5e165..1bdf522 100755
--- a/.gitignore
+++ b/.gitignore
@@ -90,4 +90,12 @@ app.*.map.json
# Local configuration
local.properties
key.properties
-libcore
+
+# libcore 编译产物(源码需要提交用于 GitHub Actions 编译)
+libcore/bin/
+libcore/node_modules/
+libcore/*.tar.gz
+libcore/*.aar
+
+# Android 编译产物
+android/app/libs/*.aar
diff --git a/libcore b/libcore
new file mode 160000
index 0000000..bfb026f
--- /dev/null
+++ b/libcore
@@ -0,0 +1 @@
+Subproject commit bfb026f06f8d9a70284cc585cb87f21ee3aa4d05
diff --git a/libcore/.gitattributes b/libcore/.gitattributes
deleted file mode 100644
index ad4e1a9..0000000
--- a/libcore/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-*.h linguist-detectable=false
-*.c linguist-detectable=false
\ No newline at end of file
diff --git a/libcore/.github/change_version.sh b/libcore/.github/change_version.sh
deleted file mode 100755
index 3d037ac..0000000
--- a/libcore/.github/change_version.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/bash
-
-SED() { [[ "$OSTYPE" == "darwin"* ]] && sed -i '' "$@" || sed -i "$@"; }
-
-echo "previous version was $(git describe --tags $(git rev-list --tags --max-count=1))"
-echo "WARNING: This operation will creates version tag and push to github"
-read -p "Version? (provide the next x.y.z semver) : " TAG
-echo $TAG
-[[ "$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; }
-IFS="." read -r -a VERSION_ARRAY <<< "$TAG"
-VERSION_STR="${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]}"
-BUILD_NUMBER=$(( ${VERSION_ARRAY[0]} * 10000 + ${VERSION_ARRAY[1]} * 100 + ${VERSION_ARRAY[2]} ))
-echo "version: ${VERSION_STR}+${BUILD_NUMBER}"
-SED -e "s|CFBundleVersion\s*[^<]*|CFBundleVersion${VERSION_STR}|" Info.plist
-SED -e "s|CFBundleShortVersionString\s*[^<]*|CFBundleShortVersionString${VERSION_STR}|" Info.plist
-SED "s|ENV VERSION=.*|ENV VERSION=v${TAG}|g" docker/Dockerfile
-git add Info.plist docker/Dockerfile
-git commit -m "release: version ${TAG}"
-echo "creating git tag : v${TAG}"
-git push
-git tag v${TAG}
-git push -u origin HEAD --tags
-echo "Github Actions will detect the new tag and release the new version."
\ No newline at end of file
diff --git a/libcore/.github/workflows/build.yml b/libcore/.github/workflows/build.yml
deleted file mode 100644
index 4afb0db..0000000
--- a/libcore/.github/workflows/build.yml
+++ /dev/null
@@ -1,303 +0,0 @@
-name: Build
-on:
- workflow_call:
- inputs:
- upload-artifact:
- type: boolean
- default: true
- tag-name:
- type: string
- default: "draft"
- channel:
- type: string
- default: "dev"
-env:
- REGISTRY_IMAGE: ghcr.io/hiddify/hiddify-core
-
-
-jobs:
- update_wrt_hash:
- permissions: write-all
- runs-on: ubuntu-latest
- if: ${{ inputs.channel=='prod' }}
- steps:
- - uses: actions/checkout@v4
- - run: |
- git checkout -b main
- curl -L -o hiddify-core.tar.gz https://codeload.github.com/hiddify/hiddify-core/tar.gz/${{ inputs.tag-name }}
- HIDDIFY_CORE_WRT_HASH=$(sha256sum hiddify-core.tar.gz | cut -d' ' -f1)
- github_ref_name="${{ inputs.tag-name }}"
- IFS="." read -r -a VERSION_ARRAY <<< "${github_ref_name#v}"
- VERSION_STR="${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]}"
- sed -i "s|PKG_VERSION:=.*|PKG_VERSION:=${VERSION_STR}|g" wrt/Makefile
- sed -i "s|PKG_HASH:=.*|PKG_HASH:=${HIDDIFY_CORE_WRT_HASH}|g" wrt/Makefile
- - uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: "Update WRT package HASH."
- branch: main
- # push_options: --force
- build:
- permissions: write-all
- strategy:
- fail-fast: false
- matrix:
- job:
- - { name: 'hiddify-core-android', os: 'ubuntu-latest', target: 'android' }
- - { name: 'hiddify-core-linux-amd64', os: 'ubuntu-20.04', target: 'linux-amd64' }
- - { name: "hiddify-core-windows-amd64", os: 'ubuntu-latest', target: 'windows-amd64', aarch: 'x64' }
- - { name: "hiddify-core-macos-universal", os: 'macos-12', target: 'macos-universal' }
- - { name: "hiddify-core-ios", os: "macos-12", target: "ios" }
- # linux custom
- - {name: hiddify-cli-linux-amd64, goos: linux, goarch: amd64, goamd64: v1, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-386, goos: linux, goarch: 386, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-arm64, goos: linux, goarch: arm64, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-armv5, goos: linux, goarch: arm, goarm: 5, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-armv6, goos: linux, goarch: arm, goarm: 6, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-armv7, goos: linux, goarch: arm, goarm: 7, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mips-hardfloat, goos: linux, goarch: mips, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mipsel-softfloat, goos: linux, goarch: mipsle, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mipsel-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mips64, goos: linux, goarch: mips64, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-mips64el, goos: linux, goarch: mips64le, target: 'linux-custom', os: 'ubuntu-20.04'}
- - {name: hiddify-cli-linux-s390x, goos: linux, goarch: s390x, target: 'linux-custom', os: 'ubuntu-20.04'}
-
- runs-on: ${{ matrix.job.os }}
- env:
- GOOS: ${{ matrix.job.goos }}
- GOARCH: ${{ matrix.job.goarch }}
- GOAMD64: ${{ matrix.job.goamd64 }}
- GOARM: ${{ matrix.job.goarm }}
- GOMIPS: ${{ matrix.job.gomips }}
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Setup Go
- uses: actions/setup-go@v5
- with:
- go-version-file: 'go.mod'
- check-latest: false
-
- - name: Setup Java
- if: startsWith(matrix.job.target,'android')
- uses: actions/setup-java@v3
- with:
- distribution: 'zulu'
- java-version: '17'
-
- - name: Setup NDK
- if: startsWith(matrix.job.target,'android')
- uses: nttld/setup-ndk@v1.4.0
- id: setup-ndk
- with:
- ndk-version: r26b
- add-to-path: true
- local-cache: false
- link-to-sdk: true
-
- - name: Setup MinGW
- if: startsWith(matrix.job.target,'windows')
- uses: egor-tensin/setup-mingw@v2
- with:
- platform: ${{ matrix.job.aarch }}
- - name: Setup macos
- if: startsWith(matrix.job.target,'macos') || startsWith(matrix.job.target,'ios')
- run: |
- brew install create-dmg tree coreutils
-
- - name: Build
- run: |
- make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
-
- - name: zip
- run: |
- tree
- rm -f /*.h */*.h
- rm ./hiddify-libcore*sources* ||echo "no source"
- rm ./hiddify-libcore-macos-a*.dylib || echo "no macos arm and amd"
- files=$(ls | grep -E '^(libcore\.(dll|so|dylib|aar)|webui|Libcore.xcframework|lib|HiddifyCli(\.exe)?)$')
- echo tar -czvf ${{ matrix.job.name }}.tar.gz $files
- tar -czvf ${{ matrix.job.name }}.tar.gz $files
-
- working-directory: bin
- - uses: actions/upload-artifact@v4
- if: ${{ success() }}
- with:
- name: ${{ matrix.job.name }}
- path: bin/*.tar.gz
- retention-days: 1
-
-
- upload-prerelease:
- permissions: write-all
- if: ${{ inputs.upload-artifact }}
- needs: [build]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/download-artifact@v4
- with:
- merge-multiple: true
- pattern: hiddify-*
- path: bin/
-
- - name: Display Files Structure
- run: tree
- working-directory: bin
-
- - name: Delete Current Release Assets
- uses: 8Mi-Tech/delete-release-assets-action@main
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- tag: 'draft'
- deleteOnlyFromDrafts: false
-
- - name: Create or Update Draft Release
- uses: softprops/action-gh-release@v1
- if: ${{ success() }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: ./bin/*.tar.gz
- name: 'draft'
- tag_name: 'draft'
- prerelease: true
-
- upload-release:
- permissions: write-all
- if: ${{ inputs.channel=='prod' }}
- needs: [build]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/download-artifact@v4
- with:
- merge-multiple: true
- pattern: hiddify-*
- path: bin/
-
- - name: Display Files Structure
- run: ls -R
- working-directory: bin
-
- - name: Upload Release
- uses: softprops/action-gh-release@v1
- if: ${{ success() }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ inputs.tag-name }}
-
- files: bin/*.tar.gz
-
-
-
-
-
-
-
-
-
-
-
- make-upload-docker:
- permissions: write-all
- if: ${{ inputs.channel=='prod' }}
- needs: [upload-release]
-
- runs-on: ubuntu-latest
- strategy:
- fail-fast: true
- matrix:
- platform:
- - linux/amd64
- # - linux/arm/v5
- - linux/arm/v6
- - linux/arm/v7
- - linux/arm64
- - linux/386
- # - linux/ppc64le
- # - linux/riscv64
- - linux/s390x
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - name: Prepare
- run: |
- platform=${{ matrix.platform }}
- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- - name: Setup QEMU
- uses: docker/setup-qemu-action@v3
- - name: Setup Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Docker meta
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: ${{ env.REGISTRY_IMAGE }}
- - name: Build and push by digest
- id: build
- uses: docker/build-push-action@v6
- with:
- platforms: ${{ matrix.platform }}
- context: ./docker/
- build-args: |
- BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
- labels: ${{ steps.meta.outputs.labels }}
- outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- - name: Export digest
- run: |
- mkdir -p /tmp/digests
- digest="${{ steps.build.outputs.digest }}"
- touch "/tmp/digests/${digest#sha256:}"
- - name: Upload digest
- uses: actions/upload-artifact@v4
- with:
- name: digests-${{ env.PLATFORM_PAIR }}
- path: /tmp/digests/*
- if-no-files-found: error
- retention-days: 1
- merge:
- permissions: write-all
- runs-on: ubuntu-latest
- needs:
- - make-upload-docker
- env:
- LATEST: ${{ endsWith(inputs.tag-name , 'dev') && 'beta' ||'latest'}}
- steps:
- - name: Download digests
- uses: actions/download-artifact@v4
- with:
- path: /tmp/digests
- pattern: digests-*
- merge-multiple: true
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Create manifest list and push
- working-directory: /tmp/digests
- run: |
- docker buildx imagetools create \
- -t "${{ env.REGISTRY_IMAGE }}:${{ env.LATEST }}" \
- -t "${{ env.REGISTRY_IMAGE }}:${{ inputs.tag-name }}" \
- $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- - name: Inspect image
-
- run: |
- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.LATEST }}
- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ inputs.tag-name }}
diff --git a/libcore/.github/workflows/ci.yml b/libcore/.github/workflows/ci.yml
deleted file mode 100644
index 1711997..0000000
--- a/libcore/.github/workflows/ci.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: CI
-on:
- pull_request:
- paths-ignore:
- - '**.md'
- - 'docs/**'
- - '.vscode/'
- - 'appcast.xml'
- push:
- branches:
- - main
- - dev
- - android-fix-action-bug
- paths-ignore:
- - '**.md'
- - 'docs/**'
- - '.vscode/'
- - 'appcast.xml'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- run:
- uses: ./.github/workflows/build.yml
- secrets: inherit
- permissions: write-all
- if: "${{!contains(github.event.head_commit.message, 'release: version')}}"
- with:
- upload-artifact: ${{ github.event_name == 'push' }}
-
diff --git a/libcore/.github/workflows/release.yml b/libcore/.github/workflows/release.yml
deleted file mode 100644
index 8ad5700..0000000
--- a/libcore/.github/workflows/release.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: Release
-on:
- push:
- tags:
- - 'v[0-9]+.[0-9]+.[0-9]+'
- - 'v[0-9]+.[0-9]+.[0-9]+.*'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-jobs:
- build-release:
- uses: ./.github/workflows/build.yml
- secrets: inherit
- permissions: write-all
- with:
- upload-artifact: true
- tag-name: "${{ github.ref_name }}"
- channel: "${{ github.ref_type == 'tag' && endsWith(github.ref_name, 'dev') && 'dev' || github.ref_type != 'tag' && 'dev' || 'prod' }}"
diff --git a/libcore/.gitignore b/libcore/.gitignore
deleted file mode 100644
index 545c18c..0000000
--- a/libcore/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-/bin/*
-!/bin/.gitkeep
-.build
-.idea
-cert
-**/*.log
-.DS_Store
-
-**/*.syso
-node_modules
-*.db
-*.json
\ No newline at end of file
diff --git a/libcore/.prettierrc b/libcore/.prettierrc
deleted file mode 100644
index 7f51a41..0000000
--- a/libcore/.prettierrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "overrides": [
- {
- "files": ".github/**",
- "options": {
- "singleQuote": true
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/libcore/.stignore b/libcore/.stignore
deleted file mode 100644
index 9bd8bad..0000000
--- a/libcore/.stignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.git
-
-.build
-.idea
-
-**/*.log
-.DS_Store
-
-**/*.syso
\ No newline at end of file
diff --git a/libcore/CONTRIBUTING.md b/libcore/CONTRIBUTING.md
deleted file mode 100644
index 65b5865..0000000
--- a/libcore/CONTRIBUTING.md
+++ /dev/null
@@ -1,26 +0,0 @@
-Hiddify uses [Go](https://go.dev), make sure that you have the correct version installed before starting development. You can use the following commands to check your installed version:
-
-
-```shell
-$ go version
-
-# example response
-go version go1.21.1 darwin/arm64
-```
-
-### Working with the Go Code
-
-> if you're not interested in building/contributing to the Go code, you can skip this section
-
-The Go code for Hiddify can be found in the `libcore` folder, as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) and in [core repository](https://github.com/hiddify/hiddify-next-core). The entrypoints for the desktop version are available in the [`libcore/custom`](https://github.com/hiddify/hiddify-next-core/tree/main/custom) folder and for the mobile version they can be found in the [`libcore/mobile`](https://github.com/hiddify/hiddify-next-core/tree/main/mobile) folder.
-
-For the desktop version, we have to compile the Go code into a C shared library. We are providing a Makefile to generate the C shared libraries for all operating systems. The following Make commands will build libcore and copy the resulting output in [`libcore/bin`](https://github.com/hiddify/hiddify-next-core/tree/main/bin):
-
-- `make windows-amd64`
-- `make linux-amd64`
-- `make macos-universal`
-
-For the mobile version, we are using the [`gomobile`](https://github.com/golang/go/wiki/Mobile) tools. The following Make commands will build libcore for Android and iOS and copy the resulting output in [`libcore/bin`](https://github.com/hiddify/hiddify-next-core/tree/main/bin):
-
-- `make android`
-- `make ios`
diff --git a/libcore/Info.plist b/libcore/Info.plist
deleted file mode 100644
index 8da5f7e..0000000
--- a/libcore/Info.plist
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
- AvailableLibraries
-
-
- BinaryPath
- Libcore.framework/Libcore
- LibraryIdentifier
- ios-arm64_x86_64-simulator
- LibraryPath
- Libcore.framework
- SupportedArchitectures
-
- arm64
- x86_64
-
- SupportedPlatform
- ios
- SupportedPlatformVariant
- simulator
-
-
- BinaryPath
- Libcore.framework/Libcore
- LibraryIdentifier
- ios-arm64
- LibraryPath
- Libcore.framework
- SupportedArchitectures
-
- arm64
-
- SupportedPlatform
- ios
-
-
- CFBundlePackageType
- XFWK
- XCFrameworkFormatVersion
- 1.0
- CFBundleIdentifier
- ios.libcore.hiddify
- CFBundleShortVersionString3.1.7
- CFBundleVersion3.1.7
- MinimumOSVersion
- 15.0
-
-
\ No newline at end of file
diff --git a/libcore/LICENSE.md b/libcore/LICENSE.md
deleted file mode 100644
index 3110493..0000000
--- a/libcore/LICENSE.md
+++ /dev/null
@@ -1,699 +0,0 @@
-
-# GNU GENERAL PUBLIC LICENSE v3
-
-## Summary:
-Additional Permissions and Restrictions Under GNU GPL Version 3 Section 7
-- If you use extends this code, you should directly fork it from github.
-
-- The forks of the app are not allowed to be listed on F-Droid or other app stores under the original name or original design.
-
-- Any forks should be published open-source under the same license.
-
-- Prior consent is required to publish a fork or utilize any part of this repository (github.com/hiddify/hiddify-next and github.com/hiddify/hiddify-next-core) in an application intended for publication on the App Store or for iOS/macOS platforms. (We reserve the right to modify this requirement in the future after completing development for iOS and macOS).
-- You need prior consent to publish a fork or use any part of this code in an application published in AppStore or publish for iOS or macOS. (We reserve the right to modify this requirement in the future after completing development for iOS and macOS).
-- You are free to:
- - Share — copy and redistribute the material in any medium or format with
- - Adapt — remix, transform, and build upon the material
-- Under the following terms:
- - Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
-
- - NonCommercial — You may not use the material for commercial purposes. You can not even include ads in it.
-
- - ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
-
- - Prior consent is required before utilizing any portion of this code for integration into an application intended for the App Store.
-
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/libcore/Makefile b/libcore/Makefile
deleted file mode 100644
index 45213b0..0000000
--- a/libcore/Makefile
+++ /dev/null
@@ -1,107 +0,0 @@
-.ONESHELL:
-PRODUCT_NAME=libcore
-BASENAME=$(PRODUCT_NAME)
-BINDIR=bin
-LIBNAME=$(PRODUCT_NAME)
-CLINAME=HiddifyCli
-
-BRANCH=$(shell git branch --show-current)
-VERSION=$(shell git describe --tags || echo "unknown version")
-ifeq ($(OS),Windows_NT)
-Not available for Windows! use bash in WSL
-endif
-
-TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
-IOS_ADD_TAGS=with_dhcp,with_low_memory,with_conntrack
-GOBUILDLIB=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
-GOBUILDSRV=CGO_ENABLED=1 go build -ldflags "-s -w" -trimpath -tags $(TAGS)
-
-.PHONY: protos
-protos:
- protoc --go_out=./ --go-grpc_out=./ --proto_path=hiddifyrpc hiddifyrpc/*.proto
- protoc --js_out=import_style=commonjs,binary:./extension/html/rpc/ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./extension/html/rpc/ --proto_path=hiddifyrpc hiddifyrpc/*.proto
- npx browserify extension/html/rpc/extension.js >extension/html/rpc.js
-
-
-lib_install:
- go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.1
- go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.1
- npm install
-
-headers:
- go build -buildmode=c-archive -o $(BINDIR)/$(LIBNAME).h ./custom
-
-android: lib_install
- gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -target=android -o $(BINDIR)/$(LIBNAME).aar github.com/sagernet/sing-box/experimental/libbox ./mobile
-
-ios-full: lib_install
- gomobile bind -v -target ios,iossimulator,tvos,tvossimulator,macos -libname=box -tags=$(TAGS),$(IOS_ADD_TAGS) -trimpath -ldflags="-w -s" -o $(BINDIR)/$(PRODUCT_NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
- mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(LIBNAME).xcframework
- cp Libcore.podspec $(BINDIR)/$(LIBNAME).xcframework/
-
-ios: lib_install
- gomobile bind -v -target ios -libname=box -tags=$(TAGS),$(IOS_ADD_TAGS) -trimpath -ldflags="-w -s" -o $(BINDIR)/Libcore.xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
- cp Info.plist $(BINDIR)/Libcore.xcframework/
-
-
-webui:
- curl -L -o webui.zip https://github.com/hiddify/Yacd-meta/archive/gh-pages.zip
- unzip -d ./ -q webui.zip
- rm webui.zip
- rm -rf bin/webui
- mv Yacd-meta-gh-pages bin/webui
-
-.PHONY: build
-windows-amd64:
- curl http://localhost:18020/exit || echo "exited"
- env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILDLIB) -o $(BINDIR)/$(LIBNAME).dll ./custom
- go install -mod=readonly github.com/akavel/rsrc@latest ||echo "rsrc error in installation"
- go run ./cli tunnel exit
- cp $(BINDIR)/$(LIBNAME).dll ./$(LIBNAME).dll
- $$(go env GOPATH)/bin/rsrc -ico ./assets/hiddify-cli.ico -o ./cli/bydll/cli.syso ||echo "rsrc error in syso"
- env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="$(LIBNAME).dll" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME).exe ./cli/bydll
- rm ./$(LIBNAME).dll
- make webui
-
-
-linux-amd64:
- mkdir -p $(BINDIR)/lib
- env GOOS=linux GOARCH=amd64 $(GOBUILDLIB) -o $(BINDIR)/lib/$(LIBNAME).so ./custom
- mkdir lib
- cp $(BINDIR)/lib/$(LIBNAME).so ./lib/$(LIBNAME).so
- env GOOS=linux GOARCH=amd64 CGO_LDFLAGS="./lib/$(LIBNAME).so" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/bydll
- rm -rf ./lib
- chmod +x $(BINDIR)/$(CLINAME)
- make webui
-
-
-linux-custom:
- mkdir -p $(BINDIR)/
- #env GOARCH=mips $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/
- go build -ldflags "-s -w" -trimpath -tags $(TAGS) -o $(BINDIR)/$(CLINAME) ./cli/
- chmod +x $(BINDIR)/$(CLINAME)
- make webui
-
-macos-amd64:
- env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),$(IOS_ADD_TAGS) -buildmode=c-shared -o $(BINDIR)/$(LIBNAME)-amd64.dylib ./custom
-macos-arm64:
- env GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),$(IOS_ADD_TAGS) -buildmode=c-shared -o $(BINDIR)/$(LIBNAME)-arm64.dylib ./custom
-
-macos-universal: macos-amd64 macos-arm64
- lipo -create $(BINDIR)/$(LIBNAME)-amd64.dylib $(BINDIR)/$(LIBNAME)-arm64.dylib -output $(BINDIR)/$(LIBNAME).dylib
- cp $(BINDIR)/$(LIBNAME).dylib ./$(LIBNAME).dylib
- env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="bin/$(LIBNAME).dylib" CGO_ENABLED=1 $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/bydll
- rm ./$(LIBNAME).dylib
- chmod +x $(BINDIR)/$(CLINAME)
-
-clean:
- rm $(BINDIR)/*
-
-
-
-
-release: # Create a new tag for release.
- @bash -c '.github/change_version.sh'
-
-
-
diff --git a/libcore/README.md b/libcore/README.md
deleted file mode 100644
index f5392d1..0000000
--- a/libcore/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# hiddify-core
-
-
-## Docker
-To Run our docker image see https://github.com/hiddify/hiddify-core/pkgs/container/hiddify-core
-
-Docker
-```
-docker pull ghcr.io/hiddify/hiddify-core:latest
-```
-
-Docker Compose
-```
-git clone https://github.com/hiddify/hiddify-core
-cd hiddify-core/docker
-docker-compose up
-```
-
-## WRT
-...
-
-## Extension
-
-An extension is something that can be added to hiddify application by a third party. It will add capability to modify configs, do some extra action, show and receive data from users.
-
-This extension will be shown in all Hiddify Platforms such as Android/macOS/Linux/Windows/iOS
-
-[Create an extension](https://github.com/hiddify/hiddify-app-example-extension)
-
-Features and Road map:
-
-- [x] Add Third Party Extension capability
-- [x] Test Extension from Browser without any dependency to android/mac/.... `./cmd.sh extension` the open browser `https://127.0.0.1:12346`
-- [x] Show Custom UI from Extension `github.com/hiddify/hiddify-core/extension.UpdateUI()`
-- [x] Show Custom Dialog from Extension `github.com/hiddify/hiddify-core/extension.ShowDialog()`
-- [x] Show Alert Dialog from Extension `github.com/hiddify/hiddify-core/extension.ShowMessage()`
-- [x] Get Data from UI `github.com/hiddify/hiddify-core/extension.SubmitData()`
-- [x] Save Extension Data from `e.Base.Data`
-- [x] Load Extension Data to `e.Base.Data`
-- [x] Disable / Enable Extension
-- [x] Update user proxies before connecting `github.com/hiddify/hiddify-core/extension.BeforeAppConnect()`
-- [x] Run Tiny Independent Instance `github.com/hiddify/hiddify-core/extension/sdk.RunInstance()`
-- [x] Parse Any type of configs/url `github.com/hiddify/hiddify-core/extension/sdk.ParseConfig()`
-- [ ] ToDo: Add Support for MultiLanguage Interface
-- [ ] ToDo: Custom Extension Outbound
-- [ ] ToDo: Custom Extension Inbound
-- [ ] ToDo: Custom Extension ProxyConfig
-
- Demo Screenshots from HTML:
-
-
-
-
diff --git a/libcore/assets/hiddify-cli.ico b/libcore/assets/hiddify-cli.ico
deleted file mode 100644
index 65d4406..0000000
Binary files a/libcore/assets/hiddify-cli.ico and /dev/null differ
diff --git a/libcore/bin/.gitkeep b/libcore/bin/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/libcore/bin/libcore-sources.jar b/libcore/bin/libcore-sources.jar
deleted file mode 100644
index 14ac7c5..0000000
Binary files a/libcore/bin/libcore-sources.jar and /dev/null differ
diff --git a/libcore/bridge/bridge.go b/libcore/bridge/bridge.go
deleted file mode 100644
index cdd9659..0000000
--- a/libcore/bridge/bridge.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// +build cgo
-package bridge
-
-// #include "stdint.h"
-// #include "include/dart_api_dl.c"
-//
-// // Go does not allow calling C function pointers directly. So we are
-// // forced to provide a trampoline.
-// bool GoDart_PostCObject(Dart_Port_DL port, Dart_CObject* obj) {
-// return Dart_PostCObject_DL(port, obj);
-// }
-import "C"
-import (
- "fmt"
- "unsafe"
-)
-
-func InitializeDartApi(api unsafe.Pointer) {
- if C.Dart_InitializeApiDL(api) != 0 {
- panic("failed to initialize Dart DL C API: version mismatch. " +
- "must update include/ to match Dart SDK version")
- }
-}
-
-func SendStringToPort(port int64, msg string) {
- var obj C.Dart_CObject
- obj._type = C.Dart_CObject_kString
- msg_obj := C.CString(msg) // go string -> char*s
- // union type, we do a force conversion
- ptr := unsafe.Pointer(&obj.value[0])
- *(**C.char)(ptr) = msg_obj
- ret := C.GoDart_PostCObject(C.Dart_Port_DL(port), &obj)
- if !ret {
- fmt.Println("ERROR: post to port ", port, " failed", msg)
- }
-}
diff --git a/libcore/bridge/bridge_stub.go b/libcore/bridge/bridge_stub.go
deleted file mode 100644
index be021a9..0000000
--- a/libcore/bridge/bridge_stub.go
+++ /dev/null
@@ -1,11 +0,0 @@
-//go:build !cgo
-// +build !cgo
-
-package bridge
-
-import "unsafe"
-
-func InitializeDartApi(api unsafe.Pointer) {
-}
-func SendStringToPort(port int64, msg string) {
-}
diff --git a/libcore/bridge/include/BUILD.gn b/libcore/bridge/include/BUILD.gn
deleted file mode 100644
index 2b10262..0000000
--- a/libcore/bridge/include/BUILD.gn
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-import("../../sdk_args.gni")
-
-# This rule copies header files to include/
-copy("copy_headers") {
- visibility = [ "../../sdk:copy_headers" ]
-
- sources = [
- "dart_api.h",
- "dart_api_dl.c",
- "dart_api_dl.h",
- "dart_native_api.h",
- "dart_tools_api.h",
- "dart_version.h",
- "internal/dart_api_dl_impl.h",
- ]
-
- outputs =
- [ "$root_out_dir/$dart_sdk_output/include/{{source_target_relative}}" ]
-}
diff --git a/libcore/bridge/include/analyze_snapshot_api.h b/libcore/bridge/include/analyze_snapshot_api.h
deleted file mode 100644
index 38b58e0..0000000
--- a/libcore/bridge/include/analyze_snapshot_api.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
-#define RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
-
-#include
-#include
-
-namespace dart {
-namespace snapshot_analyzer {
-typedef struct {
- const uint8_t* vm_snapshot_data;
- const uint8_t* vm_snapshot_instructions;
- const uint8_t* vm_isolate_data;
- const uint8_t* vm_isolate_instructions;
-} Dart_SnapshotAnalyzerInformation;
-
-void Dart_DumpSnapshotInformationAsJson(
- const Dart_SnapshotAnalyzerInformation& info,
- char** buffer,
- intptr_t* buffer_length);
-
-} // namespace snapshot_analyzer
-} // namespace dart
-
-#endif // RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
diff --git a/libcore/bridge/include/bin/dart_io_api.h b/libcore/bridge/include/bin/dart_io_api.h
deleted file mode 100644
index cc64797..0000000
--- a/libcore/bridge/include/bin/dart_io_api.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifndef RUNTIME_INCLUDE_BIN_DART_IO_API_H_
-#define RUNTIME_INCLUDE_BIN_DART_IO_API_H_
-
-#include "dart_tools_api.h"
-
-namespace dart {
-namespace bin {
-
-// Bootstraps 'dart:io'.
-void BootstrapDartIo();
-
-// Cleans up 'dart:io'.
-void CleanupDartIo();
-
-// Lets dart:io know where the system temporary directory is located.
-// Currently only wired up on Android.
-void SetSystemTempDirectory(const char* system_temp);
-
-// Tells the system whether to capture Stdout events.
-void SetCaptureStdout(bool value);
-
-// Tells the system whether to capture Stderr events.
-void SetCaptureStderr(bool value);
-
-// Should Stdout events be captured?
-bool ShouldCaptureStdout();
-
-// Should Stderr events be captured?
-bool ShouldCaptureStderr();
-
-// Set the executable name used by Platform.executable.
-void SetExecutableName(const char* executable_name);
-
-// Set the arguments used by Platform.executableArguments.
-void SetExecutableArguments(int script_index, char** argv);
-
-// Set dart:io implementation specific fields of Dart_EmbedderInformation.
-void GetIOEmbedderInformation(Dart_EmbedderInformation* info);
-
-// Appropriate to assign to Dart_InitializeParams.file_open/read/write/close.
-void* OpenFile(const char* name, bool write);
-void ReadFile(uint8_t** data, intptr_t* file_len, void* stream);
-void WriteFile(const void* buffer, intptr_t num_bytes, void* stream);
-void CloseFile(void* stream);
-
-// Generates 'length' random bytes into 'buffer'. Returns true on success
-// and false on failure. This is appropriate to assign to
-// Dart_InitializeParams.entropy_source.
-bool GetEntropy(uint8_t* buffer, intptr_t length);
-
-// Performs a lookup of the I/O Dart_NativeFunction with a specified 'name' and
-// 'argument_count'. Returns NULL if no I/O native function with a matching
-// name and parameter count is found.
-Dart_NativeFunction LookupIONative(Dart_Handle name,
- int argument_count,
- bool* auto_setup_scope);
-
-// Returns the symbol for I/O native function 'nf'. Returns NULL if 'nf' is not
-// a valid I/O native function.
-const uint8_t* LookupIONativeSymbol(Dart_NativeFunction nf);
-
-} // namespace bin
-} // namespace dart
-
-#endif // RUNTIME_INCLUDE_BIN_DART_IO_API_H_
diff --git a/libcore/bridge/include/dart_api.h b/libcore/bridge/include/dart_api.h
deleted file mode 100644
index 1b39620..0000000
--- a/libcore/bridge/include/dart_api.h
+++ /dev/null
@@ -1,4172 +0,0 @@
-/*
- * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_DART_API_H_
-#define RUNTIME_INCLUDE_DART_API_H_
-
-/** \mainpage Dart Embedding API Reference
- *
- * This reference describes the Dart Embedding API, which is used to embed the
- * Dart Virtual Machine within C/C++ applications.
- *
- * This reference is generated from the header include/dart_api.h.
- */
-
-/* __STDC_FORMAT_MACROS has to be defined before including to
- * enable platform independent printf format specifiers. */
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-
-#include
-#include
-#include
-
-#if defined(__Fuchsia__)
-#include
-#endif
-
-#ifdef __cplusplus
-#define DART_EXTERN_C extern "C"
-#else
-#define DART_EXTERN_C extern
-#endif
-
-#if defined(__CYGWIN__)
-#error Tool chain and platform not supported.
-#elif defined(_WIN32)
-#if defined(DART_SHARED_LIB)
-#define DART_EXPORT DART_EXTERN_C __declspec(dllexport)
-#else
-#define DART_EXPORT DART_EXTERN_C
-#endif
-#else
-#if __GNUC__ >= 4
-#if defined(DART_SHARED_LIB)
-#define DART_EXPORT \
- DART_EXTERN_C __attribute__((visibility("default"))) __attribute((used))
-#else
-#define DART_EXPORT DART_EXTERN_C
-#endif
-#else
-#error Tool chain not supported.
-#endif
-#endif
-
-#if __GNUC__
-#define DART_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#define DART_DEPRECATED(msg) __attribute__((deprecated(msg)))
-#elif _MSC_VER
-#define DART_WARN_UNUSED_RESULT _Check_return_
-#define DART_DEPRECATED(msg) __declspec(deprecated(msg))
-#else
-#define DART_WARN_UNUSED_RESULT
-#define DART_DEPRECATED(msg)
-#endif
-
-/*
- * =======
- * Handles
- * =======
- */
-
-/**
- * An isolate is the unit of concurrency in Dart. Each isolate has
- * its own memory and thread of control. No state is shared between
- * isolates. Instead, isolates communicate by message passing.
- *
- * Each thread keeps track of its current isolate, which is the
- * isolate which is ready to execute on the current thread. The
- * current isolate may be NULL, in which case no isolate is ready to
- * execute. Most of the Dart apis require there to be a current
- * isolate in order to function without error. The current isolate is
- * set by any call to Dart_CreateIsolateGroup or Dart_EnterIsolate.
- */
-typedef struct _Dart_Isolate* Dart_Isolate;
-typedef struct _Dart_IsolateGroup* Dart_IsolateGroup;
-
-/**
- * An object reference managed by the Dart VM garbage collector.
- *
- * Because the garbage collector may move objects, it is unsafe to
- * refer to objects directly. Instead, we refer to objects through
- * handles, which are known to the garbage collector and updated
- * automatically when the object is moved. Handles should be passed
- * by value (except in cases like out-parameters) and should never be
- * allocated on the heap.
- *
- * Most functions in the Dart Embedding API return a handle. When a
- * function completes normally, this will be a valid handle to an
- * object in the Dart VM heap. This handle may represent the result of
- * the operation or it may be a special valid handle used merely to
- * indicate successful completion. Note that a valid handle may in
- * some cases refer to the null object.
- *
- * --- Error handles ---
- *
- * When a function encounters a problem that prevents it from
- * completing normally, it returns an error handle (See Dart_IsError).
- * An error handle has an associated error message that gives more
- * details about the problem (See Dart_GetError).
- *
- * There are four kinds of error handles that can be produced,
- * depending on what goes wrong:
- *
- * - Api error handles are produced when an api function is misused.
- * This happens when a Dart embedding api function is called with
- * invalid arguments or in an invalid context.
- *
- * - Unhandled exception error handles are produced when, during the
- * execution of Dart code, an exception is thrown but not caught.
- * Prototypically this would occur during a call to Dart_Invoke, but
- * it can occur in any function which triggers the execution of Dart
- * code (for example, Dart_ToString).
- *
- * An unhandled exception error provides access to an exception and
- * stacktrace via the functions Dart_ErrorGetException and
- * Dart_ErrorGetStackTrace.
- *
- * - Compilation error handles are produced when, during the execution
- * of Dart code, a compile-time error occurs. As above, this can
- * occur in any function which triggers the execution of Dart code.
- *
- * - Fatal error handles are produced when the system wants to shut
- * down the current isolate.
- *
- * --- Propagating errors ---
- *
- * When an error handle is returned from the top level invocation of
- * Dart code in a program, the embedder must handle the error as they
- * see fit. Often, the embedder will print the error message produced
- * by Dart_Error and exit the program.
- *
- * When an error is returned while in the body of a native function,
- * it can be propagated up the call stack by calling
- * Dart_PropagateError, Dart_SetReturnValue, or Dart_ThrowException.
- * Errors should be propagated unless there is a specific reason not
- * to. If an error is not propagated then it is ignored. For
- * example, if an unhandled exception error is ignored, that
- * effectively "catches" the unhandled exception. Fatal errors must
- * always be propagated.
- *
- * When an error is propagated, any current scopes created by
- * Dart_EnterScope will be exited.
- *
- * Using Dart_SetReturnValue to propagate an exception is somewhat
- * more convenient than using Dart_PropagateError, and should be
- * preferred for reasons discussed below.
- *
- * Dart_PropagateError and Dart_ThrowException do not return. Instead
- * they transfer control non-locally using a setjmp-like mechanism.
- * This can be inconvenient if you have resources that you need to
- * clean up before propagating the error.
- *
- * When relying on Dart_PropagateError, we often return error handles
- * rather than propagating them from helper functions. Consider the
- * following contrived example:
- *
- * 1 Dart_Handle isLongStringHelper(Dart_Handle arg) {
- * 2 intptr_t* length = 0;
- * 3 result = Dart_StringLength(arg, &length);
- * 4 if (Dart_IsError(result)) {
- * 5 return result;
- * 6 }
- * 7 return Dart_NewBoolean(length > 100);
- * 8 }
- * 9
- * 10 void NativeFunction_isLongString(Dart_NativeArguments args) {
- * 11 Dart_EnterScope();
- * 12 AllocateMyResource();
- * 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0);
- * 14 Dart_Handle result = isLongStringHelper(arg);
- * 15 if (Dart_IsError(result)) {
- * 16 FreeMyResource();
- * 17 Dart_PropagateError(result);
- * 18 abort(); // will not reach here
- * 19 }
- * 20 Dart_SetReturnValue(result);
- * 21 FreeMyResource();
- * 22 Dart_ExitScope();
- * 23 }
- *
- * In this example, we have a native function which calls a helper
- * function to do its work. On line 5, the helper function could call
- * Dart_PropagateError, but that would not give the native function a
- * chance to call FreeMyResource(), causing a leak. Instead, the
- * helper function returns the error handle to the caller, giving the
- * caller a chance to clean up before propagating the error handle.
- *
- * When an error is propagated by calling Dart_SetReturnValue, the
- * native function will be allowed to complete normally and then the
- * exception will be propagated only once the native call
- * returns. This can be convenient, as it allows the C code to clean
- * up normally.
- *
- * The example can be written more simply using Dart_SetReturnValue to
- * propagate the error.
- *
- * 1 Dart_Handle isLongStringHelper(Dart_Handle arg) {
- * 2 intptr_t* length = 0;
- * 3 result = Dart_StringLength(arg, &length);
- * 4 if (Dart_IsError(result)) {
- * 5 return result
- * 6 }
- * 7 return Dart_NewBoolean(length > 100);
- * 8 }
- * 9
- * 10 void NativeFunction_isLongString(Dart_NativeArguments args) {
- * 11 Dart_EnterScope();
- * 12 AllocateMyResource();
- * 13 Dart_Handle arg = Dart_GetNativeArgument(args, 0);
- * 14 Dart_SetReturnValue(isLongStringHelper(arg));
- * 15 FreeMyResource();
- * 16 Dart_ExitScope();
- * 17 }
- *
- * In this example, the call to Dart_SetReturnValue on line 14 will
- * either return the normal return value or the error (potentially
- * generated on line 3). The call to FreeMyResource on line 15 will
- * execute in either case.
- *
- * --- Local and persistent handles ---
- *
- * Local handles are allocated within the current scope (see
- * Dart_EnterScope) and go away when the current scope exits. Unless
- * otherwise indicated, callers should assume that all functions in
- * the Dart embedding api return local handles.
- *
- * Persistent handles are allocated within the current isolate. They
- * can be used to store objects across scopes. Persistent handles have
- * the lifetime of the current isolate unless they are explicitly
- * deallocated (see Dart_DeletePersistentHandle).
- * The type Dart_Handle represents a handle (both local and persistent).
- * The type Dart_PersistentHandle is a Dart_Handle and it is used to
- * document that a persistent handle is expected as a parameter to a call
- * or the return value from a call is a persistent handle.
- *
- * FinalizableHandles are persistent handles which are auto deleted when
- * the object is garbage collected. It is never safe to use these handles
- * unless you know the object is still reachable.
- *
- * WeakPersistentHandles are persistent handles which are automatically set
- * to point Dart_Null when the object is garbage collected. They are not auto
- * deleted, so it is safe to use them after the object has become unreachable.
- */
-typedef struct _Dart_Handle* Dart_Handle;
-typedef Dart_Handle Dart_PersistentHandle;
-typedef struct _Dart_WeakPersistentHandle* Dart_WeakPersistentHandle;
-typedef struct _Dart_FinalizableHandle* Dart_FinalizableHandle;
-// These structs are versioned by DART_API_DL_MAJOR_VERSION, bump the
-// version when changing this struct.
-
-typedef void (*Dart_HandleFinalizer)(void* isolate_callback_data, void* peer);
-
-/**
- * Is this an error handle?
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT bool Dart_IsError(Dart_Handle handle);
-
-/**
- * Is this an api error handle?
- *
- * Api error handles are produced when an api function is misused.
- * This happens when a Dart embedding api function is called with
- * invalid arguments or in an invalid context.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT bool Dart_IsApiError(Dart_Handle handle);
-
-/**
- * Is this an unhandled exception error handle?
- *
- * Unhandled exception error handles are produced when, during the
- * execution of Dart code, an exception is thrown but not caught.
- * This can occur in any function which triggers the execution of Dart
- * code.
- *
- * See Dart_ErrorGetException and Dart_ErrorGetStackTrace.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle handle);
-
-/**
- * Is this a compilation error handle?
- *
- * Compilation error handles are produced when, during the execution
- * of Dart code, a compile-time error occurs. This can occur in any
- * function which triggers the execution of Dart code.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT bool Dart_IsCompilationError(Dart_Handle handle);
-
-/**
- * Is this a fatal error handle?
- *
- * Fatal error handles are produced when the system wants to shut down
- * the current isolate.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT bool Dart_IsFatalError(Dart_Handle handle);
-
-/**
- * Gets the error message from an error handle.
- *
- * Requires there to be a current isolate.
- *
- * \return A C string containing an error message if the handle is
- * error. An empty C string ("") if the handle is valid. This C
- * String is scope allocated and is only valid until the next call
- * to Dart_ExitScope.
-*/
-DART_EXPORT const char* Dart_GetError(Dart_Handle handle);
-
-/**
- * Is this an error handle for an unhandled exception?
- */
-DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle);
-
-/**
- * Gets the exception Object from an unhandled exception error handle.
- */
-DART_EXPORT Dart_Handle Dart_ErrorGetException(Dart_Handle handle);
-
-/**
- * Gets the stack trace Object from an unhandled exception error handle.
- */
-DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle);
-
-/**
- * Produces an api error handle with the provided error message.
- *
- * Requires there to be a current isolate.
- *
- * \param error the error message.
- */
-DART_EXPORT Dart_Handle Dart_NewApiError(const char* error);
-DART_EXPORT Dart_Handle Dart_NewCompilationError(const char* error);
-
-/**
- * Produces a new unhandled exception error handle.
- *
- * Requires there to be a current isolate.
- *
- * \param exception An instance of a Dart object to be thrown or
- * an ApiError or CompilationError handle.
- * When an ApiError or CompilationError handle is passed in
- * a string object of the error message is created and it becomes
- * the Dart object to be thrown.
- */
-DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception);
-
-/**
- * Propagates an error.
- *
- * If the provided handle is an unhandled exception error, this
- * function will cause the unhandled exception to be rethrown. This
- * will proceed in the standard way, walking up Dart frames until an
- * appropriate 'catch' block is found, executing 'finally' blocks,
- * etc.
- *
- * If the error is not an unhandled exception error, we will unwind
- * the stack to the next C frame. Intervening Dart frames will be
- * discarded; specifically, 'finally' blocks will not execute. This
- * is the standard way that compilation errors (and the like) are
- * handled by the Dart runtime.
- *
- * In either case, when an error is propagated any current scopes
- * created by Dart_EnterScope will be exited.
- *
- * See the additional discussion under "Propagating Errors" at the
- * beginning of this file.
- *
- * \param handle An error handle (See Dart_IsError)
- *
- * On success, this function does not return. On failure, the
- * process is terminated.
- */
-DART_EXPORT void Dart_PropagateError(Dart_Handle handle);
-
-/**
- * Converts an object to a string.
- *
- * May generate an unhandled exception error.
- *
- * \return The converted string if no error occurs during
- * the conversion. If an error does occur, an error handle is
- * returned.
- */
-DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object);
-
-/**
- * Checks to see if two handles refer to identically equal objects.
- *
- * If both handles refer to instances, this is equivalent to using the top-level
- * function identical() from dart:core. Otherwise, returns whether the two
- * argument handles refer to the same object.
- *
- * \param obj1 An object to be compared.
- * \param obj2 An object to be compared.
- *
- * \return True if the objects are identically equal. False otherwise.
- */
-DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2);
-
-/**
- * Allocates a handle in the current scope from a persistent handle.
- */
-DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object);
-
-/**
- * Allocates a handle in the current scope from a weak persistent handle.
- *
- * This will be a handle to Dart_Null if the object has been garbage collected.
- */
-DART_EXPORT Dart_Handle
-Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object);
-
-/**
- * Allocates a persistent handle for an object.
- *
- * This handle has the lifetime of the current isolate unless it is
- * explicitly deallocated by calling Dart_DeletePersistentHandle.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object);
-
-/**
- * Assign value of local handle to a persistent handle.
- *
- * Requires there to be a current isolate.
- *
- * \param obj1 A persistent handle whose value needs to be set.
- * \param obj2 An object whose value needs to be set to the persistent handle.
- */
-DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1,
- Dart_Handle obj2);
-
-/**
- * Deallocates a persistent handle.
- *
- * Requires there to be a current isolate group.
- */
-DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object);
-
-/**
- * Allocates a weak persistent handle for an object.
- *
- * This handle has the lifetime of the current isolate. The handle can also be
- * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle.
- *
- * If the object becomes unreachable the callback is invoked with the peer as
- * argument. The callback can be executed on any thread, will have a current
- * isolate group, but will not have a current isolate. The callback can only
- * call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle. This
- * gives the embedder the ability to cleanup data associated with the object.
- * The handle will point to the Dart_Null object after the finalizer has been
- * run. It is illegal to call into the VM with any other Dart_* functions from
- * the callback. If the handle is deleted before the object becomes
- * unreachable, the callback is never invoked.
- *
- * Requires there to be a current isolate.
- *
- * \param object An object with identity.
- * \param peer A pointer to a native object or NULL. This value is
- * provided to callback when it is invoked.
- * \param external_allocation_size The number of externally allocated
- * bytes for peer. Used to inform the garbage collector.
- * \param callback A function pointer that will be invoked sometime
- * after the object is garbage collected, unless the handle has been deleted.
- * A valid callback needs to be specified it cannot be NULL.
- *
- * \return The weak persistent handle or NULL. NULL is returned in case of bad
- * parameters.
- */
-DART_EXPORT Dart_WeakPersistentHandle
-Dart_NewWeakPersistentHandle(Dart_Handle object,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-/**
- * Deletes the given weak persistent [object] handle.
- *
- * Requires there to be a current isolate group.
- */
-DART_EXPORT void Dart_DeleteWeakPersistentHandle(
- Dart_WeakPersistentHandle object);
-
-/**
- * Allocates a finalizable handle for an object.
- *
- * This handle has the lifetime of the current isolate group unless the object
- * pointed to by the handle is garbage collected, in this case the VM
- * automatically deletes the handle after invoking the callback associated
- * with the handle. The handle can also be explicitly deallocated by
- * calling Dart_DeleteFinalizableHandle.
- *
- * If the object becomes unreachable the callback is invoked with the
- * the peer as argument. The callback can be executed on any thread, will have
- * an isolate group, but will not have a current isolate. The callback can only
- * call Dart_DeletePersistentHandle or Dart_DeleteWeakPersistentHandle.
- * This gives the embedder the ability to cleanup data associated with the
- * object and clear out any cached references to the handle. All references to
- * this handle after the callback will be invalid. It is illegal to call into
- * the VM with any other Dart_* functions from the callback. If the handle is
- * deleted before the object becomes unreachable, the callback is never
- * invoked.
- *
- * Requires there to be a current isolate.
- *
- * \param object An object with identity.
- * \param peer A pointer to a native object or NULL. This value is
- * provided to callback when it is invoked.
- * \param external_allocation_size The number of externally allocated
- * bytes for peer. Used to inform the garbage collector.
- * \param callback A function pointer that will be invoked sometime
- * after the object is garbage collected, unless the handle has been deleted.
- * A valid callback needs to be specified it cannot be NULL.
- *
- * \return The finalizable handle or NULL. NULL is returned in case of bad
- * parameters.
- */
-DART_EXPORT Dart_FinalizableHandle
-Dart_NewFinalizableHandle(Dart_Handle object,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-/**
- * Deletes the given finalizable [object] handle.
- *
- * The caller has to provide the actual Dart object the handle was created from
- * to prove the object (and therefore the finalizable handle) is still alive.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_DeleteFinalizableHandle(Dart_FinalizableHandle object,
- Dart_Handle strong_ref_to_object);
-
-
-/*
- * ==========================
- * Initialization and Globals
- * ==========================
- */
-
-/**
- * Gets the version string for the Dart VM.
- *
- * The version of the Dart VM can be accessed without initializing the VM.
- *
- * \return The version string for the embedded Dart VM.
- */
-DART_EXPORT const char* Dart_VersionString(void);
-
-/**
- * Isolate specific flags are set when creating a new isolate using the
- * Dart_IsolateFlags structure.
- *
- * Current version of flags is encoded in a 32-bit integer with 16 bits used
- * for each part.
- */
-
-#define DART_FLAGS_CURRENT_VERSION (0x0000000c)
-
-typedef struct {
- int32_t version;
- bool enable_asserts;
- bool use_field_guards;
- bool use_osr;
- bool obfuscate;
- bool load_vmservice_library;
- bool copy_parent_code;
- bool null_safety;
- bool is_system_isolate;
- bool snapshot_is_dontneed_safe;
- bool branch_coverage;
-} Dart_IsolateFlags;
-
-/**
- * Initialize Dart_IsolateFlags with correct version and default values.
- */
-DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags* flags);
-
-/**
- * An isolate creation and initialization callback function.
- *
- * This callback, provided by the embedder, is called when the VM
- * needs to create an isolate. The callback should create an isolate
- * by calling Dart_CreateIsolateGroup and load any scripts required for
- * execution.
- *
- * This callback may be called on a different thread than the one
- * running the parent isolate.
- *
- * When the function returns NULL, it is the responsibility of this
- * function to ensure that Dart_ShutdownIsolate has been called if
- * required (for example, if the isolate was created successfully by
- * Dart_CreateIsolateGroup() but the root library fails to load
- * successfully, then the function should call Dart_ShutdownIsolate
- * before returning).
- *
- * When the function returns NULL, the function should set *error to
- * a malloc-allocated buffer containing a useful error message. The
- * caller of this function (the VM) will make sure that the buffer is
- * freed.
- *
- * \param script_uri The uri of the main source file or snapshot to load.
- * Either the URI of the parent isolate set in Dart_CreateIsolateGroup for
- * Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the
- * library tag handler of the parent isolate.
- * The callback is responsible for loading the program by a call to
- * Dart_LoadScriptFromKernel.
- * \param main The name of the main entry point this isolate will
- * eventually run. This is provided for advisory purposes only to
- * improve debugging messages. The main function is not invoked by
- * this function.
- * \param package_root Ignored.
- * \param package_config Uri of the package configuration file (either in format
- * of .packages or .dart_tool/package_config.json) for this isolate
- * to resolve package imports against. If this parameter is not passed the
- * package resolution of the parent isolate should be used.
- * \param flags Default flags for this isolate being spawned. Either inherited
- * from the spawning isolate or passed as parameters when spawning the
- * isolate from Dart code.
- * \param isolate_data The isolate data which was passed to the
- * parent isolate when it was created by calling Dart_CreateIsolateGroup().
- * \param error A structure into which the embedder can place a
- * C string containing an error message in the case of failures.
- *
- * \return The embedder returns NULL if the creation and
- * initialization was not successful and the isolate if successful.
- */
-typedef Dart_Isolate (*Dart_IsolateGroupCreateCallback)(
- const char* script_uri,
- const char* main,
- const char* package_root,
- const char* package_config,
- Dart_IsolateFlags* flags,
- void* isolate_data,
- char** error);
-
-/**
- * An isolate initialization callback function.
- *
- * This callback, provided by the embedder, is called when the VM has created an
- * isolate within an existing isolate group (i.e. from the same source as an
- * existing isolate).
- *
- * The callback should setup native resolvers and might want to set a custom
- * message handler via [Dart_SetMessageNotifyCallback] and mark the isolate as
- * runnable.
- *
- * This callback may be called on a different thread than the one
- * running the parent isolate.
- *
- * When the function returns `false`, it is the responsibility of this
- * function to ensure that `Dart_ShutdownIsolate` has been called.
- *
- * When the function returns `false`, the function should set *error to
- * a malloc-allocated buffer containing a useful error message. The
- * caller of this function (the VM) will make sure that the buffer is
- * freed.
- *
- * \param child_isolate_data The callback data to associate with the new
- * child isolate.
- * \param error A structure into which the embedder can place a
- * C string containing an error message in the case the initialization fails.
- *
- * \return The embedder returns true if the initialization was successful and
- * false otherwise (in which case the VM will terminate the isolate).
- */
-typedef bool (*Dart_InitializeIsolateCallback)(void** child_isolate_data,
- char** error);
-
-/**
- * An isolate shutdown callback function.
- *
- * This callback, provided by the embedder, is called before the vm
- * shuts down an isolate. The isolate being shutdown will be the current
- * isolate. It is safe to run Dart code.
- *
- * This function should be used to dispose of native resources that
- * are allocated to an isolate in order to avoid leaks.
- *
- * \param isolate_group_data The same callback data which was passed to the
- * isolate group when it was created.
- * \param isolate_data The same callback data which was passed to the isolate
- * when it was created.
- */
-typedef void (*Dart_IsolateShutdownCallback)(void* isolate_group_data,
- void* isolate_data);
-
-/**
- * An isolate cleanup callback function.
- *
- * This callback, provided by the embedder, is called after the vm
- * shuts down an isolate. There will be no current isolate and it is *not*
- * safe to run Dart code.
- *
- * This function should be used to dispose of native resources that
- * are allocated to an isolate in order to avoid leaks.
- *
- * \param isolate_group_data The same callback data which was passed to the
- * isolate group when it was created.
- * \param isolate_data The same callback data which was passed to the isolate
- * when it was created.
- */
-typedef void (*Dart_IsolateCleanupCallback)(void* isolate_group_data,
- void* isolate_data);
-
-/**
- * An isolate group cleanup callback function.
- *
- * This callback, provided by the embedder, is called after the vm
- * shuts down an isolate group.
- *
- * This function should be used to dispose of native resources that
- * are allocated to an isolate in order to avoid leaks.
- *
- * \param isolate_group_data The same callback data which was passed to the
- * isolate group when it was created.
- *
- */
-typedef void (*Dart_IsolateGroupCleanupCallback)(void* isolate_group_data);
-
-/**
- * A thread start callback function.
- * This callback, provided by the embedder, is called after a thread in the
- * vm thread pool starts.
- * This function could be used to adjust thread priority or attach native
- * resources to the thread.
- */
-typedef void (*Dart_ThreadStartCallback)(void);
-
-/**
- * A thread death callback function.
- * This callback, provided by the embedder, is called before a thread in the
- * vm thread pool exits.
- * This function could be used to dispose of native resources that
- * are associated and attached to the thread, in order to avoid leaks.
- */
-typedef void (*Dart_ThreadExitCallback)(void);
-
-/**
- * Opens a file for reading or writing.
- *
- * Callback provided by the embedder for file operations. If the
- * embedder does not allow file operations this callback can be
- * NULL.
- *
- * \param name The name of the file to open.
- * \param write A boolean variable which indicates if the file is to
- * opened for writing. If there is an existing file it needs to truncated.
- */
-typedef void* (*Dart_FileOpenCallback)(const char* name, bool write);
-
-/**
- * Read contents of file.
- *
- * Callback provided by the embedder for file operations. If the
- * embedder does not allow file operations this callback can be
- * NULL.
- *
- * \param data Buffer allocated in the callback into which the contents
- * of the file are read into. It is the responsibility of the caller to
- * free this buffer.
- * \param file_length A variable into which the length of the file is returned.
- * In the case of an error this value would be -1.
- * \param stream Handle to the opened file.
- */
-typedef void (*Dart_FileReadCallback)(uint8_t** data,
- intptr_t* file_length,
- void* stream);
-
-/**
- * Write data into file.
- *
- * Callback provided by the embedder for file operations. If the
- * embedder does not allow file operations this callback can be
- * NULL.
- *
- * \param data Buffer which needs to be written into the file.
- * \param length Length of the buffer.
- * \param stream Handle to the opened file.
- */
-typedef void (*Dart_FileWriteCallback)(const void* data,
- intptr_t length,
- void* stream);
-
-/**
- * Closes the opened file.
- *
- * Callback provided by the embedder for file operations. If the
- * embedder does not allow file operations this callback can be
- * NULL.
- *
- * \param stream Handle to the opened file.
- */
-typedef void (*Dart_FileCloseCallback)(void* stream);
-
-typedef bool (*Dart_EntropySource)(uint8_t* buffer, intptr_t length);
-
-/**
- * Callback provided by the embedder that is used by the vmservice isolate
- * to request the asset archive. The asset archive must be an uncompressed tar
- * archive that is stored in a Uint8List.
- *
- * If the embedder has no vmservice isolate assets, the callback can be NULL.
- *
- * \return The embedder must return a handle to a Uint8List containing an
- * uncompressed tar archive or null.
- */
-typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(void);
-
-/**
- * The current version of the Dart_InitializeFlags. Should be incremented every
- * time Dart_InitializeFlags changes in a binary incompatible way.
- */
-#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000008)
-
-/** Forward declaration */
-struct Dart_CodeObserver;
-
-/**
- * Callback provided by the embedder that is used by the VM to notify on code
- * object creation, *before* it is invoked the first time.
- * This is useful for embedders wanting to e.g. keep track of PCs beyond
- * the lifetime of the garbage collected code objects.
- * Note that an address range may be used by more than one code object over the
- * lifecycle of a process. Clients of this function should record timestamps for
- * these compilation events and when collecting PCs to disambiguate reused
- * address ranges.
- */
-typedef void (*Dart_OnNewCodeCallback)(struct Dart_CodeObserver* observer,
- const char* name,
- uintptr_t base,
- uintptr_t size);
-
-typedef struct Dart_CodeObserver {
- void* data;
-
- Dart_OnNewCodeCallback on_new_code;
-} Dart_CodeObserver;
-
-/**
- * Optional callback provided by the embedder that is used by the VM to
- * implement registration of kernel blobs for the subsequent Isolate.spawnUri
- * If no callback is provided, the registration of kernel blobs will throw
- * an error.
- *
- * \param kernel_buffer A buffer which contains a kernel program. Callback
- * should copy the contents of `kernel_buffer` as
- * it may be freed immediately after registration.
- * \param kernel_buffer_size The size of `kernel_buffer`.
- *
- * \return A C string representing URI which can be later used
- * to spawn a new isolate. This C String should be scope allocated
- * or owned by the embedder.
- * Returns NULL if embedder runs out of memory.
- */
-typedef const char* (*Dart_RegisterKernelBlobCallback)(
- const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size);
-
-/**
- * Optional callback provided by the embedder that is used by the VM to
- * unregister kernel blobs.
- * If no callback is provided, the unregistration of kernel blobs will throw
- * an error.
- *
- * \param kernel_blob_uri URI of the kernel blob to unregister.
- */
-typedef void (*Dart_UnregisterKernelBlobCallback)(const char* kernel_blob_uri);
-
-/**
- * Describes how to initialize the VM. Used with Dart_Initialize.
- */
-typedef struct {
- /**
- * Identifies the version of the struct used by the client.
- * should be initialized to DART_INITIALIZE_PARAMS_CURRENT_VERSION.
- */
- int32_t version;
-
- /**
- * A buffer containing snapshot data, or NULL if no snapshot is provided.
- *
- * If provided, the buffer must remain valid until Dart_Cleanup returns.
- */
- const uint8_t* vm_snapshot_data;
-
- /**
- * A buffer containing a snapshot of precompiled instructions, or NULL if
- * no snapshot is provided.
- *
- * If provided, the buffer must remain valid until Dart_Cleanup returns.
- */
- const uint8_t* vm_snapshot_instructions;
-
- /**
- * A function to be called during isolate group creation.
- * See Dart_IsolateGroupCreateCallback.
- */
- Dart_IsolateGroupCreateCallback create_group;
-
- /**
- * A function to be called during isolate
- * initialization inside an existing isolate group.
- * See Dart_InitializeIsolateCallback.
- */
- Dart_InitializeIsolateCallback initialize_isolate;
-
- /**
- * A function to be called right before an isolate is shutdown.
- * See Dart_IsolateShutdownCallback.
- */
- Dart_IsolateShutdownCallback shutdown_isolate;
-
- /**
- * A function to be called after an isolate was shutdown.
- * See Dart_IsolateCleanupCallback.
- */
- Dart_IsolateCleanupCallback cleanup_isolate;
-
- /**
- * A function to be called after an isolate group is
- * shutdown. See Dart_IsolateGroupCleanupCallback.
- */
- Dart_IsolateGroupCleanupCallback cleanup_group;
-
- Dart_ThreadStartCallback thread_start;
- Dart_ThreadExitCallback thread_exit;
- Dart_FileOpenCallback file_open;
- Dart_FileReadCallback file_read;
- Dart_FileWriteCallback file_write;
- Dart_FileCloseCallback file_close;
- Dart_EntropySource entropy_source;
-
- /**
- * A function to be called by the service isolate when it requires the
- * vmservice assets archive. See Dart_GetVMServiceAssetsArchive.
- */
- Dart_GetVMServiceAssetsArchive get_service_assets;
-
- bool start_kernel_isolate;
-
- /**
- * An external code observer callback function. The observer can be invoked
- * as early as during the Dart_Initialize() call.
- */
- Dart_CodeObserver* code_observer;
-
- /**
- * Kernel blob registration callback function. See Dart_RegisterKernelBlobCallback.
- */
- Dart_RegisterKernelBlobCallback register_kernel_blob;
-
- /**
- * Kernel blob unregistration callback function. See Dart_UnregisterKernelBlobCallback.
- */
- Dart_UnregisterKernelBlobCallback unregister_kernel_blob;
-
-#if defined(__Fuchsia__)
- /**
- * The resource needed to use zx_vmo_replace_as_executable. Can be
- * ZX_HANDLE_INVALID if the process has ambient-replace-as-executable or if
- * executable memory is not needed (e.g., this is an AOT runtime).
- */
- zx_handle_t vmex_resource;
-#endif
-} Dart_InitializeParams;
-
-/**
- * Initializes the VM.
- *
- * \param params A struct containing initialization information. The version
- * field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION.
- *
- * \return NULL if initialization is successful. Returns an error message
- * otherwise. The caller is responsible for freeing the error message.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_Initialize(
- Dart_InitializeParams* params);
-
-/**
- * Cleanup state in the VM before process termination.
- *
- * \return NULL if cleanup is successful. Returns an error message otherwise.
- * The caller is responsible for freeing the error message.
- *
- * NOTE: This function must not be called on a thread that was created by the VM
- * itself.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_Cleanup(void);
-
-/**
- * Sets command line flags. Should be called before Dart_Initialize.
- *
- * \param argc The length of the arguments array.
- * \param argv An array of arguments.
- *
- * \return NULL if successful. Returns an error message otherwise.
- * The caller is responsible for freeing the error message.
- *
- * NOTE: This call does not store references to the passed in c-strings.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_SetVMFlags(int argc,
- const char** argv);
-
-/**
- * Returns true if the named VM flag is of boolean type, specified, and set to
- * true.
- *
- * \param flag_name The name of the flag without leading punctuation
- * (example: "enable_asserts").
- */
-DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
-
-/*
- * ========
- * Isolates
- * ========
- */
-
-/**
- * Creates a new isolate. The new isolate becomes the current isolate.
- *
- * A snapshot can be used to restore the VM quickly to a saved state
- * and is useful for fast startup. If snapshot data is provided, the
- * isolate will be started using that snapshot data. Requires a core snapshot or
- * an app snapshot created by Dart_CreateSnapshot or
- * Dart_CreatePrecompiledSnapshot* from a VM with the same version.
- *
- * Requires there to be no current isolate.
- *
- * \param script_uri The main source file or snapshot this isolate will load.
- * The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a
- * child isolate is created by Isolate.spawn. The embedder should use a URI
- * that allows it to load the same program into such a child isolate.
- * \param name A short name for the isolate to improve debugging messages.
- * Typically of the format 'foo.dart:main()'.
- * \param isolate_snapshot_data Buffer containing the snapshot data of the
- * isolate or NULL if no snapshot is provided. If provided, the buffer must
- * remain valid until the isolate shuts down.
- * \param isolate_snapshot_instructions Buffer containing the snapshot
- * instructions of the isolate or NULL if no snapshot is provided. If
- * provided, the buffer must remain valid until the isolate shuts down.
- * \param flags Pointer to VM specific flags or NULL for default flags.
- * \param isolate_group_data Embedder group data. This data can be obtained
- * by calling Dart_IsolateGroupData and will be passed to the
- * Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and
- * Dart_IsolateGroupCleanupCallback.
- * \param isolate_data Embedder data. This data will be passed to
- * the Dart_IsolateGroupCreateCallback when new isolates are spawned from
- * this parent isolate.
- * \param error Returns NULL if creation is successful, an error message
- * otherwise. The caller is responsible for calling free() on the error
- * message.
- *
- * \return The new isolate on success, or NULL if isolate creation failed.
- */
-DART_EXPORT Dart_Isolate
-Dart_CreateIsolateGroup(const char* script_uri,
- const char* name,
- const uint8_t* isolate_snapshot_data,
- const uint8_t* isolate_snapshot_instructions,
- Dart_IsolateFlags* flags,
- void* isolate_group_data,
- void* isolate_data,
- char** error);
-/**
- * Creates a new isolate inside the isolate group of [group_member].
- *
- * Requires there to be no current isolate.
- *
- * \param group_member An isolate from the same group into which the newly created
- * isolate should be born into. Other threads may not have entered / enter this
- * member isolate.
- * \param name A short name for the isolate for debugging purposes.
- * \param shutdown_callback A callback to be called when the isolate is being
- * shutdown (may be NULL).
- * \param cleanup_callback A callback to be called when the isolate is being
- * cleaned up (may be NULL).
- * \param child_isolate_data The embedder-specific data associated with this isolate.
- * \param error Set to NULL if creation is successful, set to an error
- * message otherwise. The caller is responsible for calling free() on the
- * error message.
- *
- * \return The newly created isolate on success, or NULL if isolate creation
- * failed.
- *
- * If successful, the newly created isolate will become the current isolate.
- */
-DART_EXPORT Dart_Isolate
-Dart_CreateIsolateInGroup(Dart_Isolate group_member,
- const char* name,
- Dart_IsolateShutdownCallback shutdown_callback,
- Dart_IsolateCleanupCallback cleanup_callback,
- void* child_isolate_data,
- char** error);
-
-/* TODO(turnidge): Document behavior when there is already a current
- * isolate. */
-
-/**
- * Creates a new isolate from a Dart Kernel file. The new isolate
- * becomes the current isolate.
- *
- * Requires there to be no current isolate.
- *
- * \param script_uri The main source file or snapshot this isolate will load.
- * The VM will provide this URI to the Dart_IsolateGroupCreateCallback when a
- * child isolate is created by Isolate.spawn. The embedder should use a URI that
- * allows it to load the same program into such a child isolate.
- * \param name A short name for the isolate to improve debugging messages.
- * Typically of the format 'foo.dart:main()'.
- * \param kernel_buffer A buffer which contains a kernel/DIL program. Must
- * remain valid until isolate shutdown.
- * \param kernel_buffer_size The size of `kernel_buffer`.
- * \param flags Pointer to VM specific flags or NULL for default flags.
- * \param isolate_group_data Embedder group data. This data can be obtained
- * by calling Dart_IsolateGroupData and will be passed to the
- * Dart_IsolateShutdownCallback, Dart_IsolateCleanupCallback, and
- * Dart_IsolateGroupCleanupCallback.
- * \param isolate_data Embedder data. This data will be passed to
- * the Dart_IsolateGroupCreateCallback when new isolates are spawned from
- * this parent isolate.
- * \param error Returns NULL if creation is successful, an error message
- * otherwise. The caller is responsible for calling free() on the error
- * message.
- *
- * \return The new isolate on success, or NULL if isolate creation failed.
- */
-DART_EXPORT Dart_Isolate
-Dart_CreateIsolateGroupFromKernel(const char* script_uri,
- const char* name,
- const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size,
- Dart_IsolateFlags* flags,
- void* isolate_group_data,
- void* isolate_data,
- char** error);
-/**
- * Shuts down the current isolate. After this call, the current isolate is NULL.
- * Any current scopes created by Dart_EnterScope will be exited. Invokes the
- * shutdown callback and any callbacks of remaining weak persistent handles.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_ShutdownIsolate(void);
-/* TODO(turnidge): Document behavior when there is no current isolate. */
-
-/**
- * Returns the current isolate. Will return NULL if there is no
- * current isolate.
- */
-DART_EXPORT Dart_Isolate Dart_CurrentIsolate(void);
-
-/**
- * Returns the callback data associated with the current isolate. This
- * data was set when the isolate got created or initialized.
- */
-DART_EXPORT void* Dart_CurrentIsolateData(void);
-
-/**
- * Returns the callback data associated with the given isolate. This
- * data was set when the isolate got created or initialized.
- */
-DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate);
-
-/**
- * Returns the current isolate group. Will return NULL if there is no
- * current isolate group.
- */
-DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup(void);
-
-/**
- * Returns the callback data associated with the current isolate group. This
- * data was passed to the isolate group when it was created.
- */
-DART_EXPORT void* Dart_CurrentIsolateGroupData(void);
-
-/**
- * Gets an id that uniquely identifies current isolate group.
- *
- * It is the responsibility of the caller to free the returned ID.
- */
-typedef int64_t Dart_IsolateGroupId;
-DART_EXPORT Dart_IsolateGroupId Dart_CurrentIsolateGroupId(void);
-
-/**
- * Returns the callback data associated with the specified isolate group. This
- * data was passed to the isolate when it was created.
- * The embedder is responsible for ensuring the consistency of this data
- * with respect to the lifecycle of an isolate group.
- */
-DART_EXPORT void* Dart_IsolateGroupData(Dart_Isolate isolate);
-
-/**
- * Returns the debugging name for the current isolate.
- *
- * This name is unique to each isolate and should only be used to make
- * debugging messages more comprehensible.
- */
-DART_EXPORT Dart_Handle Dart_DebugName(void);
-
-/**
- * Returns the debugging name for the current isolate.
- *
- * This name is unique to each isolate and should only be used to make
- * debugging messages more comprehensible.
- *
- * The returned string is scope allocated and is only valid until the next call
- * to Dart_ExitScope.
- */
-DART_EXPORT const char* Dart_DebugNameToCString(void);
-
-/**
- * Returns the ID for an isolate which is used to query the service protocol.
- *
- * It is the responsibility of the caller to free the returned ID.
- */
-DART_EXPORT const char* Dart_IsolateServiceId(Dart_Isolate isolate);
-
-/**
- * Enters an isolate. After calling this function,
- * the current isolate will be set to the provided isolate.
- *
- * Requires there to be no current isolate. Multiple threads may not be in
- * the same isolate at once.
- */
-DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
-
-/**
- * Kills the given isolate.
- *
- * This function has the same effect as dart:isolate's
- * Isolate.kill(priority:immediate).
- * It can interrupt ordinary Dart code but not native code. If the isolate is
- * in the middle of a long running native function, the isolate will not be
- * killed until control returns to Dart.
- *
- * Does not require a current isolate. It is safe to kill the current isolate if
- * there is one.
- */
-DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate);
-
-/**
- * Notifies the VM that the embedder expects to be idle until |deadline|. The VM
- * may use this time to perform garbage collection or other tasks to avoid
- * delays during execution of Dart code in the future.
- *
- * |deadline| is measured in microseconds against the system's monotonic time.
- * This clock can be accessed via Dart_TimelineGetMicros().
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_NotifyIdle(int64_t deadline);
-
-typedef void (*Dart_HeapSamplingReportCallback)(void* context,
- void* data);
-
-typedef void* (*Dart_HeapSamplingCreateCallback)(
- Dart_Isolate isolate,
- Dart_IsolateGroup isolate_group,
- const char* cls_name,
- intptr_t allocation_size);
-typedef void (*Dart_HeapSamplingDeleteCallback)(void* data);
-
-/**
- * Starts the heap sampling profiler for each thread in the VM.
- */
-DART_EXPORT void Dart_EnableHeapSampling(void);
-
-/*
- * Stops the heap sampling profiler for each thread in the VM.
- */
-DART_EXPORT void Dart_DisableHeapSampling(void);
-
-/* Registers callbacks are invoked once per sampled allocation upon object
- * allocation and garbage collection.
- *
- * |create_callback| can be used to associate additional data with the sampled
- * allocation, such as a stack trace. This data pointer will be passed to
- * |delete_callback| to allow for proper disposal when the object associated
- * with the allocation sample is collected.
- *
- * The provided callbacks must not call into the VM and should do as little
- * work as possible to avoid performance penalities during object allocation and
- * garbage collection.
- *
- * NOTE: It is a fatal error to set either callback to null once they have been
- * initialized.
- */
-DART_EXPORT void Dart_RegisterHeapSamplingCallback(
- Dart_HeapSamplingCreateCallback create_callback,
- Dart_HeapSamplingDeleteCallback delete_callback);
-
-/*
- * Reports the surviving allocation samples for all live isolate groups in the
- * VM.
- *
- * When the callback is invoked:
- * - |context| will be the context object provided when invoking
- * |Dart_ReportSurvivingAllocations|. This can be safely set to null if not
- * required.
- * - |heap_size| will be equal to the size of the allocated object associated
- * with the sample.
- * - |cls_name| will be a C String representing
- * the class name of the allocated object. This string is valid for the
- * duration of the call to Dart_ReportSurvivingAllocations and can be
- * freed by the VM at any point after the method returns.
- * - |data| will be set to the data associated with the sample by
- * |Dart_HeapSamplingCreateCallback|.
- *
- * If |force_gc| is true, a full GC will be performed before reporting the
- * allocations.
- */
-DART_EXPORT void Dart_ReportSurvivingAllocations(
- Dart_HeapSamplingReportCallback callback,
- void* context,
- bool force_gc);
-
-/*
- * Sets the average heap sampling rate based on a number of |bytes| for each
- * thread.
- *
- * In other words, approximately every |bytes| allocated will create a sample.
- * Defaults to 512 KiB.
- */
-DART_EXPORT void Dart_SetHeapSamplingPeriod(intptr_t bytes);
-
-/**
- * Notifies the VM that the embedder expects the application's working set has
- * recently shrunk significantly and is not expected to rise in the near future.
- * The VM may spend O(heap-size) time performing clean up work.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_NotifyDestroyed(void);
-
-/**
- * Notifies the VM that the system is running low on memory.
- *
- * Does not require a current isolate. Only valid after calling Dart_Initialize.
- */
-DART_EXPORT void Dart_NotifyLowMemory(void);
-
-typedef enum {
- /**
- * Balanced
- */
- Dart_PerformanceMode_Default,
- /**
- * Optimize for low latency, at the expense of throughput and memory overhead
- * by performing work in smaller batches (requiring more overhead) or by
- * delaying work (requiring more memory). An embedder should not remain in
- * this mode indefinitely.
- */
- Dart_PerformanceMode_Latency,
- /**
- * Optimize for high throughput, at the expense of latency and memory overhead
- * by performing work in larger batches with more intervening growth.
- */
- Dart_PerformanceMode_Throughput,
- /**
- * Optimize for low memory, at the expensive of throughput and latency by more
- * frequently performing work.
- */
- Dart_PerformanceMode_Memory,
-} Dart_PerformanceMode;
-
-/**
- * Set the desired performance trade-off.
- *
- * Requires a current isolate.
- *
- * Returns the previous performance mode.
- */
-DART_EXPORT Dart_PerformanceMode
-Dart_SetPerformanceMode(Dart_PerformanceMode mode);
-
-/**
- * Starts the CPU sampling profiler.
- */
-DART_EXPORT void Dart_StartProfiling(void);
-
-/**
- * Stops the CPU sampling profiler.
- *
- * Note that some profile samples might still be taken after this function
- * returns due to the asynchronous nature of the implementation on some
- * platforms.
- */
-DART_EXPORT void Dart_StopProfiling(void);
-
-/**
- * Notifies the VM that the current thread should not be profiled until a
- * matching call to Dart_ThreadEnableProfiling is made.
- *
- * NOTE: By default, if a thread has entered an isolate it will be profiled.
- * This function should be used when an embedder knows a thread is about
- * to make a blocking call and wants to avoid unnecessary interrupts by
- * the profiler.
- */
-DART_EXPORT void Dart_ThreadDisableProfiling(void);
-
-/**
- * Notifies the VM that the current thread should be profiled.
- *
- * NOTE: It is only legal to call this function *after* calling
- * Dart_ThreadDisableProfiling.
- *
- * NOTE: By default, if a thread has entered an isolate it will be profiled.
- */
-DART_EXPORT void Dart_ThreadEnableProfiling(void);
-
-/**
- * Register symbol information for the Dart VM's profiler and crash dumps.
- *
- * This consumes the output of //topaz/runtime/dart/profiler_symbols, which
- * should be treated as opaque.
- */
-DART_EXPORT void Dart_AddSymbols(const char* dso_name,
- void* buffer,
- intptr_t buffer_size);
-
-/**
- * Exits an isolate. After this call, Dart_CurrentIsolate will
- * return NULL.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_ExitIsolate(void);
-/* TODO(turnidge): We don't want users of the api to be able to exit a
- * "pure" dart isolate. Implement and document. */
-
-/**
- * Creates a full snapshot of the current isolate heap.
- *
- * A full snapshot is a compact representation of the dart vm isolate heap
- * and dart isolate heap states. These snapshots are used to initialize
- * the vm isolate on startup and fast initialization of an isolate.
- * A Snapshot of the heap is created before any dart code has executed.
- *
- * Requires there to be a current isolate. Not available in the precompiled
- * runtime (check Dart_IsPrecompiledRuntime).
- *
- * \param vm_snapshot_data_buffer Returns a pointer to a buffer containing the
- * vm snapshot. This buffer is scope allocated and is only valid
- * until the next call to Dart_ExitScope.
- * \param vm_snapshot_data_size Returns the size of vm_snapshot_data_buffer.
- * \param isolate_snapshot_data_buffer Returns a pointer to a buffer containing
- * the isolate snapshot. This buffer is scope allocated and is only valid
- * until the next call to Dart_ExitScope.
- * \param isolate_snapshot_data_size Returns the size of
- * isolate_snapshot_data_buffer.
- * \param is_core Create a snapshot containing core libraries.
- * Such snapshot should be agnostic to null safety mode.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer,
- intptr_t* vm_snapshot_data_size,
- uint8_t** isolate_snapshot_data_buffer,
- intptr_t* isolate_snapshot_data_size,
- bool is_core);
-
-/**
- * Returns whether the buffer contains a kernel file.
- *
- * \param buffer Pointer to a buffer that might contain a kernel binary.
- * \param buffer_size Size of the buffer.
- *
- * \return Whether the buffer contains a kernel binary (full or partial).
- */
-DART_EXPORT bool Dart_IsKernel(const uint8_t* buffer, intptr_t buffer_size);
-
-/**
- * Make isolate runnable.
- *
- * When isolates are spawned, this function is used to indicate that
- * the creation and initialization (including script loading) of the
- * isolate is complete and the isolate can start.
- * This function expects there to be no current isolate.
- *
- * \param isolate The isolate to be made runnable.
- *
- * \return NULL if successful. Returns an error message otherwise. The caller
- * is responsible for freeing the error message.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_IsolateMakeRunnable(
- Dart_Isolate isolate);
-
-/*
- * ==================
- * Messages and Ports
- * ==================
- */
-
-/**
- * A port is used to send or receive inter-isolate messages
- */
-typedef int64_t Dart_Port;
-
-/**
- * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid
- * port.
- */
-#define ILLEGAL_PORT ((Dart_Port)0)
-
-/**
- * A message notification callback.
- *
- * This callback allows the embedder to provide a custom wakeup mechanism for
- * the delivery of inter-isolate messages. This function is called once per
- * message on an arbitrary thread. It is the responsibility of the embedder to
- * eventually call Dart_HandleMessage once per callback received with the
- * destination isolate set as the current isolate to process the message.
- */
-typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate destination_isolate);
-
-/**
- * Allows embedders to provide a custom wakeup mechanism for the delivery of
- * inter-isolate messages. This setting only applies to the current isolate.
- *
- * This mechanism is optional: if not provided, the isolate will be scheduled on
- * a VM-managed thread pool. An embedder should provide this callback if it
- * wants to run an isolate on a specific thread or to interleave handling of
- * inter-isolate messages with other event sources.
- *
- * Most embedders will only call this function once, before isolate
- * execution begins. If this function is called after isolate
- * execution begins, the embedder is responsible for threading issues.
- */
-DART_EXPORT void Dart_SetMessageNotifyCallback(
- Dart_MessageNotifyCallback message_notify_callback);
-/* TODO(turnidge): Consider moving this to isolate creation so that it
- * is impossible to mess up. */
-
-/**
- * Query the current message notify callback for the isolate.
- *
- * \return The current message notify callback for the isolate.
- */
-DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback(void);
-
-/**
- * The VM's default message handler supports pausing an isolate before it
- * processes the first message and right after the it processes the isolate's
- * final message. This can be controlled for all isolates by two VM flags:
- *
- * `--pause-isolates-on-start`
- * `--pause-isolates-on-exit`
- *
- * Additionally, Dart_SetShouldPauseOnStart and Dart_SetShouldPauseOnExit can be
- * used to control this behaviour on a per-isolate basis.
- *
- * When an embedder is using a Dart_MessageNotifyCallback the embedder
- * needs to cooperate with the VM so that the service protocol can report
- * accurate information about isolates and so that tools such as debuggers
- * work reliably.
- *
- * The following functions can be used to implement pausing on start and exit.
- */
-
-/**
- * If the VM flag `--pause-isolates-on-start` was passed this will be true.
- *
- * \return A boolean value indicating if pause on start was requested.
- */
-DART_EXPORT bool Dart_ShouldPauseOnStart(void);
-
-/**
- * Override the VM flag `--pause-isolates-on-start` for the current isolate.
- *
- * \param should_pause Should the isolate be paused on start?
- *
- * NOTE: This must be called before Dart_IsolateMakeRunnable.
- */
-DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause);
-
-/**
- * Is the current isolate paused on start?
- *
- * \return A boolean value indicating if the isolate is paused on start.
- */
-DART_EXPORT bool Dart_IsPausedOnStart(void);
-
-/**
- * Called when the embedder has paused the current isolate on start and when
- * the embedder has resumed the isolate.
- *
- * \param paused Is the isolate paused on start?
- */
-DART_EXPORT void Dart_SetPausedOnStart(bool paused);
-
-/**
- * If the VM flag `--pause-isolates-on-exit` was passed this will be true.
- *
- * \return A boolean value indicating if pause on exit was requested.
- */
-DART_EXPORT bool Dart_ShouldPauseOnExit(void);
-
-/**
- * Override the VM flag `--pause-isolates-on-exit` for the current isolate.
- *
- * \param should_pause Should the isolate be paused on exit?
- *
- */
-DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause);
-
-/**
- * Is the current isolate paused on exit?
- *
- * \return A boolean value indicating if the isolate is paused on exit.
- */
-DART_EXPORT bool Dart_IsPausedOnExit(void);
-
-/**
- * Called when the embedder has paused the current isolate on exit and when
- * the embedder has resumed the isolate.
- *
- * \param paused Is the isolate paused on exit?
- */
-DART_EXPORT void Dart_SetPausedOnExit(bool paused);
-
-/**
- * Called when the embedder has caught a top level unhandled exception error
- * in the current isolate.
- *
- * NOTE: It is illegal to call this twice on the same isolate without first
- * clearing the sticky error to null.
- *
- * \param error The unhandled exception error.
- */
-DART_EXPORT void Dart_SetStickyError(Dart_Handle error);
-
-/**
- * Does the current isolate have a sticky error?
- */
-DART_EXPORT bool Dart_HasStickyError(void);
-
-/**
- * Gets the sticky error for the current isolate.
- *
- * \return A handle to the sticky error object or null.
- */
-DART_EXPORT Dart_Handle Dart_GetStickyError(void);
-
-/**
- * Handles the next pending message for the current isolate.
- *
- * May generate an unhandled exception error.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_HandleMessage(void);
-
-/**
- * Drains the microtask queue, then blocks the calling thread until the current
- * isolate receives a message, then handles all messages.
- *
- * \param timeout_millis When non-zero, the call returns after the indicated
- number of milliseconds even if no message was received.
- * \return A valid handle if no error occurs, otherwise an error handle.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_WaitForEvent(int64_t timeout_millis);
-
-/**
- * Handles any pending messages for the vm service for the current
- * isolate.
- *
- * This function may be used by an embedder at a breakpoint to avoid
- * pausing the vm service.
- *
- * This function can indirectly cause the message notify callback to
- * be called.
- *
- * \return true if the vm service requests the program resume
- * execution, false otherwise
- */
-DART_EXPORT bool Dart_HandleServiceMessages(void);
-
-/**
- * Does the current isolate have pending service messages?
- *
- * \return true if the isolate has pending service messages, false otherwise.
- */
-DART_EXPORT bool Dart_HasServiceMessages(void);
-
-/**
- * Processes any incoming messages for the current isolate.
- *
- * This function may only be used when the embedder has not provided
- * an alternate message delivery mechanism with
- * Dart_SetMessageCallbacks. It is provided for convenience.
- *
- * This function waits for incoming messages for the current
- * isolate. As new messages arrive, they are handled using
- * Dart_HandleMessage. The routine exits when all ports to the
- * current isolate are closed.
- *
- * \return A valid handle if the run loop exited successfully. If an
- * exception or other error occurs while processing messages, an
- * error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_RunLoop(void);
-
-/**
- * Lets the VM run message processing for the isolate.
- *
- * This function expects there to a current isolate and the current isolate
- * must not have an active api scope. The VM will take care of making the
- * isolate runnable (if not already), handles its message loop and will take
- * care of shutting the isolate down once it's done.
- *
- * \param errors_are_fatal Whether uncaught errors should be fatal.
- * \param on_error_port A port to notify on uncaught errors (or ILLEGAL_PORT).
- * \param on_exit_port A port to notify on exit (or ILLEGAL_PORT).
- * \param error A non-NULL pointer which will hold an error message if the call
- * fails. The error has to be free()ed by the caller.
- *
- * \return If successful the VM takes ownership of the isolate and takes care
- * of its message loop. If not successful the caller retains ownership of the
- * isolate.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT bool Dart_RunLoopAsync(
- bool errors_are_fatal,
- Dart_Port on_error_port,
- Dart_Port on_exit_port,
- char** error);
-
-/* TODO(turnidge): Should this be removed from the public api? */
-
-/**
- * Gets the main port id for the current isolate.
- */
-DART_EXPORT Dart_Port Dart_GetMainPortId(void);
-
-/**
- * Does the current isolate have live ReceivePorts?
- *
- * A ReceivePort is live when it has not been closed.
- */
-DART_EXPORT bool Dart_HasLivePorts(void);
-
-/**
- * Posts a message for some isolate. The message is a serialized
- * object.
- *
- * Requires there to be a current isolate.
- *
- * For posting messages outside of an isolate see \ref Dart_PostCObject.
- *
- * \param port_id The destination port.
- * \param object An object from the current isolate.
- *
- * \return True if the message was posted.
- */
-DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object);
-
-/**
- * Returns a new SendPort with the provided port id.
- *
- * \param port_id The destination port.
- *
- * \return A new SendPort if no errors occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id);
-
-/**
- * Gets the SendPort id for the provided SendPort.
- * \param port A SendPort object whose id is desired.
- * \param port_id Returns the id of the SendPort.
- * \return Success if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port,
- Dart_Port* port_id);
-
-/*
- * ======
- * Scopes
- * ======
- */
-
-/**
- * Enters a new scope.
- *
- * All new local handles will be created in this scope. Additionally,
- * some functions may return "scope allocated" memory which is only
- * valid within this scope.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_EnterScope(void);
-
-/**
- * Exits a scope.
- *
- * The previous scope (if any) becomes the current scope.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT void Dart_ExitScope(void);
-
-/**
- * The Dart VM uses "zone allocation" for temporary structures. Zones
- * support very fast allocation of small chunks of memory. The chunks
- * cannot be deallocated individually, but instead zones support
- * deallocating all chunks in one fast operation.
- *
- * This function makes it possible for the embedder to allocate
- * temporary data in the VMs zone allocator.
- *
- * Zone allocation is possible:
- * 1. when inside a scope where local handles can be allocated
- * 2. when processing a message from a native port in a native port
- * handler
- *
- * All the memory allocated this way will be reclaimed either on the
- * next call to Dart_ExitScope or when the native port handler exits.
- *
- * \param size Size of the memory to allocate.
- *
- * \return A pointer to the allocated memory. NULL if allocation
- * failed. Failure might due to is no current VM zone.
- */
-DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size);
-
-/*
- * =======
- * Objects
- * =======
- */
-
-/**
- * Returns the null object.
- *
- * \return A handle to the null object.
- */
-DART_EXPORT Dart_Handle Dart_Null(void);
-
-/**
- * Is this object null?
- */
-DART_EXPORT bool Dart_IsNull(Dart_Handle object);
-
-/**
- * Returns the empty string object.
- *
- * \return A handle to the empty string object.
- */
-DART_EXPORT Dart_Handle Dart_EmptyString(void);
-
-/**
- * Returns types that are not classes, and which therefore cannot be looked up
- * as library members by Dart_GetType.
- *
- * \return A handle to the dynamic, void or Never type.
- */
-DART_EXPORT Dart_Handle Dart_TypeDynamic(void);
-DART_EXPORT Dart_Handle Dart_TypeVoid(void);
-DART_EXPORT Dart_Handle Dart_TypeNever(void);
-
-/**
- * Checks if the two objects are equal.
- *
- * The result of the comparison is returned through the 'equal'
- * parameter. The return value itself is used to indicate success or
- * failure, not equality.
- *
- * May generate an unhandled exception error.
- *
- * \param obj1 An object to be compared.
- * \param obj2 An object to be compared.
- * \param equal Returns the result of the equality comparison.
- *
- * \return A valid handle if no error occurs during the comparison.
- */
-DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1,
- Dart_Handle obj2,
- bool* equal);
-
-/**
- * Is this object an instance of some type?
- *
- * The result of the test is returned through the 'instanceof' parameter.
- * The return value itself is used to indicate success or failure.
- *
- * \param object An object.
- * \param type A type.
- * \param instanceof Return true if 'object' is an instance of type 'type'.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object,
- Dart_Handle type,
- bool* instanceof);
-
-/**
- * Query object type.
- *
- * \param object Some Object.
- *
- * \return true if Object is of the specified type.
- */
-DART_EXPORT bool Dart_IsInstance(Dart_Handle object);
-DART_EXPORT bool Dart_IsNumber(Dart_Handle object);
-DART_EXPORT bool Dart_IsInteger(Dart_Handle object);
-DART_EXPORT bool Dart_IsDouble(Dart_Handle object);
-DART_EXPORT bool Dart_IsBoolean(Dart_Handle object);
-DART_EXPORT bool Dart_IsString(Dart_Handle object);
-DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */
-DART_EXPORT bool Dart_IsExternalString(Dart_Handle object);
-DART_EXPORT bool Dart_IsList(Dart_Handle object);
-DART_EXPORT bool Dart_IsMap(Dart_Handle object);
-DART_EXPORT bool Dart_IsLibrary(Dart_Handle object);
-DART_EXPORT bool Dart_IsType(Dart_Handle handle);
-DART_EXPORT bool Dart_IsFunction(Dart_Handle handle);
-DART_EXPORT bool Dart_IsVariable(Dart_Handle handle);
-DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle);
-DART_EXPORT bool Dart_IsClosure(Dart_Handle object);
-DART_EXPORT bool Dart_IsTypedData(Dart_Handle object);
-DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle object);
-DART_EXPORT bool Dart_IsFuture(Dart_Handle object);
-
-/*
- * =========
- * Instances
- * =========
- */
-
-/*
- * For the purposes of the embedding api, not all objects returned are
- * Dart language objects. Within the api, we use the term 'Instance'
- * to indicate handles which refer to true Dart language objects.
- *
- * TODO(turnidge): Reorganize the "Object" section above, pulling down
- * any functions that more properly belong here. */
-
-/**
- * Gets the type of a Dart language object.
- *
- * \param instance Some Dart object.
- *
- * \return If no error occurs, the type is returned. Otherwise an
- * error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance);
-
-/**
- * Returns the name for the provided class type.
- *
- * \return A valid string handle if no error occurs during the
- * operation.
- */
-DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle cls_type);
-
-/**
- * Returns the name for the provided function or method.
- *
- * \return A valid string handle if no error occurs during the
- * operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function);
-
-/**
- * Returns a handle to the owner of a function.
- *
- * The owner of an instance method or a static method is its defining
- * class. The owner of a top-level function is its defining
- * library. The owner of the function of a non-implicit closure is the
- * function of the method or closure that defines the non-implicit
- * closure.
- *
- * \return A valid handle to the owner of the function, or an error
- * handle if the argument is not a valid handle to a function.
- */
-DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function);
-
-/**
- * Determines whether a function handle refers to a static function
- * of method.
- *
- * For the purposes of the embedding API, a top-level function is
- * implicitly declared static.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the function or method is declared static.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
- bool* is_static);
-
-/**
- * Is this object a closure resulting from a tear-off (closurized method)?
- *
- * Returns true for closures produced when an ordinary method is accessed
- * through a getter call. Returns false otherwise, in particular for closures
- * produced from local function declarations.
- *
- * \param object Some Object.
- *
- * \return true if Object is a tear-off.
- */
-DART_EXPORT bool Dart_IsTearOff(Dart_Handle object);
-
-/**
- * Retrieves the function of a closure.
- *
- * \return A handle to the function of the closure, or an error handle if the
- * argument is not a closure.
- */
-DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure);
-
-/**
- * Returns a handle to the library which contains class.
- *
- * \return A valid handle to the library with owns class, null if the class
- * has no library or an error handle if the argument is not a valid handle
- * to a class type.
- */
-DART_EXPORT Dart_Handle Dart_ClassLibrary(Dart_Handle cls_type);
-
-/*
- * =============================
- * Numbers, Integers and Doubles
- * =============================
- */
-
-/**
- * Does this Integer fit into a 64-bit signed integer?
- *
- * \param integer An integer.
- * \param fits Returns true if the integer fits into a 64-bit signed integer.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer,
- bool* fits);
-
-/**
- * Does this Integer fit into a 64-bit unsigned integer?
- *
- * \param integer An integer.
- * \param fits Returns true if the integer fits into a 64-bit unsigned integer.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer,
- bool* fits);
-
-/**
- * Returns an Integer with the provided value.
- *
- * \param value The value of the integer.
- *
- * \return The Integer object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value);
-
-/**
- * Returns an Integer with the provided value.
- *
- * \param value The unsigned value of the integer.
- *
- * \return The Integer object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value);
-
-/**
- * Returns an Integer with the provided value.
- *
- * \param value The value of the integer represented as a C string
- * containing a hexadecimal number.
- *
- * \return The Integer object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* value);
-
-/**
- * Gets the value of an Integer.
- *
- * The integer must fit into a 64-bit signed integer, otherwise an error occurs.
- *
- * \param integer An Integer.
- * \param value Returns the value of the Integer.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer,
- int64_t* value);
-
-/**
- * Gets the value of an Integer.
- *
- * The integer must fit into a 64-bit unsigned integer, otherwise an
- * error occurs.
- *
- * \param integer An Integer.
- * \param value Returns the value of the Integer.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer,
- uint64_t* value);
-
-/**
- * Gets the value of an integer as a hexadecimal C string.
- *
- * \param integer An Integer.
- * \param value Returns the value of the Integer as a hexadecimal C
- * string. This C string is scope allocated and is only valid until
- * the next call to Dart_ExitScope.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer,
- const char** value);
-
-/**
- * Returns a Double with the provided value.
- *
- * \param value A double.
- *
- * \return The Double object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewDouble(double value);
-
-/**
- * Gets the value of a Double
- *
- * \param double_obj A Double
- * \param value Returns the value of the Double.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double* value);
-
-/**
- * Returns a closure of static function 'function_name' in the class 'class_name'
- * in the exported namespace of specified 'library'.
- *
- * \param library Library object
- * \param cls_type Type object representing a Class
- * \param function_name Name of the static function in the class
- *
- * \return A valid Dart instance if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure(Dart_Handle library,
- Dart_Handle cls_type,
- Dart_Handle function_name);
-
-/*
- * ========
- * Booleans
- * ========
- */
-
-/**
- * Returns the True object.
- *
- * Requires there to be a current isolate.
- *
- * \return A handle to the True object.
- */
-DART_EXPORT Dart_Handle Dart_True(void);
-
-/**
- * Returns the False object.
- *
- * Requires there to be a current isolate.
- *
- * \return A handle to the False object.
- */
-DART_EXPORT Dart_Handle Dart_False(void);
-
-/**
- * Returns a Boolean with the provided value.
- *
- * \param value true or false.
- *
- * \return The Boolean object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewBoolean(bool value);
-
-/**
- * Gets the value of a Boolean
- *
- * \param boolean_obj A Boolean
- * \param value Returns the value of the Boolean.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool* value);
-
-/*
- * =======
- * Strings
- * =======
- */
-
-/**
- * Gets the length of a String.
- *
- * \param str A String.
- * \param length Returns the length of the String.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t* length);
-
-/**
- * Returns a String built from the provided C string
- * (There is an implicit assumption that the C string passed in contains
- * UTF-8 encoded characters and '\0' is considered as a termination
- * character).
- *
- * \param str A C String
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str);
-/* TODO(turnidge): Document what happens when we run out of memory
- * during this call. */
-
-/**
- * Returns a String built from an array of UTF-8 encoded characters.
- *
- * \param utf8_array An array of UTF-8 encoded characters.
- * \param length The length of the codepoints array.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array,
- intptr_t length);
-
-/**
- * Returns a String built from an array of UTF-16 encoded characters.
- *
- * \param utf16_array An array of UTF-16 encoded characters.
- * \param length The length of the codepoints array.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array,
- intptr_t length);
-
-/**
- * Returns a String built from an array of UTF-32 encoded characters.
- *
- * \param utf32_array An array of UTF-32 encoded characters.
- * \param length The length of the codepoints array.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array,
- intptr_t length);
-
-/**
- * Returns a String which references an external array of
- * Latin-1 (ISO-8859-1) encoded characters.
- *
- * \param latin1_array Array of Latin-1 encoded characters. This must not move.
- * \param length The length of the characters array.
- * \param peer An external pointer to associate with this string.
- * \param external_allocation_size The number of externally allocated
- * bytes for peer. Used to inform the garbage collector.
- * \param callback A callback to be called when this string is finalized.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle
-Dart_NewExternalLatin1String(const uint8_t* latin1_array,
- intptr_t length,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-/**
- * Returns a String which references an external array of UTF-16 encoded
- * characters.
- *
- * \param utf16_array An array of UTF-16 encoded characters. This must not move.
- * \param length The length of the characters array.
- * \param peer An external pointer to associate with this string.
- * \param external_allocation_size The number of externally allocated
- * bytes for peer. Used to inform the garbage collector.
- * \param callback A callback to be called when this string is finalized.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle
-Dart_NewExternalUTF16String(const uint16_t* utf16_array,
- intptr_t length,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-/**
- * Gets the C string representation of a String.
- * (It is a sequence of UTF-8 encoded values with a '\0' termination.)
- *
- * \param str A string.
- * \param cstr Returns the String represented as a C string.
- * This C string is scope allocated and is only valid until
- * the next call to Dart_ExitScope.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str,
- const char** cstr);
-
-/**
- * Gets a UTF-8 encoded representation of a String.
- *
- * Any unpaired surrogate code points in the string will be converted as
- * replacement characters (U+FFFD, 0xEF 0xBF 0xBD in UTF-8). If you need
- * to preserve unpaired surrogates, use the Dart_StringToUTF16 function.
- *
- * \param str A string.
- * \param utf8_array Returns the String represented as UTF-8 code
- * units. This UTF-8 array is scope allocated and is only valid
- * until the next call to Dart_ExitScope.
- * \param length Used to return the length of the array which was
- * actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str,
- uint8_t** utf8_array,
- intptr_t* length);
-
-/**
- * Gets the data corresponding to the string object. This function returns
- * the data only for Latin-1 (ISO-8859-1) string objects. For all other
- * string objects it returns an error.
- *
- * \param str A string.
- * \param latin1_array An array allocated by the caller, used to return
- * the string data.
- * \param length Used to pass in the length of the provided array.
- * Used to return the length of the array which was actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str,
- uint8_t* latin1_array,
- intptr_t* length);
-
-/**
- * Gets the UTF-16 encoded representation of a string.
- *
- * \param str A string.
- * \param utf16_array An array allocated by the caller, used to return
- * the array of UTF-16 encoded characters.
- * \param length Used to pass in the length of the provided array.
- * Used to return the length of the array which was actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str,
- uint16_t* utf16_array,
- intptr_t* length);
-
-/**
- * Gets the storage size in bytes of a String.
- *
- * \param str A String.
- * \param size Returns the storage size in bytes of the String.
- * This is the size in bytes needed to store the String.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size);
-
-/**
- * Retrieves some properties associated with a String.
- * Properties retrieved are:
- * - character size of the string (one or two byte)
- * - length of the string
- * - peer pointer of string if it is an external string.
- * \param str A String.
- * \param char_size Returns the character size of the String.
- * \param str_len Returns the length of the String.
- * \param peer Returns the peer pointer associated with the String or 0 if
- * there is no peer pointer for it.
- * \return Success if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle str,
- intptr_t* char_size,
- intptr_t* str_len,
- void** peer);
-
-/*
- * =====
- * Lists
- * =====
- */
-
-/**
- * Returns a List of the desired length.
- *
- * \param length The length of the list.
- *
- * \return The List object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewList(intptr_t length);
-
-typedef enum {
- Dart_CoreType_Dynamic,
- Dart_CoreType_Int,
- Dart_CoreType_String,
-} Dart_CoreType_Id;
-
-// TODO(bkonyi): convert this to use nullable types once NNBD is enabled.
-/**
- * Returns a List of the desired length with the desired legacy element type.
- *
- * \param element_type_id The type of elements of the list.
- * \param length The length of the list.
- *
- * \return The List object if no error occurs. Otherwise returns an error
- * handle.
- */
-DART_EXPORT Dart_Handle Dart_NewListOf(Dart_CoreType_Id element_type_id,
- intptr_t length);
-
-/**
- * Returns a List of the desired length with the desired element type.
- *
- * \param element_type Handle to a nullable type object. E.g., from
- * Dart_GetType or Dart_GetNullableType.
- *
- * \param length The length of the list.
- *
- * \return The List object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewListOfType(Dart_Handle element_type,
- intptr_t length);
-
-/**
- * Returns a List of the desired length with the desired element type, filled
- * with the provided object.
- *
- * \param element_type Handle to a type object. E.g., from Dart_GetType.
- *
- * \param fill_object Handle to an object of type 'element_type' that will be
- * used to populate the list. This parameter can only be Dart_Null() if the
- * length of the list is 0 or 'element_type' is a nullable type.
- *
- * \param length The length of the list.
- *
- * \return The List object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type,
- Dart_Handle fill_object,
- intptr_t length);
-
-/**
- * Gets the length of a List.
- *
- * May generate an unhandled exception error.
- *
- * \param list A List.
- * \param length Returns the length of the List.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* length);
-
-/**
- * Gets the Object at some index of a List.
- *
- * If the index is out of bounds, an error occurs.
- *
- * May generate an unhandled exception error.
- *
- * \param list A List.
- * \param index A valid index into the List.
- *
- * \return The Object in the List at the specified index if no error
- * occurs. Otherwise returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index);
-
-/**
-* Gets a range of Objects from a List.
-*
-* If any of the requested index values are out of bounds, an error occurs.
-*
-* May generate an unhandled exception error.
-*
-* \param list A List.
-* \param offset The offset of the first item to get.
-* \param length The number of items to get.
-* \param result A pointer to fill with the objects.
-*
-* \return Success if no error occurs during the operation.
-*/
-DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list,
- intptr_t offset,
- intptr_t length,
- Dart_Handle* result);
-
-/**
- * Sets the Object at some index of a List.
- *
- * If the index is out of bounds, an error occurs.
- *
- * May generate an unhandled exception error.
- *
- * \param list A List.
- * \param index A valid index into the List.
- * \param value The Object to put in the List.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list,
- intptr_t index,
- Dart_Handle value);
-
-/**
- * May generate an unhandled exception error.
- */
-DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list,
- intptr_t offset,
- uint8_t* native_array,
- intptr_t length);
-
-/**
- * May generate an unhandled exception error.
- */
-DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list,
- intptr_t offset,
- const uint8_t* native_array,
- intptr_t length);
-
-/*
- * ====
- * Maps
- * ====
- */
-
-/**
- * Gets the Object at some key of a Map.
- *
- * May generate an unhandled exception error.
- *
- * \param map A Map.
- * \param key An Object.
- *
- * \return The value in the map at the specified key, null if the map does not
- * contain the key, or an error handle.
- */
-DART_EXPORT Dart_Handle Dart_MapGetAt(Dart_Handle map, Dart_Handle key);
-
-/**
- * Returns whether the Map contains a given key.
- *
- * May generate an unhandled exception error.
- *
- * \param map A Map.
- *
- * \return A handle on a boolean indicating whether map contains the key.
- * Otherwise returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key);
-
-/**
- * Gets the list of keys of a Map.
- *
- * May generate an unhandled exception error.
- *
- * \param map A Map.
- *
- * \return The list of key Objects if no error occurs. Otherwise returns an
- * error handle.
- */
-DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map);
-
-/*
- * ==========
- * Typed Data
- * ==========
- */
-
-typedef enum {
- Dart_TypedData_kByteData = 0,
- Dart_TypedData_kInt8,
- Dart_TypedData_kUint8,
- Dart_TypedData_kUint8Clamped,
- Dart_TypedData_kInt16,
- Dart_TypedData_kUint16,
- Dart_TypedData_kInt32,
- Dart_TypedData_kUint32,
- Dart_TypedData_kInt64,
- Dart_TypedData_kUint64,
- Dart_TypedData_kFloat32,
- Dart_TypedData_kFloat64,
- Dart_TypedData_kInt32x4,
- Dart_TypedData_kFloat32x4,
- Dart_TypedData_kFloat64x2,
- Dart_TypedData_kInvalid
-} Dart_TypedData_Type;
-
-/**
- * Return type if this object is a TypedData object.
- *
- * \return kInvalid if the object is not a TypedData object or the appropriate
- * Dart_TypedData_Type.
- */
-DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object);
-
-/**
- * Return type if this object is an external TypedData object.
- *
- * \return kInvalid if the object is not an external TypedData object or
- * the appropriate Dart_TypedData_Type.
- */
-DART_EXPORT Dart_TypedData_Type
-Dart_GetTypeOfExternalTypedData(Dart_Handle object);
-
-/**
- * Returns a TypedData object of the desired length and type.
- *
- * \param type The type of the TypedData object.
- * \param length The length of the TypedData object (length in type units).
- *
- * \return The TypedData object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type,
- intptr_t length);
-
-/**
- * Returns a TypedData object which references an external data array.
- *
- * \param type The type of the data array.
- * \param data A data array. This array must not move.
- * \param length The length of the data array (length in type units).
- *
- * \return The TypedData object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type,
- void* data,
- intptr_t length);
-
-/**
- * Returns a TypedData object which references an external data array.
- *
- * \param type The type of the data array.
- * \param data A data array. This array must not move.
- * \param length The length of the data array (length in type units).
- * \param peer A pointer to a native object or NULL. This value is
- * provided to callback when it is invoked.
- * \param external_allocation_size The number of externally allocated
- * bytes for peer. Used to inform the garbage collector.
- * \param callback A function pointer that will be invoked sometime
- * after the object is garbage collected, unless the handle has been deleted.
- * A valid callback needs to be specified it cannot be NULL.
- *
- * \return The TypedData object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle
-Dart_NewExternalTypedDataWithFinalizer(Dart_TypedData_Type type,
- void* data,
- intptr_t length,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer(
- Dart_TypedData_Type type,
- const void* data,
- intptr_t length,
- void* peer,
- intptr_t external_allocation_size,
- Dart_HandleFinalizer callback);
-
-/**
- * Returns a ByteBuffer object for the typed data.
- *
- * \param typed_data The TypedData object.
- *
- * \return The ByteBuffer object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data);
-
-/**
- * Acquires access to the internal data address of a TypedData object.
- *
- * \param object The typed data object whose internal data address is to
- * be accessed.
- * \param type The type of the object is returned here.
- * \param data The internal data address is returned here.
- * \param len Size of the typed array is returned here.
- *
- * Notes:
- * When the internal address of the object is acquired any calls to a
- * Dart API function that could potentially allocate an object or run
- * any Dart code will return an error.
- *
- * Any Dart API functions for accessing the data should not be called
- * before the corresponding release. In particular, the object should
- * not be acquired again before its release. This leads to undefined
- * behavior.
- *
- * \return Success if the internal data address is acquired successfully.
- * Otherwise, returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object,
- Dart_TypedData_Type* type,
- void** data,
- intptr_t* len);
-
-/**
- * Releases access to the internal data address that was acquired earlier using
- * Dart_TypedDataAcquireData.
- *
- * \param object The typed data object whose internal data address is to be
- * released.
- *
- * \return Success if the internal data address is released successfully.
- * Otherwise, returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object);
-
-/**
- * Returns the TypedData object associated with the ByteBuffer object.
- *
- * \param byte_buffer The ByteBuffer object.
- *
- * \return The TypedData object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle byte_buffer);
-
-/*
- * ============================================================
- * Invoking Constructors, Methods, Closures and Field accessors
- * ============================================================
- */
-
-/**
- * Invokes a constructor, creating a new object.
- *
- * This function allows hidden constructors (constructors with leading
- * underscores) to be called.
- *
- * \param type Type of object to be constructed.
- * \param constructor_name The name of the constructor to invoke. Use
- * Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor.
- * This name should not include the name of the class.
- * \param number_of_arguments Size of the arguments array.
- * \param arguments An array of arguments to the constructor.
- *
- * \return If the constructor is called and completes successfully,
- * then the new object. If an error occurs during execution, then an
- * error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_New(Dart_Handle type,
- Dart_Handle constructor_name,
- int number_of_arguments,
- Dart_Handle* arguments);
-
-/**
- * Allocate a new object without invoking a constructor.
- *
- * \param type The type of an object to be allocated.
- *
- * \return The new object. If an error occurs during execution, then an
- * error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Allocate(Dart_Handle type);
-
-/**
- * Allocate a new object without invoking a constructor, and sets specified
- * native fields.
- *
- * \param type The type of an object to be allocated.
- * \param num_native_fields The number of native fields to set.
- * \param native_fields An array containing the value of native fields.
- *
- * \return The new object. If an error occurs during execution, then an
- * error handle is returned.
- */
-DART_EXPORT Dart_Handle
-Dart_AllocateWithNativeFields(Dart_Handle type,
- intptr_t num_native_fields,
- const intptr_t* native_fields);
-
-/**
- * Invokes a method or function.
- *
- * The 'target' parameter may be an object, type, or library. If
- * 'target' is an object, then this function will invoke an instance
- * method. If 'target' is a type, then this function will invoke a
- * static method. If 'target' is a library, then this function will
- * invoke a top-level function from that library.
- * NOTE: This API call cannot be used to invoke methods of a type object.
- *
- * This function ignores visibility (leading underscores in names).
- *
- * May generate an unhandled exception error.
- *
- * \param target An object, type, or library.
- * \param name The name of the function or method to invoke.
- * \param number_of_arguments Size of the arguments array.
- * \param arguments An array of arguments to the function.
- *
- * \return If the function or method is called and completes
- * successfully, then the return value is returned. If an error
- * occurs during execution, then an error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_Invoke(Dart_Handle target,
- Dart_Handle name,
- int number_of_arguments,
- Dart_Handle* arguments);
-/* TODO(turnidge): Document how to invoke operators. */
-
-/**
- * Invokes a Closure with the given arguments.
- *
- * May generate an unhandled exception error.
- *
- * \return If no error occurs during execution, then the result of
- * invoking the closure is returned. If an error occurs during
- * execution, then an error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_InvokeClosure(Dart_Handle closure,
- int number_of_arguments,
- Dart_Handle* arguments);
-
-/**
- * Invokes a Generative Constructor on an object that was previously
- * allocated using Dart_Allocate/Dart_AllocateWithNativeFields.
- *
- * The 'object' parameter must be an object.
- *
- * This function ignores visibility (leading underscores in names).
- *
- * May generate an unhandled exception error.
- *
- * \param object An object.
- * \param name The name of the constructor to invoke.
- * Use Dart_Null() or Dart_EmptyString() to invoke the unnamed constructor.
- * \param number_of_arguments Size of the arguments array.
- * \param arguments An array of arguments to the function.
- *
- * \return If the constructor is called and completes
- * successfully, then the object is returned. If an error
- * occurs during execution, then an error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_InvokeConstructor(Dart_Handle object,
- Dart_Handle name,
- int number_of_arguments,
- Dart_Handle* arguments);
-
-/**
- * Gets the value of a field.
- *
- * The 'container' parameter may be an object, type, or library. If
- * 'container' is an object, then this function will access an
- * instance field. If 'container' is a type, then this function will
- * access a static field. If 'container' is a library, then this
- * function will access a top-level variable.
- * NOTE: This API call cannot be used to access fields of a type object.
- *
- * This function ignores field visibility (leading underscores in names).
- *
- * May generate an unhandled exception error.
- *
- * \param container An object, type, or library.
- * \param name A field name.
- *
- * \return If no error occurs, then the value of the field is
- * returned. Otherwise an error handle is returned.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_GetField(Dart_Handle container, Dart_Handle name);
-
-/**
- * Sets the value of a field.
- *
- * The 'container' parameter may actually be an object, type, or
- * library. If 'container' is an object, then this function will
- * access an instance field. If 'container' is a type, then this
- * function will access a static field. If 'container' is a library,
- * then this function will access a top-level variable.
- * NOTE: This API call cannot be used to access fields of a type object.
- *
- * This function ignores field visibility (leading underscores in names).
- *
- * May generate an unhandled exception error.
- *
- * \param container An object, type, or library.
- * \param name A field name.
- * \param value The new field value.
- *
- * \return A valid handle if no error occurs.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value);
-
-/*
- * ==========
- * Exceptions
- * ==========
- */
-
-/*
- * TODO(turnidge): Remove these functions from the api and replace all
- * uses with Dart_NewUnhandledExceptionError. */
-
-/**
- * Throws an exception.
- *
- * This function causes a Dart language exception to be thrown. This
- * will proceed in the standard way, walking up Dart frames until an
- * appropriate 'catch' block is found, executing 'finally' blocks,
- * etc.
- *
- * If an error handle is passed into this function, the error is
- * propagated immediately. See Dart_PropagateError for a discussion
- * of error propagation.
- *
- * If successful, this function does not return. Note that this means
- * that the destructors of any stack-allocated C++ objects will not be
- * called. If there are no Dart frames on the stack, an error occurs.
- *
- * \return An error handle if the exception was not thrown.
- * Otherwise the function does not return.
- */
-DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception);
-
-/**
- * Rethrows an exception.
- *
- * Rethrows an exception, unwinding all dart frames on the stack. If
- * successful, this function does not return. Note that this means
- * that the destructors of any stack-allocated C++ objects will not be
- * called. If there are no Dart frames on the stack, an error occurs.
- *
- * \return An error handle if the exception was not thrown.
- * Otherwise the function does not return.
- */
-DART_EXPORT Dart_Handle Dart_ReThrowException(Dart_Handle exception,
- Dart_Handle stacktrace);
-
-/*
- * ===========================
- * Native fields and functions
- * ===========================
- */
-
-/**
- * Gets the number of native instance fields in an object.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj,
- int* count);
-
-/**
- * Gets the value of a native field.
- *
- * TODO(turnidge): Document.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj,
- int index,
- intptr_t* value);
-
-/**
- * Sets the value of a native field.
- *
- * TODO(turnidge): Document.
- */
-DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj,
- int index,
- intptr_t value);
-
-/**
- * The arguments to a native function.
- *
- * This object is passed to a native function to represent its
- * arguments and return value. It allows access to the arguments to a
- * native function by index. It also allows the return value of a
- * native function to be set.
- */
-typedef struct _Dart_NativeArguments* Dart_NativeArguments;
-
-/**
- * Extracts current isolate group data from the native arguments structure.
- */
-DART_EXPORT void* Dart_GetNativeIsolateGroupData(Dart_NativeArguments args);
-
-typedef enum {
- Dart_NativeArgument_kBool = 0,
- Dart_NativeArgument_kInt32,
- Dart_NativeArgument_kUint32,
- Dart_NativeArgument_kInt64,
- Dart_NativeArgument_kUint64,
- Dart_NativeArgument_kDouble,
- Dart_NativeArgument_kString,
- Dart_NativeArgument_kInstance,
- Dart_NativeArgument_kNativeFields,
-} Dart_NativeArgument_Type;
-
-typedef struct _Dart_NativeArgument_Descriptor {
- uint8_t type;
- uint8_t index;
-} Dart_NativeArgument_Descriptor;
-
-typedef union _Dart_NativeArgument_Value {
- bool as_bool;
- int32_t as_int32;
- uint32_t as_uint32;
- int64_t as_int64;
- uint64_t as_uint64;
- double as_double;
- struct {
- Dart_Handle dart_str;
- void* peer;
- } as_string;
- struct {
- intptr_t num_fields;
- intptr_t* values;
- } as_native_fields;
- Dart_Handle as_instance;
-} Dart_NativeArgument_Value;
-
-enum {
- kNativeArgNumberPos = 0,
- kNativeArgNumberSize = 8,
- kNativeArgTypePos = kNativeArgNumberPos + kNativeArgNumberSize,
- kNativeArgTypeSize = 8,
-};
-
-#define BITMASK(size) ((1 << size) - 1)
-#define DART_NATIVE_ARG_DESCRIPTOR(type, position) \
- (((type & BITMASK(kNativeArgTypeSize)) << kNativeArgTypePos) | \
- (position & BITMASK(kNativeArgNumberSize)))
-
-/**
- * Gets the native arguments based on the types passed in and populates
- * the passed arguments buffer with appropriate native values.
- *
- * \param args the Native arguments block passed into the native call.
- * \param num_arguments length of argument descriptor array and argument
- * values array passed in.
- * \param arg_descriptors an array that describes the arguments that
- * need to be retrieved. For each argument to be retrieved the descriptor
- * contains the argument number (0, 1 etc.) and the argument type
- * described using Dart_NativeArgument_Type, e.g:
- * DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kBool, 1) indicates
- * that the first argument is to be retrieved and it should be a boolean.
- * \param arg_values array into which the native arguments need to be
- * extracted into, the array is allocated by the caller (it could be
- * stack allocated to avoid the malloc/free performance overhead).
- *
- * \return Success if all the arguments could be extracted correctly,
- * returns an error handle if there were any errors while extracting the
- * arguments (mismatched number of arguments, incorrect types, etc.).
- */
-DART_EXPORT Dart_Handle
-Dart_GetNativeArguments(Dart_NativeArguments args,
- int num_arguments,
- const Dart_NativeArgument_Descriptor* arg_descriptors,
- Dart_NativeArgument_Value* arg_values);
-
-/**
- * Gets the native argument at some index.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args,
- int index);
-/* TODO(turnidge): Specify the behavior of an out-of-bounds access. */
-
-/**
- * Gets the number of native arguments.
- */
-DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args);
-
-/**
- * Gets all the native fields of the native argument at some index.
- * \param args Native arguments structure.
- * \param arg_index Index of the desired argument in the structure above.
- * \param num_fields size of the intptr_t array 'field_values' passed in.
- * \param field_values intptr_t array in which native field values are returned.
- * \return Success if the native fields where copied in successfully. Otherwise
- * returns an error handle. On success the native field values are copied
- * into the 'field_values' array, if the argument at 'arg_index' is a
- * null object then 0 is copied as the native field values into the
- * 'field_values' array.
- */
-DART_EXPORT Dart_Handle
-Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args,
- int arg_index,
- int num_fields,
- intptr_t* field_values);
-
-/**
- * Gets the native field of the receiver.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args,
- intptr_t* value);
-
-/**
- * Gets a string native argument at some index.
- * \param args Native arguments structure.
- * \param arg_index Index of the desired argument in the structure above.
- * \param peer Returns the peer pointer if the string argument has one.
- * \return Success if the string argument has a peer, if it does not
- * have a peer then the String object is returned. Otherwise returns
- * an error handle (argument is not a String object).
- */
-DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args,
- int arg_index,
- void** peer);
-
-/**
- * Gets an integer native argument at some index.
- * \param args Native arguments structure.
- * \param index Index of the desired argument in the structure above.
- * \param value Returns the integer value if the argument is an Integer.
- * \return Success if no error occurs. Otherwise returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args,
- int index,
- int64_t* value);
-
-/**
- * Gets a boolean native argument at some index.
- * \param args Native arguments structure.
- * \param index Index of the desired argument in the structure above.
- * \param value Returns the boolean value if the argument is a Boolean.
- * \return Success if no error occurs. Otherwise returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args,
- int index,
- bool* value);
-
-/**
- * Gets a double native argument at some index.
- * \param args Native arguments structure.
- * \param index Index of the desired argument in the structure above.
- * \param value Returns the double value if the argument is a double.
- * \return Success if no error occurs. Otherwise returns an error handle.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args,
- int index,
- double* value);
-
-/**
- * Sets the return value for a native function.
- *
- * If retval is an Error handle, then error will be propagated once
- * the native functions exits. See Dart_PropagateError for a
- * discussion of how different types of errors are propagated.
- */
-DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args,
- Dart_Handle retval);
-
-DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args,
- Dart_WeakPersistentHandle rval);
-
-DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args,
- bool retval);
-
-DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args,
- int64_t retval);
-
-DART_EXPORT void Dart_SetDoubleReturnValue(Dart_NativeArguments args,
- double retval);
-
-/**
- * A native function.
- */
-typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
-
-/**
- * Native entry resolution callback.
- *
- * For libraries and scripts which have native functions, the embedder
- * can provide a native entry resolver. This callback is used to map a
- * name/arity to a Dart_NativeFunction. If no function is found, the
- * callback should return NULL.
- *
- * The parameters to the native resolver function are:
- * \param name a Dart string which is the name of the native function.
- * \param num_of_arguments is the number of arguments expected by the
- * native function.
- * \param auto_setup_scope is a boolean flag that can be set by the resolver
- * to indicate if this function needs a Dart API scope (see Dart_EnterScope/
- * Dart_ExitScope) to be setup automatically by the VM before calling into
- * the native function. By default most native functions would require this
- * to be true but some light weight native functions which do not call back
- * into the VM through the Dart API may not require a Dart scope to be
- * setup automatically.
- *
- * \return A valid Dart_NativeFunction which resolves to a native entry point
- * for the native function.
- *
- * See Dart_SetNativeResolver.
- */
-typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
- int num_of_arguments,
- bool* auto_setup_scope);
-/* TODO(turnidge): Consider renaming to NativeFunctionResolver or
- * NativeResolver. */
-
-/**
- * Native entry symbol lookup callback.
- *
- * For libraries and scripts which have native functions, the embedder
- * can provide a callback for mapping a native entry to a symbol. This callback
- * maps a native function entry PC to the native function name. If no native
- * entry symbol can be found, the callback should return NULL.
- *
- * The parameters to the native reverse resolver function are:
- * \param nf A Dart_NativeFunction.
- *
- * \return A const UTF-8 string containing the symbol name or NULL.
- *
- * See Dart_SetNativeResolver.
- */
-typedef const uint8_t* (*Dart_NativeEntrySymbol)(Dart_NativeFunction nf);
-
-/**
- * FFI Native C function pointer resolver callback.
- *
- * See Dart_SetFfiNativeResolver.
- */
-typedef void* (*Dart_FfiNativeResolver)(const char* name, uintptr_t args_n);
-
-/*
- * ===========
- * Environment
- * ===========
- */
-
-/**
- * An environment lookup callback function.
- *
- * \param name The name of the value to lookup in the environment.
- *
- * \return A valid handle to a string if the name exists in the
- * current environment or Dart_Null() if not.
- */
-typedef Dart_Handle (*Dart_EnvironmentCallback)(Dart_Handle name);
-
-/**
- * Sets the environment callback for the current isolate. This
- * callback is used to lookup environment values by name in the
- * current environment. This enables the embedder to supply values for
- * the const constructors bool.fromEnvironment, int.fromEnvironment
- * and String.fromEnvironment.
- */
-DART_EXPORT Dart_Handle
-Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback);
-
-/**
- * Sets the callback used to resolve native functions for a library.
- *
- * \param library A library.
- * \param resolver A native entry resolver.
- *
- * \return A valid handle if the native resolver was set successfully.
- */
-DART_EXPORT Dart_Handle
-Dart_SetNativeResolver(Dart_Handle library,
- Dart_NativeEntryResolver resolver,
- Dart_NativeEntrySymbol symbol);
-/* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */
-
-/**
- * Returns the callback used to resolve native functions for a library.
- *
- * \param library A library.
- * \param resolver a pointer to a Dart_NativeEntryResolver
- *
- * \return A valid handle if the library was found.
- */
-DART_EXPORT Dart_Handle
-Dart_GetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver* resolver);
-
-/**
- * Returns the callback used to resolve native function symbols for a library.
- *
- * \param library A library.
- * \param resolver a pointer to a Dart_NativeEntrySymbol.
- *
- * \return A valid handle if the library was found.
- */
-DART_EXPORT Dart_Handle Dart_GetNativeSymbol(Dart_Handle library,
- Dart_NativeEntrySymbol* resolver);
-
-/**
- * Sets the callback used to resolve FFI native functions for a library.
- * The resolved functions are expected to be a C function pointer of the
- * correct signature (as specified in the `@FfiNative()` function
- * annotation in Dart code).
- *
- * NOTE: This is an experimental feature and might change in the future.
- *
- * \param library A library.
- * \param resolver A native function resolver.
- *
- * \return A valid handle if the native resolver was set successfully.
- */
-DART_EXPORT Dart_Handle
-Dart_SetFfiNativeResolver(Dart_Handle library, Dart_FfiNativeResolver resolver);
-
-/*
- * =====================
- * Scripts and Libraries
- * =====================
- */
-
-typedef enum {
- Dart_kCanonicalizeUrl = 0,
- Dart_kImportTag,
- Dart_kKernelTag,
-} Dart_LibraryTag;
-
-/**
- * The library tag handler is a multi-purpose callback provided by the
- * embedder to the Dart VM. The embedder implements the tag handler to
- * provide the ability to load Dart scripts and imports.
- *
- * -- TAGS --
- *
- * Dart_kCanonicalizeUrl
- *
- * This tag indicates that the embedder should canonicalize 'url' with
- * respect to 'library'. For most embedders, the
- * Dart_DefaultCanonicalizeUrl function is a sufficient implementation
- * of this tag. The return value should be a string holding the
- * canonicalized url.
- *
- * Dart_kImportTag
- *
- * This tag is used to load a library from IsolateMirror.loadUri. The embedder
- * should call Dart_LoadLibraryFromKernel to provide the library to the VM. The
- * return value should be an error or library (the result from
- * Dart_LoadLibraryFromKernel).
- *
- * Dart_kKernelTag
- *
- * This tag is used to load the intermediate file (kernel) generated by
- * the Dart front end. This tag is typically used when a 'hot-reload'
- * of an application is needed and the VM is 'use dart front end' mode.
- * The dart front end typically compiles all the scripts, imports and part
- * files into one intermediate file hence we don't use the source/import or
- * script tags. The return value should be an error or a TypedData containing
- * the kernel bytes.
- *
- */
-typedef Dart_Handle (*Dart_LibraryTagHandler)(
- Dart_LibraryTag tag,
- Dart_Handle library_or_package_map_url,
- Dart_Handle url);
-
-/**
- * Sets library tag handler for the current isolate. This handler is
- * used to handle the various tags encountered while loading libraries
- * or scripts in the isolate.
- *
- * \param handler Handler code to be used for handling the various tags
- * encountered while loading libraries or scripts in the isolate.
- *
- * \return If no error occurs, the handler is set for the isolate.
- * Otherwise an error handle is returned.
- *
- * TODO(turnidge): Document.
- */
-DART_EXPORT Dart_Handle
-Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler);
-
-/**
- * Handles deferred loading requests. When this handler is invoked, it should
- * eventually load the deferred loading unit with the given id and call
- * Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError. It is
- * recommended that the loading occur asynchronously, but it is permitted to
- * call Dart_DeferredLoadComplete or Dart_DeferredLoadCompleteError before the
- * handler returns.
- *
- * If an error is returned, it will be propagated through
- * `prefix.loadLibrary()`. This is useful for synchronous
- * implementations, which must propagate any unwind errors from
- * Dart_DeferredLoadComplete or Dart_DeferredLoadComplete. Otherwise the handler
- * should return a non-error such as `Dart_Null()`.
- */
-typedef Dart_Handle (*Dart_DeferredLoadHandler)(intptr_t loading_unit_id);
-
-/**
- * Sets the deferred load handler for the current isolate. This handler is
- * used to handle loading deferred imports in an AppJIT or AppAOT program.
- */
-DART_EXPORT Dart_Handle
-Dart_SetDeferredLoadHandler(Dart_DeferredLoadHandler handler);
-
-/**
- * Notifies the VM that a deferred load completed successfully. This function
- * will eventually cause the corresponding `prefix.loadLibrary()` futures to
- * complete.
- *
- * Requires the current isolate to be the same current isolate during the
- * invocation of the Dart_DeferredLoadHandler.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_DeferredLoadComplete(intptr_t loading_unit_id,
- const uint8_t* snapshot_data,
- const uint8_t* snapshot_instructions);
-
-/**
- * Notifies the VM that a deferred load failed. This function
- * will eventually cause the corresponding `prefix.loadLibrary()` futures to
- * complete with an error.
- *
- * If `transient` is true, future invocations of `prefix.loadLibrary()` will
- * trigger new load requests. If false, futures invocation will complete with
- * the same error.
- *
- * Requires the current isolate to be the same current isolate during the
- * invocation of the Dart_DeferredLoadHandler.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_DeferredLoadCompleteError(intptr_t loading_unit_id,
- const char* error_message,
- bool transient);
-
-/**
- * Canonicalizes a url with respect to some library.
- *
- * The url is resolved with respect to the library's url and some url
- * normalizations are performed.
- *
- * This canonicalization function should be sufficient for most
- * embedders to implement the Dart_kCanonicalizeUrl tag.
- *
- * \param base_url The base url relative to which the url is
- * being resolved.
- * \param url The url being resolved and canonicalized. This
- * parameter is a string handle.
- *
- * \return If no error occurs, a String object is returned. Otherwise
- * an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url,
- Dart_Handle url);
-
-/**
- * Loads the root library for the current isolate.
- *
- * Requires there to be no current root library.
- *
- * \param kernel_buffer A buffer which contains a kernel binary (see
- * pkg/kernel/binary.md). Must remain valid until isolate group shutdown.
- * \param kernel_size Length of the passed in buffer.
- *
- * \return A handle to the root library, or an error.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_LoadScriptFromKernel(const uint8_t* kernel_buffer, intptr_t kernel_size);
-
-/**
- * Gets the library for the root script for the current isolate.
- *
- * If the root script has not yet been set for the current isolate,
- * this function returns Dart_Null(). This function never returns an
- * error handle.
- *
- * \return Returns the root Library for the current isolate or Dart_Null().
- */
-DART_EXPORT Dart_Handle Dart_RootLibrary(void);
-
-/**
- * Sets the root library for the current isolate.
- *
- * \return Returns an error handle if `library` is not a library handle.
- */
-DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library);
-
-/**
- * Lookup or instantiate a legacy type by name and type arguments from a
- * Library.
- *
- * \param library The library containing the class or interface.
- * \param class_name The class name for the type.
- * \param number_of_type_arguments Number of type arguments.
- * For non parametric types the number of type arguments would be 0.
- * \param type_arguments Pointer to an array of type arguments.
- * For non parametric types a NULL would be passed in for this argument.
- *
- * \return If no error occurs, the type is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library,
- Dart_Handle class_name,
- intptr_t number_of_type_arguments,
- Dart_Handle* type_arguments);
-
-/**
- * Lookup or instantiate a nullable type by name and type arguments from
- * Library.
- *
- * \param library The library containing the class or interface.
- * \param class_name The class name for the type.
- * \param number_of_type_arguments Number of type arguments.
- * For non parametric types the number of type arguments would be 0.
- * \param type_arguments Pointer to an array of type arguments.
- * For non parametric types a NULL would be passed in for this argument.
- *
- * \return If no error occurs, the type is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetNullableType(Dart_Handle library,
- Dart_Handle class_name,
- intptr_t number_of_type_arguments,
- Dart_Handle* type_arguments);
-
-/**
- * Lookup or instantiate a non-nullable type by name and type arguments from
- * Library.
- *
- * \param library The library containing the class or interface.
- * \param class_name The class name for the type.
- * \param number_of_type_arguments Number of type arguments.
- * For non parametric types the number of type arguments would be 0.
- * \param type_arguments Pointer to an array of type arguments.
- * For non parametric types a NULL would be passed in for this argument.
- *
- * \return If no error occurs, the type is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle
-Dart_GetNonNullableType(Dart_Handle library,
- Dart_Handle class_name,
- intptr_t number_of_type_arguments,
- Dart_Handle* type_arguments);
-
-/**
- * Creates a nullable version of the provided type.
- *
- * \param type The type to be converted to a nullable type.
- *
- * \return If no error occurs, a nullable type is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_TypeToNullableType(Dart_Handle type);
-
-/**
- * Creates a non-nullable version of the provided type.
- *
- * \param type The type to be converted to a non-nullable type.
- *
- * \return If no error occurs, a non-nullable type is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_TypeToNonNullableType(Dart_Handle type);
-
-/**
- * A type's nullability.
- *
- * \param type A Dart type.
- * \param result An out parameter containing the result of the check. True if
- * the type is of the specified nullability, false otherwise.
- *
- * \return Returns an error handle if type is not of type Type.
- */
-DART_EXPORT Dart_Handle Dart_IsNullableType(Dart_Handle type, bool* result);
-DART_EXPORT Dart_Handle Dart_IsNonNullableType(Dart_Handle type, bool* result);
-DART_EXPORT Dart_Handle Dart_IsLegacyType(Dart_Handle type, bool* result);
-
-/**
- * Lookup a class or interface by name from a Library.
- *
- * \param library The library containing the class or interface.
- * \param class_name The name of the class or interface.
- *
- * \return If no error occurs, the class or interface is
- * returned. Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library,
- Dart_Handle class_name);
-/* TODO(asiva): The above method needs to be removed once all uses
- * of it are removed from the embedder code. */
-
-/**
- * Returns an import path to a Library, such as "file:///test.dart" or
- * "dart:core".
- */
-DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library);
-
-/**
- * Returns a URL from which a Library was loaded.
- */
-DART_EXPORT Dart_Handle Dart_LibraryResolvedUrl(Dart_Handle library);
-
-/**
- * \return An array of libraries.
- */
-DART_EXPORT Dart_Handle Dart_GetLoadedLibraries(void);
-
-DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url);
-/* TODO(turnidge): Consider returning Dart_Null() when the library is
- * not found to distinguish that from a true error case. */
-
-/**
- * Report an loading error for the library.
- *
- * \param library The library that failed to load.
- * \param error The Dart error instance containing the load error.
- *
- * \return If the VM handles the error, the return value is
- * a null handle. If it doesn't handle the error, the error
- * object is returned.
- */
-DART_EXPORT Dart_Handle Dart_LibraryHandleError(Dart_Handle library,
- Dart_Handle error);
-
-/**
- * Called by the embedder to load a partial program. Does not set the root
- * library.
- *
- * \param kernel_buffer A buffer which contains a kernel binary (see
- * pkg/kernel/binary.md). Must remain valid until isolate shutdown.
- * \param kernel_buffer_size Length of the passed in buffer.
- *
- * \return A handle to the main library of the compilation unit, or an error.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_LoadLibraryFromKernel(const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size);
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_LoadLibrary(Dart_Handle kernel_buffer);
-
-/**
- * Indicates that all outstanding load requests have been satisfied.
- * This finalizes all the new classes loaded and optionally completes
- * deferred library futures.
- *
- * Requires there to be a current isolate.
- *
- * \param complete_futures Specify true if all deferred library
- * futures should be completed, false otherwise.
- *
- * \return Success if all classes have been finalized and deferred library
- * futures are completed. Otherwise, returns an error.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_FinalizeLoading(bool complete_futures);
-
-/*
- * =====
- * Peers
- * =====
- */
-
-/**
- * The peer field is a lazily allocated field intended for storage of
- * an uncommonly used values. Most instances types can have a peer
- * field allocated. The exceptions are subtypes of Null, num, and
- * bool.
- */
-
-/**
- * Returns the value of peer field of 'object' in 'peer'.
- *
- * \param object An object.
- * \param peer An out parameter that returns the value of the peer
- * field.
- *
- * \return Returns an error if 'object' is a subtype of Null, num, or
- * bool.
- */
-DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void** peer);
-
-/**
- * Sets the value of the peer field of 'object' to the value of
- * 'peer'.
- *
- * \param object An object.
- * \param peer A value to store in the peer field.
- *
- * \return Returns an error if 'object' is a subtype of Null, num, or
- * bool.
- */
-DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
-
-/*
- * ======
- * Kernel
- * ======
- */
-
-/**
- * Experimental support for Dart to Kernel parser isolate.
- *
- * TODO(hausner): Document finalized interface.
- *
- */
-
-// TODO(33433): Remove kernel service from the embedding API.
-
-typedef enum {
- Dart_KernelCompilationStatus_Unknown = -1,
- Dart_KernelCompilationStatus_Ok = 0,
- Dart_KernelCompilationStatus_Error = 1,
- Dart_KernelCompilationStatus_Crash = 2,
- Dart_KernelCompilationStatus_MsgFailed = 3,
-} Dart_KernelCompilationStatus;
-
-typedef struct {
- Dart_KernelCompilationStatus status;
- bool null_safety;
- char* error;
- uint8_t* kernel;
- intptr_t kernel_size;
-} Dart_KernelCompilationResult;
-
-typedef enum {
- Dart_KernelCompilationVerbosityLevel_Error = 0,
- Dart_KernelCompilationVerbosityLevel_Warning,
- Dart_KernelCompilationVerbosityLevel_Info,
- Dart_KernelCompilationVerbosityLevel_All,
-} Dart_KernelCompilationVerbosityLevel;
-
-DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
-DART_EXPORT bool Dart_KernelIsolateIsRunning(void);
-DART_EXPORT Dart_Port Dart_KernelPort(void);
-
-/**
- * Compiles the given `script_uri` to a kernel file.
- *
- * \param platform_kernel A buffer containing the kernel of the platform (e.g.
- * `vm_platform_strong.dill`). The VM does not take ownership of this memory.
- *
- * \param platform_kernel_size The length of the platform_kernel buffer.
- *
- * \param snapshot_compile Set to `true` when the compilation is for a snapshot.
- * This is used by the frontend to determine if compilation related information
- * should be printed to console (e.g., null safety mode).
- *
- * \param embed_sources Set to `true` when sources should be embedded in the
- * kernel file.
- *
- * \param verbosity Specifies the logging behavior of the kernel compilation
- * service.
- *
- * \return Returns the result of the compilation.
- *
- * On a successful compilation the returned [Dart_KernelCompilationResult] has
- * a status of [Dart_KernelCompilationStatus_Ok] and the `kernel`/`kernel_size`
- * fields are set. The caller takes ownership of the malloc()ed buffer.
- *
- * On a failed compilation the `error` might be set describing the reason for
- * the failed compilation. The caller takes ownership of the malloc()ed
- * error.
- *
- * Requires there to be a current isolate.
- */
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileToKernel(const char* script_uri,
- const uint8_t* platform_kernel,
- const intptr_t platform_kernel_size,
- bool incremental_compile,
- bool snapshot_compile,
- bool embed_sources,
- const char* package_config,
- Dart_KernelCompilationVerbosityLevel verbosity);
-
-typedef struct {
- const char* uri;
- const char* source;
-} Dart_SourceFile;
-
-DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies(void);
-
-/**
- * Sets the kernel buffer which will be used to load Dart SDK sources
- * dynamically at runtime.
- *
- * \param platform_kernel A buffer containing kernel which has sources for the
- * Dart SDK populated. Note: The VM does not take ownership of this memory.
- *
- * \param platform_kernel_size The length of the platform_kernel buffer.
- */
-DART_EXPORT void Dart_SetDartLibrarySourcesKernel(
- const uint8_t* platform_kernel,
- const intptr_t platform_kernel_size);
-
-/**
- * Detect the null safety opt-in status.
- *
- * When running from source, it is based on the opt-in status of `script_uri`.
- * When running from a kernel buffer, it is based on the mode used when
- * generating `kernel_buffer`.
- * When running from an appJIT or AOT snapshot, it is based on the mode used
- * when generating `snapshot_data`.
- *
- * \param script_uri Uri of the script that contains the source code
- *
- * \param package_config Uri of the package configuration file (either in format
- * of .packages or .dart_tool/package_config.json) for the null safety
- * detection to resolve package imports against. If this parameter is not
- * passed the package resolution of the parent isolate should be used.
- *
- * \param original_working_directory current working directory when the VM
- * process was launched, this is used to correctly resolve the path specified
- * for package_config.
- *
- * \param snapshot_data Buffer containing the snapshot data of the
- * isolate or NULL if no snapshot is provided. If provided, the buffers must
- * remain valid until the isolate shuts down.
- *
- * \param snapshot_instructions Buffer containing the snapshot instructions of
- * the isolate or NULL if no snapshot is provided. If provided, the buffers
- * must remain valid until the isolate shuts down.
- *
- * \param kernel_buffer A buffer which contains a kernel/DIL program. Must
- * remain valid until isolate shutdown.
- *
- * \param kernel_buffer_size The size of `kernel_buffer`.
- *
- * \return Returns true if the null safety is opted in by the input being
- * run `script_uri`, `snapshot_data` or `kernel_buffer`.
- *
- */
-DART_EXPORT bool Dart_DetectNullSafety(const char* script_uri,
- const char* package_config,
- const char* original_working_directory,
- const uint8_t* snapshot_data,
- const uint8_t* snapshot_instructions,
- const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size);
-
-#define DART_KERNEL_ISOLATE_NAME "kernel-service"
-
-/*
- * =======
- * Service
- * =======
- */
-
-#define DART_VM_SERVICE_ISOLATE_NAME "vm-service"
-
-/**
- * Returns true if isolate is the service isolate.
- *
- * \param isolate An isolate
- *
- * \return Returns true if 'isolate' is the service isolate.
- */
-DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate);
-
-/**
- * Writes the CPU profile to the timeline as a series of 'instant' events.
- *
- * Note that this is an expensive operation.
- *
- * \param main_port The main port of the Isolate whose profile samples to write.
- * \param error An optional error, must be free()ed by caller.
- *
- * \return Returns true if the profile is successfully written and false
- * otherwise.
- */
-DART_EXPORT bool Dart_WriteProfileToTimeline(Dart_Port main_port, char** error);
-
-/*
- * ==============
- * Precompilation
- * ==============
- */
-
-/**
- * Compiles all functions reachable from entry points and marks
- * the isolate to disallow future compilation.
- *
- * Entry points should be specified using `@pragma("vm:entry-point")`
- * annotation.
- *
- * \return An error handle if a compilation error or runtime error running const
- * constructors was encountered.
- */
-DART_EXPORT Dart_Handle Dart_Precompile(void);
-
-typedef void (*Dart_CreateLoadingUnitCallback)(
- void* callback_data,
- intptr_t loading_unit_id,
- void** write_callback_data,
- void** write_debug_callback_data);
-typedef void (*Dart_StreamingWriteCallback)(void* callback_data,
- const uint8_t* buffer,
- intptr_t size);
-typedef void (*Dart_StreamingCloseCallback)(void* callback_data);
-
-DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris(intptr_t loading_unit_id);
-
-// On Darwin systems, 'dlsym' adds an '_' to the beginning of the symbol name.
-// Use the '...CSymbol' definitions for resolving through 'dlsym'. The actual
-// symbol names in the objects are given by the '...AsmSymbol' definitions.
-#if defined(__APPLE__)
-#define kSnapshotBuildIdCSymbol "kDartSnapshotBuildId"
-#define kVmSnapshotDataCSymbol "kDartVmSnapshotData"
-#define kVmSnapshotInstructionsCSymbol "kDartVmSnapshotInstructions"
-#define kVmSnapshotBssCSymbol "kDartVmSnapshotBss"
-#define kIsolateSnapshotDataCSymbol "kDartIsolateSnapshotData"
-#define kIsolateSnapshotInstructionsCSymbol "kDartIsolateSnapshotInstructions"
-#define kIsolateSnapshotBssCSymbol "kDartIsolateSnapshotBss"
-#else
-#define kSnapshotBuildIdCSymbol "_kDartSnapshotBuildId"
-#define kVmSnapshotDataCSymbol "_kDartVmSnapshotData"
-#define kVmSnapshotInstructionsCSymbol "_kDartVmSnapshotInstructions"
-#define kVmSnapshotBssCSymbol "_kDartVmSnapshotBss"
-#define kIsolateSnapshotDataCSymbol "_kDartIsolateSnapshotData"
-#define kIsolateSnapshotInstructionsCSymbol "_kDartIsolateSnapshotInstructions"
-#define kIsolateSnapshotBssCSymbol "_kDartIsolateSnapshotBss"
-#endif
-
-#define kSnapshotBuildIdAsmSymbol "_kDartSnapshotBuildId"
-#define kVmSnapshotDataAsmSymbol "_kDartVmSnapshotData"
-#define kVmSnapshotInstructionsAsmSymbol "_kDartVmSnapshotInstructions"
-#define kVmSnapshotBssAsmSymbol "_kDartVmSnapshotBss"
-#define kIsolateSnapshotDataAsmSymbol "_kDartIsolateSnapshotData"
-#define kIsolateSnapshotInstructionsAsmSymbol \
- "_kDartIsolateSnapshotInstructions"
-#define kIsolateSnapshotBssAsmSymbol "_kDartIsolateSnapshotBss"
-
-/**
- * Creates a precompiled snapshot.
- * - A root library must have been loaded.
- * - Dart_Precompile must have been called.
- *
- * Outputs an assembly file defining the symbols listed in the definitions
- * above.
- *
- * The assembly should be compiled as a static or shared library and linked or
- * loaded by the embedder. Running this snapshot requires a VM compiled with
- * DART_PRECOMPILED_SNAPSHOT. The kDartVmSnapshotData and
- * kDartVmSnapshotInstructions should be passed to Dart_Initialize. The
- * kDartIsolateSnapshotData and kDartIsolateSnapshotInstructions should be
- * passed to Dart_CreateIsolateGroup.
- *
- * The callback will be invoked one or more times to provide the assembly code.
- *
- * If stripped is true, then the assembly code will not include DWARF
- * debugging sections.
- *
- * If debug_callback_data is provided, debug_callback_data will be used with
- * the callback to provide separate debugging information.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateAppAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
- void* callback_data,
- bool stripped,
- void* debug_callback_data);
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateAppAOTSnapshotAsAssemblies(
- Dart_CreateLoadingUnitCallback next_callback,
- void* next_callback_data,
- bool stripped,
- Dart_StreamingWriteCallback write_callback,
- Dart_StreamingCloseCallback close_callback);
-
-/**
- * Creates a precompiled snapshot.
- * - A root library must have been loaded.
- * - Dart_Precompile must have been called.
- *
- * Outputs an ELF shared library defining the symbols
- * - _kDartVmSnapshotData
- * - _kDartVmSnapshotInstructions
- * - _kDartIsolateSnapshotData
- * - _kDartIsolateSnapshotInstructions
- *
- * The shared library should be dynamically loaded by the embedder.
- * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT.
- * The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to
- * Dart_Initialize. The kDartIsolateSnapshotData and
- * kDartIsolateSnapshotInstructions should be passed to Dart_CreateIsolate.
- *
- * The callback will be invoked one or more times to provide the binary output.
- *
- * If stripped is true, then the binary output will not include DWARF
- * debugging sections.
- *
- * If debug_callback_data is provided, debug_callback_data will be used with
- * the callback to provide separate debugging information.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateAppAOTSnapshotAsElf(Dart_StreamingWriteCallback callback,
- void* callback_data,
- bool stripped,
- void* debug_callback_data);
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateAppAOTSnapshotAsElfs(Dart_CreateLoadingUnitCallback next_callback,
- void* next_callback_data,
- bool stripped,
- Dart_StreamingWriteCallback write_callback,
- Dart_StreamingCloseCallback close_callback);
-
-/**
- * Like Dart_CreateAppAOTSnapshotAsAssembly, but only includes
- * kDartVmSnapshotData and kDartVmSnapshotInstructions. It also does
- * not strip DWARF information from the generated assembly or allow for
- * separate debug information.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
- void* callback_data);
-
-/**
- * Sorts the class-ids in depth first traversal order of the inheritance
- * tree. This is a costly operation, but it can make method dispatch
- * more efficient and is done before writing snapshots.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SortClasses(void);
-
-/**
- * Creates a snapshot that caches compiled code and type feedback for faster
- * startup and quicker warmup in a subsequent process.
- *
- * Outputs a snapshot in two pieces. The pieces should be passed to
- * Dart_CreateIsolateGroup in a VM using the same VM snapshot pieces used in the
- * current VM. The instructions piece must be loaded with read and execute
- * permissions; the data piece may be loaded as read-only.
- *
- * - Requires the VM to have not been started with --precompilation.
- * - Not supported when targeting IA32.
- * - The VM writing the snapshot and the VM reading the snapshot must be the
- * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must
- * be targeting the same architecture, and must both be in checked mode or
- * both in unchecked mode.
- *
- * The buffers are scope allocated and are only valid until the next call to
- * Dart_ExitScope.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
- intptr_t* isolate_snapshot_data_size,
- uint8_t** isolate_snapshot_instructions_buffer,
- intptr_t* isolate_snapshot_instructions_size);
-
-/**
- * Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_CreateCoreJITSnapshotAsBlobs(
- uint8_t** vm_snapshot_data_buffer,
- intptr_t* vm_snapshot_data_size,
- uint8_t** vm_snapshot_instructions_buffer,
- intptr_t* vm_snapshot_instructions_size,
- uint8_t** isolate_snapshot_data_buffer,
- intptr_t* isolate_snapshot_data_size,
- uint8_t** isolate_snapshot_instructions_buffer,
- intptr_t* isolate_snapshot_instructions_size);
-
-/**
- * Get obfuscation map for precompiled code.
- *
- * Obfuscation map is encoded as a JSON array of pairs (original name,
- * obfuscated name).
- *
- * \return Returns an error handler if the VM was built in a mode that does not
- * support obfuscation.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
-Dart_GetObfuscationMap(uint8_t** buffer, intptr_t* buffer_length);
-
-/**
- * Returns whether the VM only supports running from precompiled snapshots and
- * not from any other kind of snapshot or from source (that is, the VM was
- * compiled with DART_PRECOMPILED_RUNTIME).
- */
-DART_EXPORT bool Dart_IsPrecompiledRuntime(void);
-
-/**
- * Print a native stack trace. Used for crash handling.
- *
- * If context is NULL, prints the current stack trace. Otherwise, context
- * should be a CONTEXT* (Windows) or ucontext_t* (POSIX) from a signal handler
- * running on the current thread.
- */
-DART_EXPORT void Dart_DumpNativeStackTrace(void* context);
-
-/**
- * Indicate that the process is about to abort, and the Dart VM should not
- * attempt to cleanup resources.
- */
-DART_EXPORT void Dart_PrepareToAbort(void);
-
-/**
- * Callback provided by the embedder that is used by the VM to
- * produce footnotes appended to DWARF stack traces.
- *
- * Whenever VM formats a stack trace as a string it would call this callback
- * passing raw program counters for each frame in the stack trace.
- *
- * Embedder can then return a string which if not-null will be appended to the
- * formatted stack trace.
- *
- * Returned string is expected to be `malloc()` allocated. VM takes ownership
- * of the returned string and will `free()` it.
- *
- * \param addresses raw program counter addresses for each frame
- * \param count number of elements in the addresses array
- */
-typedef char* (*Dart_DwarfStackTraceFootnoteCallback)(void* addresses[],
- intptr_t count);
-
-/**
- * Configure DWARF stack trace footnote callback.
- */
-DART_EXPORT void Dart_SetDwarfStackTraceFootnoteCallback(
- Dart_DwarfStackTraceFootnoteCallback callback);
-
-#endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
diff --git a/libcore/bridge/include/dart_api_dl.c b/libcore/bridge/include/dart_api_dl.c
deleted file mode 100644
index 48fb54e..0000000
--- a/libcore/bridge/include/dart_api_dl.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#include "dart_api_dl.h" /* NOLINT */
-#include "dart_version.h" /* NOLINT */
-#include "internal/dart_api_dl_impl.h" /* NOLINT */
-
-#include
-#include
-
-#define DART_API_DL_DEFINITIONS(name, R, A) name##_Type name##_DL = NULL;
-
-DART_API_ALL_DL_SYMBOLS(DART_API_DL_DEFINITIONS)
-DART_API_DEPRECATED_DL_SYMBOLS(DART_API_DL_DEFINITIONS)
-
-#undef DART_API_DL_DEFINITIONS
-
-typedef void* DartApiEntry_function;
-
-DartApiEntry_function FindFunctionPointer(const DartApiEntry* entries,
- const char* name) {
- while (entries->name != NULL) {
- if (strcmp(entries->name, name) == 0) return entries->function;
- entries++;
- }
- return NULL;
-}
-
-DART_EXPORT void Dart_UpdateExternalSize_Deprecated(
- Dart_WeakPersistentHandle object, intptr_t external_size) {
- printf("Dart_UpdateExternalSize is a nop, it has been deprecated\n");
-}
-
-DART_EXPORT void Dart_UpdateFinalizableExternalSize_Deprecated(
- Dart_FinalizableHandle object,
- Dart_Handle strong_ref_to_object,
- intptr_t external_allocation_size) {
- printf("Dart_UpdateFinalizableExternalSize is a nop, "
- "it has been deprecated\n");
-}
-
-intptr_t Dart_InitializeApiDL(void* data) {
- DartApi* dart_api_data = (DartApi*)data;
-
- if (dart_api_data->major != DART_API_DL_MAJOR_VERSION) {
- // If the DartVM we're running on does not have the same version as this
- // file was compiled against, refuse to initialize. The symbols are not
- // compatible.
- return -1;
- }
- // Minor versions are allowed to be different.
- // If the DartVM has a higher minor version, it will provide more symbols
- // than we initialize here.
- // If the DartVM has a lower minor version, it will not provide all symbols.
- // In that case, we leave the missing symbols un-initialized. Those symbols
- // should not be used by the Dart and native code. The client is responsible
- // for checking the minor version number himself based on which symbols it
- // is using.
- // (If we would error out on this case, recompiling native code against a
- // newer SDK would break all uses on older SDKs, which is too strict.)
-
- const DartApiEntry* dart_api_function_pointers = dart_api_data->functions;
-
-#define DART_API_DL_INIT(name, R, A) \
- name##_DL = \
- (name##_Type)(FindFunctionPointer(dart_api_function_pointers, #name));
- DART_API_ALL_DL_SYMBOLS(DART_API_DL_INIT)
-#undef DART_API_DL_INIT
-
-#define DART_API_DEPRECATED_DL_INIT(name, R, A) \
- name##_DL = name##_Deprecated;
- DART_API_DEPRECATED_DL_SYMBOLS(DART_API_DEPRECATED_DL_INIT)
-#undef DART_API_DEPRECATED_DL_INIT
-
- return 0;
-}
diff --git a/libcore/bridge/include/dart_api_dl.h b/libcore/bridge/include/dart_api_dl.h
deleted file mode 100644
index 99aa269..0000000
--- a/libcore/bridge/include/dart_api_dl.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_DART_API_DL_H_
-#define RUNTIME_INCLUDE_DART_API_DL_H_
-
-#include "dart_api.h" /* NOLINT */
-#include "dart_native_api.h" /* NOLINT */
-
-/** \mainpage Dynamically Linked Dart API
- *
- * This exposes a subset of symbols from dart_api.h and dart_native_api.h
- * available in every Dart embedder through dynamic linking.
- *
- * All symbols are postfixed with _DL to indicate that they are dynamically
- * linked and to prevent conflicts with the original symbol.
- *
- * Link `dart_api_dl.c` file into your library and invoke
- * `Dart_InitializeApiDL` with `NativeApi.initializeApiDLData`.
- */
-
-DART_EXPORT intptr_t Dart_InitializeApiDL(void* data);
-
-// ============================================================================
-// IMPORTANT! Never update these signatures without properly updating
-// DART_API_DL_MAJOR_VERSION and DART_API_DL_MINOR_VERSION.
-//
-// Verbatim copy of `dart_native_api.h` and `dart_api.h` symbol names and types
-// to trigger compile-time errors if the symbols in those files are updated
-// without updating these.
-//
-// Function return and argument types, and typedefs are carbon copied. Structs
-// are typechecked nominally in C/C++, so they are not copied, instead a
-// comment is added to their definition.
-typedef int64_t Dart_Port_DL;
-
-typedef void (*Dart_NativeMessageHandler_DL)(Dart_Port_DL dest_port_id,
- Dart_CObject* message);
-
-// dart_native_api.h symbols can be called on any thread.
-#define DART_NATIVE_API_DL_SYMBOLS(F) \
- /***** dart_native_api.h *****/ \
- /* Dart_Port */ \
- F(Dart_PostCObject, bool, (Dart_Port_DL port_id, Dart_CObject * message)) \
- F(Dart_PostInteger, bool, (Dart_Port_DL port_id, int64_t message)) \
- F(Dart_NewNativePort, Dart_Port_DL, \
- (const char* name, Dart_NativeMessageHandler_DL handler, \
- bool handle_concurrently)) \
- F(Dart_CloseNativePort, bool, (Dart_Port_DL native_port_id))
-
-// dart_api.h symbols can only be called on Dart threads.
-#define DART_API_DL_SYMBOLS(F) \
- /***** dart_api.h *****/ \
- /* Errors */ \
- F(Dart_IsError, bool, (Dart_Handle handle)) \
- F(Dart_IsApiError, bool, (Dart_Handle handle)) \
- F(Dart_IsUnhandledExceptionError, bool, (Dart_Handle handle)) \
- F(Dart_IsCompilationError, bool, (Dart_Handle handle)) \
- F(Dart_IsFatalError, bool, (Dart_Handle handle)) \
- F(Dart_GetError, const char*, (Dart_Handle handle)) \
- F(Dart_ErrorHasException, bool, (Dart_Handle handle)) \
- F(Dart_ErrorGetException, Dart_Handle, (Dart_Handle handle)) \
- F(Dart_ErrorGetStackTrace, Dart_Handle, (Dart_Handle handle)) \
- F(Dart_NewApiError, Dart_Handle, (const char* error)) \
- F(Dart_NewCompilationError, Dart_Handle, (const char* error)) \
- F(Dart_NewUnhandledExceptionError, Dart_Handle, (Dart_Handle exception)) \
- F(Dart_PropagateError, void, (Dart_Handle handle)) \
- /* Dart_Handle, Dart_PersistentHandle, Dart_WeakPersistentHandle */ \
- F(Dart_HandleFromPersistent, Dart_Handle, (Dart_PersistentHandle object)) \
- F(Dart_HandleFromWeakPersistent, Dart_Handle, \
- (Dart_WeakPersistentHandle object)) \
- F(Dart_NewPersistentHandle, Dart_PersistentHandle, (Dart_Handle object)) \
- F(Dart_SetPersistentHandle, void, \
- (Dart_PersistentHandle obj1, Dart_Handle obj2)) \
- F(Dart_DeletePersistentHandle, void, (Dart_PersistentHandle object)) \
- F(Dart_NewWeakPersistentHandle, Dart_WeakPersistentHandle, \
- (Dart_Handle object, void* peer, intptr_t external_allocation_size, \
- Dart_HandleFinalizer callback)) \
- F(Dart_DeleteWeakPersistentHandle, void, (Dart_WeakPersistentHandle object)) \
- F(Dart_NewFinalizableHandle, Dart_FinalizableHandle, \
- (Dart_Handle object, void* peer, intptr_t external_allocation_size, \
- Dart_HandleFinalizer callback)) \
- F(Dart_DeleteFinalizableHandle, void, \
- (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)) \
- /* Isolates */ \
- F(Dart_CurrentIsolate, Dart_Isolate, (void)) \
- F(Dart_ExitIsolate, void, (void)) \
- F(Dart_EnterIsolate, void, (Dart_Isolate)) \
- /* Dart_Port */ \
- F(Dart_Post, bool, (Dart_Port_DL port_id, Dart_Handle object)) \
- F(Dart_NewSendPort, Dart_Handle, (Dart_Port_DL port_id)) \
- F(Dart_SendPortGetId, Dart_Handle, \
- (Dart_Handle port, Dart_Port_DL * port_id)) \
- /* Scopes */ \
- F(Dart_EnterScope, void, (void)) \
- F(Dart_ExitScope, void, (void)) \
- /* Objects */ \
- F(Dart_IsNull, bool, (Dart_Handle))
-
-// dart_api.h symbols that have been deprecated but are retained here
-// until we can make a breaking change bumping the major version number
-// (DART_API_DL_MAJOR_VERSION)
-#define DART_API_DEPRECATED_DL_SYMBOLS(F) \
- F(Dart_UpdateExternalSize, void, \
- (Dart_WeakPersistentHandle object, intptr_t external_allocation_size)) \
- F(Dart_UpdateFinalizableExternalSize, void, \
- (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object, \
- intptr_t external_allocation_size))
-
-#define DART_API_ALL_DL_SYMBOLS(F) \
- DART_NATIVE_API_DL_SYMBOLS(F) \
- DART_API_DL_SYMBOLS(F)
-// IMPORTANT! Never update these signatures without properly updating
-// DART_API_DL_MAJOR_VERSION and DART_API_DL_MINOR_VERSION.
-//
-// End of verbatim copy.
-// ============================================================================
-
-// Copy of definition of DART_EXPORT without 'used' attribute.
-//
-// The 'used' attribute cannot be used with DART_API_ALL_DL_SYMBOLS because
-// they are not function declarations, but variable declarations with a
-// function pointer type.
-//
-// The function pointer variables are initialized with the addresses of the
-// functions in the VM. If we were to use function declarations instead, we
-// would need to forward the call to the VM adding indirection.
-#if defined(__CYGWIN__)
-#error Tool chain and platform not supported.
-#elif defined(_WIN32)
-#if defined(DART_SHARED_LIB)
-#define DART_EXPORT_DL DART_EXTERN_C __declspec(dllexport)
-#else
-#define DART_EXPORT_DL DART_EXTERN_C
-#endif
-#else
-#if __GNUC__ >= 4
-#if defined(DART_SHARED_LIB)
-#define DART_EXPORT_DL DART_EXTERN_C __attribute__((visibility("default")))
-#else
-#define DART_EXPORT_DL DART_EXTERN_C
-#endif
-#else
-#error Tool chain not supported.
-#endif
-#endif
-
-#define DART_API_DL_DECLARATIONS(name, R, A) \
- typedef R(*name##_Type) A; \
- DART_EXPORT_DL name##_Type name##_DL;
-
-DART_API_ALL_DL_SYMBOLS(DART_API_DL_DECLARATIONS)
-DART_API_DEPRECATED_DL_SYMBOLS(DART_API_DL_DECLARATIONS)
-
-#undef DART_API_DL_DECLARATIONS
-
-#undef DART_EXPORT_DL
-
-#endif /* RUNTIME_INCLUDE_DART_API_DL_H_ */ /* NOLINT */
diff --git a/libcore/bridge/include/dart_embedder_api.h b/libcore/bridge/include/dart_embedder_api.h
deleted file mode 100644
index e565ebf..0000000
--- a/libcore/bridge/include/dart_embedder_api.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifndef RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
-#define RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
-
-#include "include/dart_api.h"
-#include "include/dart_tools_api.h"
-
-namespace dart {
-namespace embedder {
-
-// Initialize all subsystems of the embedder.
-//
-// Must be called before the `Dart_Initialize()` call to initialize the
-// Dart VM.
-//
-// Returns true on success and false otherwise, in which case error would
-// contain error message.
-DART_WARN_UNUSED_RESULT bool InitOnce(char** error);
-
-// Cleans up all subsystems of the embedder.
-//
-// Must be called after the `Dart_Cleanup()` call to initialize the
-// Dart VM.
-void Cleanup();
-
-// Common arguments that are passed to isolate creation callback and to
-// API methods that create isolates.
-struct IsolateCreationData {
- // URI for the main script that will be running in the isolate.
- const char* script_uri;
-
- // Advisory name of the main method that will be run by isolate.
- // Only used for error messages.
- const char* main;
-
- // Isolate creation flags. Might be absent.
- Dart_IsolateFlags* flags;
-
- // Isolate group callback data.
- void* isolate_group_data;
-
- // Isolate callback data.
- void* isolate_data;
-};
-
-// Create and initialize kernel-service isolate. This method should be used
-// when VM invokes isolate creation callback with DART_KERNEL_ISOLATE_NAME as
-// script_uri.
-// The isolate is created from the given snapshot (might be kernel data or
-// app-jit snapshot).
-DART_WARN_UNUSED_RESULT Dart_Isolate
-CreateKernelServiceIsolate(const IsolateCreationData& data,
- const uint8_t* buffer,
- intptr_t buffer_size,
- char** error);
-
-// Service isolate configuration.
-struct VmServiceConfiguration {
- enum {
- kBindHttpServerToAFreePort = 0,
- kDoNotAutoStartHttpServer = -1
- };
-
- // Address to which HTTP server will be bound.
- const char* ip;
-
- // Default port. See enum above for special values.
- int port;
-
- // If non-null, connection information for the VM service will be output to a
- // file in JSON format at the location specified.
- const char* write_service_info_filename;
-
- // TODO(vegorov) document these ones.
- bool dev_mode;
- bool deterministic;
- bool disable_auth_codes;
-};
-
-// Create and initialize vm-service isolate from the given AOT snapshot, which
-// is expected to contain all necessary 'vm-service' libraries.
-// This method should be used when VM invokes isolate creation callback with
-// DART_VM_SERVICE_ISOLATE_NAME as script_uri.
-DART_WARN_UNUSED_RESULT Dart_Isolate
-CreateVmServiceIsolate(const IsolateCreationData& data,
- const VmServiceConfiguration& config,
- const uint8_t* isolate_data,
- const uint8_t* isolate_instr,
- char** error);
-
-// Create and initialize vm-service isolate from the given kernel binary, which
-// is expected to contain all necessary 'vm-service' libraries.
-// This method should be used when VM invokes isolate creation callback with
-// DART_VM_SERVICE_ISOLATE_NAME as script_uri.
-DART_WARN_UNUSED_RESULT Dart_Isolate
-CreateVmServiceIsolateFromKernel(const IsolateCreationData& data,
- const VmServiceConfiguration& config,
- const uint8_t* kernel_buffer,
- intptr_t kernel_buffer_size,
- char** error);
-
-} // namespace embedder
-} // namespace dart
-
-#endif // RUNTIME_INCLUDE_DART_EMBEDDER_API_H_
diff --git a/libcore/bridge/include/dart_native_api.h b/libcore/bridge/include/dart_native_api.h
deleted file mode 100644
index 79194e0..0000000
--- a/libcore/bridge/include/dart_native_api.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_DART_NATIVE_API_H_
-#define RUNTIME_INCLUDE_DART_NATIVE_API_H_
-
-#include "dart_api.h" /* NOLINT */
-
-/*
- * ==========================================
- * Message sending/receiving from native code
- * ==========================================
- */
-
-/**
- * A Dart_CObject is used for representing Dart objects as native C
- * data outside the Dart heap. These objects are totally detached from
- * the Dart heap. Only a subset of the Dart objects have a
- * representation as a Dart_CObject.
- *
- * The string encoding in the 'value.as_string' is UTF-8.
- *
- * All the different types from dart:typed_data are exposed as type
- * kTypedData. The specific type from dart:typed_data is in the type
- * field of the as_typed_data structure. The length in the
- * as_typed_data structure is always in bytes.
- *
- * The data for kTypedData is copied on message send and ownership remains with
- * the caller. The ownership of data for kExternalTyped is passed to the VM on
- * message send and returned when the VM invokes the
- * Dart_HandleFinalizer callback; a non-NULL callback must be provided.
- *
- * Note that Dart_CObject_kNativePointer is intended for internal use by
- * dart:io implementation and has no connection to dart:ffi Pointer class.
- * It represents a pointer to a native resource of a known type.
- * The receiving side will only see this pointer as an integer and will not
- * see the specified finalizer.
- * The specified finalizer will only be invoked if the message is not delivered.
- */
-typedef enum {
- Dart_CObject_kNull = 0,
- Dart_CObject_kBool,
- Dart_CObject_kInt32,
- Dart_CObject_kInt64,
- Dart_CObject_kDouble,
- Dart_CObject_kString,
- Dart_CObject_kArray,
- Dart_CObject_kTypedData,
- Dart_CObject_kExternalTypedData,
- Dart_CObject_kSendPort,
- Dart_CObject_kCapability,
- Dart_CObject_kNativePointer,
- Dart_CObject_kUnsupported,
- Dart_CObject_kUnmodifiableExternalTypedData,
- Dart_CObject_kNumberOfTypes
-} Dart_CObject_Type;
-// This enum is versioned by DART_API_DL_MAJOR_VERSION, only add at the end
-// and bump the DART_API_DL_MINOR_VERSION.
-
-typedef struct _Dart_CObject {
- Dart_CObject_Type type;
- union {
- bool as_bool;
- int32_t as_int32;
- int64_t as_int64;
- double as_double;
- const char* as_string;
- struct {
- Dart_Port id;
- Dart_Port origin_id;
- } as_send_port;
- struct {
- int64_t id;
- } as_capability;
- struct {
- intptr_t length;
- struct _Dart_CObject** values;
- } as_array;
- struct {
- Dart_TypedData_Type type;
- intptr_t length; /* in elements, not bytes */
- const uint8_t* values;
- } as_typed_data;
- struct {
- Dart_TypedData_Type type;
- intptr_t length; /* in elements, not bytes */
- uint8_t* data;
- void* peer;
- Dart_HandleFinalizer callback;
- } as_external_typed_data;
- struct {
- intptr_t ptr;
- intptr_t size;
- Dart_HandleFinalizer callback;
- } as_native_pointer;
- } value;
-} Dart_CObject;
-// This struct is versioned by DART_API_DL_MAJOR_VERSION, bump the version when
-// changing this struct.
-
-/**
- * Posts a message on some port. The message will contain the Dart_CObject
- * object graph rooted in 'message'.
- *
- * While the message is being sent the state of the graph of Dart_CObject
- * structures rooted in 'message' should not be accessed, as the message
- * generation will make temporary modifications to the data. When the message
- * has been sent the graph will be fully restored.
- *
- * If true is returned, the message was enqueued, and finalizers for external
- * typed data will eventually run, even if the receiving isolate shuts down
- * before processing the message. If false is returned, the message was not
- * enqueued and ownership of external typed data in the message remains with the
- * caller.
- *
- * This function may be called on any thread when the VM is running (that is,
- * after Dart_Initialize has returned and before Dart_Cleanup has been called).
- *
- * \param port_id The destination port.
- * \param message The message to send.
- *
- * \return True if the message was posted.
- */
-DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message);
-
-/**
- * Posts a message on some port. The message will contain the integer 'message'.
- *
- * \param port_id The destination port.
- * \param message The message to send.
- *
- * \return True if the message was posted.
- */
-DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message);
-
-/**
- * A native message handler.
- *
- * This handler is associated with a native port by calling
- * Dart_NewNativePort.
- *
- * The message received is decoded into the message structure. The
- * lifetime of the message data is controlled by the caller. All the
- * data references from the message are allocated by the caller and
- * will be reclaimed when returning to it.
- */
-typedef void (*Dart_NativeMessageHandler)(Dart_Port dest_port_id,
- Dart_CObject* message);
-
-/**
- * Creates a new native port. When messages are received on this
- * native port, then they will be dispatched to the provided native
- * message handler.
- *
- * \param name The name of this port in debugging messages.
- * \param handler The C handler to run when messages arrive on the port.
- * \param handle_concurrently Is it okay to process requests on this
- * native port concurrently?
- *
- * \return If successful, returns the port id for the native port. In
- * case of error, returns ILLEGAL_PORT.
- */
-DART_EXPORT Dart_Port Dart_NewNativePort(const char* name,
- Dart_NativeMessageHandler handler,
- bool handle_concurrently);
-/* TODO(turnidge): Currently handle_concurrently is ignored. */
-
-/**
- * Closes the native port with the given id.
- *
- * The port must have been allocated by a call to Dart_NewNativePort.
- *
- * \param native_port_id The id of the native port to close.
- *
- * \return Returns true if the port was closed successfully.
- */
-DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id);
-
-/*
- * ==================
- * Verification Tools
- * ==================
- */
-
-/**
- * Forces all loaded classes and functions to be compiled eagerly in
- * the current isolate..
- *
- * TODO(turnidge): Document.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CompileAll(void);
-
-/**
- * Finalizes all classes.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_FinalizeAllClasses(void);
-
-/* This function is intentionally undocumented.
- *
- * It should not be used outside internal tests.
- */
-DART_EXPORT void* Dart_ExecuteInternalCommand(const char* command, void* arg);
-
-#endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */
diff --git a/libcore/bridge/include/dart_tools_api.h b/libcore/bridge/include/dart_tools_api.h
deleted file mode 100644
index 7b706bc..0000000
--- a/libcore/bridge/include/dart_tools_api.h
+++ /dev/null
@@ -1,658 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifndef RUNTIME_INCLUDE_DART_TOOLS_API_H_
-#define RUNTIME_INCLUDE_DART_TOOLS_API_H_
-
-#include "dart_api.h" /* NOLINT */
-
-/** \mainpage Dart Tools Embedding API Reference
- *
- * This reference describes the Dart embedding API for tools. Tools include
- * a debugger, service protocol, and timeline.
- *
- * NOTE: The APIs described in this file are unstable and subject to change.
- *
- * This reference is generated from the header include/dart_tools_api.h.
- */
-
-/*
- * ========
- * Debugger
- * ========
- */
-
-/**
- * ILLEGAL_ISOLATE_ID is a number guaranteed never to be associated with a
- * valid isolate.
- */
-#define ILLEGAL_ISOLATE_ID ILLEGAL_PORT
-
-/**
- * ILLEGAL_ISOLATE_GROUP_ID is a number guaranteed never to be associated with a
- * valid isolate group.
- */
-#define ILLEGAL_ISOLATE_GROUP_ID 0
-
-/*
- * =======
- * Service
- * =======
- */
-
-/**
- * A service request callback function.
- *
- * These callbacks, registered by the embedder, are called when the VM receives
- * a service request it can't handle and the service request command name
- * matches one of the embedder registered handlers.
- *
- * The return value of the callback indicates whether the response
- * should be used as a regular result or an error result.
- * Specifically, if the callback returns true, a regular JSON-RPC
- * response is built in the following way:
- *
- * {
- * "jsonrpc": "2.0",
- * "result": ,
- * "id": ,
- * }
- *
- * If the callback returns false, a JSON-RPC error is built like this:
- *
- * {
- * "jsonrpc": "2.0",
- * "error": ,
- * "id": ,
- * }
- *
- * \param method The rpc method name.
- * \param param_keys Service requests can have key-value pair parameters. The
- * keys and values are flattened and stored in arrays.
- * \param param_values The values associated with the keys.
- * \param num_params The length of the param_keys and param_values arrays.
- * \param user_data The user_data pointer registered with this handler.
- * \param result A C string containing a valid JSON object. The returned
- * pointer will be freed by the VM by calling free.
- *
- * \return True if the result is a regular JSON-RPC response, false if the
- * result is a JSON-RPC error.
- */
-typedef bool (*Dart_ServiceRequestCallback)(const char* method,
- const char** param_keys,
- const char** param_values,
- intptr_t num_params,
- void* user_data,
- const char** json_object);
-
-/**
- * Register a Dart_ServiceRequestCallback to be called to handle
- * requests for the named rpc on a specific isolate. The callback will
- * be invoked with the current isolate set to the request target.
- *
- * \param method The name of the method that this callback is responsible for.
- * \param callback The callback to invoke.
- * \param user_data The user data passed to the callback.
- *
- * NOTE: If multiple callbacks with the same name are registered, only
- * the last callback registered will be remembered.
- */
-DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(
- const char* method,
- Dart_ServiceRequestCallback callback,
- void* user_data);
-
-/**
- * Register a Dart_ServiceRequestCallback to be called to handle
- * requests for the named rpc. The callback will be invoked without a
- * current isolate.
- *
- * \param method The name of the command that this callback is responsible for.
- * \param callback The callback to invoke.
- * \param user_data The user data passed to the callback.
- *
- * NOTE: If multiple callbacks with the same name are registered, only
- * the last callback registered will be remembered.
- */
-DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
- const char* method,
- Dart_ServiceRequestCallback callback,
- void* user_data);
-
-/**
- * Embedder information which can be requested by the VM for internal or
- * reporting purposes.
- *
- * The pointers in this structure are not going to be cached or freed by the VM.
- */
-
- #define DART_EMBEDDER_INFORMATION_CURRENT_VERSION (0x00000001)
-
-typedef struct {
- int32_t version;
- const char* name; // [optional] The name of the embedder
- int64_t current_rss; // [optional] the current RSS of the embedder
- int64_t max_rss; // [optional] the maximum RSS of the embedder
-} Dart_EmbedderInformation;
-
-/**
- * Callback provided by the embedder that is used by the VM to request
- * information.
- *
- * \return Returns a pointer to a Dart_EmbedderInformation structure.
- * The embedder keeps the ownership of the structure and any field in it.
- * The embedder must ensure that the structure will remain valid until the
- * next invocation of the callback.
- */
-typedef void (*Dart_EmbedderInformationCallback)(
- Dart_EmbedderInformation* info);
-
-/**
- * Register a Dart_ServiceRequestCallback to be called to handle
- * requests for the named rpc. The callback will be invoked without a
- * current isolate.
- *
- * \param method The name of the command that this callback is responsible for.
- * \param callback The callback to invoke.
- * \param user_data The user data passed to the callback.
- *
- * NOTE: If multiple callbacks are registered, only the last callback registered
- * will be remembered.
- */
-DART_EXPORT void Dart_SetEmbedderInformationCallback(
- Dart_EmbedderInformationCallback callback);
-
-/**
- * Invoke a vm-service method and wait for its result.
- *
- * \param request_json The utf8-encoded json-rpc request.
- * \param request_json_length The length of the json-rpc request.
- *
- * \param response_json The returned utf8-encoded json response, must be
- * free()ed by caller.
- * \param response_json_length The length of the returned json response.
- * \param error An optional error, must be free()ed by caller.
- *
- * \return Whether the call was successfully performed.
- *
- * NOTE: This method does not need a current isolate and must not have the
- * vm-isolate being the current isolate. It must be called after
- * Dart_Initialize() and before Dart_Cleanup().
- */
-DART_EXPORT bool Dart_InvokeVMServiceMethod(uint8_t* request_json,
- intptr_t request_json_length,
- uint8_t** response_json,
- intptr_t* response_json_length,
- char** error);
-
-/*
- * ========
- * Event Streams
- * ========
- */
-
-/**
- * A callback invoked when the VM service gets a request to listen to
- * some stream.
- *
- * \return Returns true iff the embedder supports the named stream id.
- */
-typedef bool (*Dart_ServiceStreamListenCallback)(const char* stream_id);
-
-/**
- * A callback invoked when the VM service gets a request to cancel
- * some stream.
- */
-typedef void (*Dart_ServiceStreamCancelCallback)(const char* stream_id);
-
-/**
- * Adds VM service stream callbacks.
- *
- * \param listen_callback A function pointer to a listen callback function.
- * A listen callback function should not be already set when this function
- * is called. A NULL value removes the existing listen callback function
- * if any.
- *
- * \param cancel_callback A function pointer to a cancel callback function.
- * A cancel callback function should not be already set when this function
- * is called. A NULL value removes the existing cancel callback function
- * if any.
- *
- * \return Success if the callbacks were added. Otherwise, returns an
- * error handle.
- */
-DART_EXPORT char* Dart_SetServiceStreamCallbacks(
- Dart_ServiceStreamListenCallback listen_callback,
- Dart_ServiceStreamCancelCallback cancel_callback);
-
-/**
- * Sends a data event to clients of the VM Service.
- *
- * A data event is used to pass an array of bytes to subscribed VM
- * Service clients. For example, in the standalone embedder, this is
- * function used to provide WriteEvents on the Stdout and Stderr
- * streams.
- *
- * If the embedder passes in a stream id for which no client is
- * subscribed, then the event is ignored.
- *
- * \param stream_id The id of the stream on which to post the event.
- *
- * \param event_kind A string identifying what kind of event this is.
- * For example, 'WriteEvent'.
- *
- * \param bytes A pointer to an array of bytes.
- *
- * \param bytes_length The length of the byte array.
- *
- * \return NULL if the arguments are well formed. Otherwise, returns an
- * error string. The caller is responsible for freeing the error message.
- */
-DART_EXPORT char* Dart_ServiceSendDataEvent(const char* stream_id,
- const char* event_kind,
- const uint8_t* bytes,
- intptr_t bytes_length);
-
-/*
- * ========
- * Reload support
- * ========
- *
- * These functions are used to implement reloading in the Dart VM.
- * This is an experimental feature, so embedders should be prepared
- * for these functions to change.
- */
-
-/**
- * A callback which determines whether the file at some url has been
- * modified since some time. If the file cannot be found, true should
- * be returned.
- */
-typedef bool (*Dart_FileModifiedCallback)(const char* url, int64_t since);
-
-DART_EXPORT char* Dart_SetFileModifiedCallback(
- Dart_FileModifiedCallback file_modified_callback);
-
-/**
- * Returns true if isolate is currently reloading.
- */
-DART_EXPORT bool Dart_IsReloading();
-
-/*
- * ========
- * Timeline
- * ========
- */
-
-/**
- * Enable tracking of specified timeline category. This is operational
- * only when systrace timeline functionality is turned on.
- *
- * \param categories A comma separated list of categories that need to
- * be enabled, the categories are
- * "all" : All categories
- * "API" - Execution of Dart C API functions
- * "Compiler" - Execution of Dart JIT compiler
- * "CompilerVerbose" - More detailed Execution of Dart JIT compiler
- * "Dart" - Execution of Dart code
- * "Debugger" - Execution of Dart debugger
- * "Embedder" - Execution of Dart embedder code
- * "GC" - Execution of Dart Garbage Collector
- * "Isolate" - Dart Isolate lifecycle execution
- * "VM" - Execution in Dart VM runtime code
- * "" - None
- *
- * When "all" is specified all the categories are enabled.
- * When a comma separated list of categories is specified, the categories
- * that are specified will be enabled and the rest will be disabled.
- * When "" is specified all the categories are disabled.
- * The category names are case sensitive.
- * eg: Dart_EnableTimelineCategory("all");
- * Dart_EnableTimelineCategory("GC,API,Isolate");
- * Dart_EnableTimelineCategory("GC,Debugger,Dart");
- *
- * \return True if the categories were successfully enabled, False otherwise.
- */
-DART_EXPORT bool Dart_SetEnabledTimelineCategory(const char* categories);
-
-/**
- * Returns a timestamp in microseconds. This timestamp is suitable for
- * passing into the timeline system, and uses the same monotonic clock
- * as dart:developer's Timeline.now.
- *
- * \return A timestamp that can be passed to the timeline system.
- */
-DART_EXPORT int64_t Dart_TimelineGetMicros();
-
-/**
- * Returns a raw timestamp in from the monotonic clock.
- *
- * \return A raw timestamp from the monotonic clock.
- */
-DART_EXPORT int64_t Dart_TimelineGetTicks();
-
-/**
- * Returns the frequency of the monotonic clock.
- *
- * \return The frequency of the monotonic clock.
- */
-DART_EXPORT int64_t Dart_TimelineGetTicksFrequency();
-
-typedef enum {
- Dart_Timeline_Event_Begin, // Phase = 'B'.
- Dart_Timeline_Event_End, // Phase = 'E'.
- Dart_Timeline_Event_Instant, // Phase = 'i'.
- Dart_Timeline_Event_Duration, // Phase = 'X'.
- Dart_Timeline_Event_Async_Begin, // Phase = 'b'.
- Dart_Timeline_Event_Async_End, // Phase = 'e'.
- Dart_Timeline_Event_Async_Instant, // Phase = 'n'.
- Dart_Timeline_Event_Counter, // Phase = 'C'.
- Dart_Timeline_Event_Flow_Begin, // Phase = 's'.
- Dart_Timeline_Event_Flow_Step, // Phase = 't'.
- Dart_Timeline_Event_Flow_End, // Phase = 'f'.
-} Dart_Timeline_Event_Type;
-
-/**
- * Add a timeline event to the embedder stream.
- *
- * DEPRECATED: this function will be removed in Dart SDK v3.2.
- *
- * \param label The name of the event. Its lifetime must extend at least until
- * Dart_Cleanup.
- * \param timestamp0 The first timestamp of the event.
- * \param timestamp1_or_id When reporting an event of type
- * |Dart_Timeline_Event_Duration|, the second (end) timestamp of the event
- * should be passed through |timestamp1_or_id|. When reporting an event of
- * type |Dart_Timeline_Event_Async_Begin|, |Dart_Timeline_Event_Async_End|,
- * or |Dart_Timeline_Event_Async_Instant|, the async ID associated with the
- * event should be passed through |timestamp1_or_id|. When reporting an
- * event of type |Dart_Timeline_Event_Flow_Begin|,
- * |Dart_Timeline_Event_Flow_Step|, or |Dart_Timeline_Event_Flow_End|, the
- * flow ID associated with the event should be passed through
- * |timestamp1_or_id|. When reporting an event of type
- * |Dart_Timeline_Event_Begin| or |Dart_Timeline_Event_End|, the event ID
- * associated with the event should be passed through |timestamp1_or_id|.
- * Note that this event ID will only be used by the MacOS recorder. The
- * argument to |timestamp1_or_id| will not be used when reporting events of
- * other types.
- * \param argument_count The number of argument names and values.
- * \param argument_names An array of names of the arguments. The lifetime of the
- * names must extend at least until Dart_Cleanup. The array may be reclaimed
- * when this call returns.
- * \param argument_values An array of values of the arguments. The values and
- * the array may be reclaimed when this call returns.
- */
-DART_EXPORT void Dart_TimelineEvent(const char* label,
- int64_t timestamp0,
- int64_t timestamp1_or_id,
- Dart_Timeline_Event_Type type,
- intptr_t argument_count,
- const char** argument_names,
- const char** argument_values);
-
-/**
- * Add a timeline event to the embedder stream.
- *
- * Note regarding flow events: events must be associated with flow IDs in two
- * different ways to allow flow events to be serialized correctly in both
- * Chrome's JSON trace event format and Perfetto's proto trace format. Events
- * of type |Dart_Timeline_Event_Flow_Begin|, |Dart_Timeline_Event_Flow_Step|,
- * and |Dart_Timeline_Event_Flow_End| must be reported to support serialization
- * in Chrome's trace format. The |flow_ids| argument must be supplied when
- * reporting events of type |Dart_Timeline_Event_Begin|,
- * |Dart_Timeline_Event_Duration|, |Dart_Timeline_Event_Instant|,
- * |Dart_Timeline_Event_Async_Begin|, and |Dart_Timeline_Event_Async_Instant| to
- * support serialization in Perfetto's proto format.
- *
- * \param label The name of the event. Its lifetime must extend at least until
- * Dart_Cleanup.
- * \param timestamp0 The first timestamp of the event.
- * \param timestamp1_or_id When reporting an event of type
- * |Dart_Timeline_Event_Duration|, the second (end) timestamp of the event
- * should be passed through |timestamp1_or_id|. When reporting an event of
- * type |Dart_Timeline_Event_Async_Begin|, |Dart_Timeline_Event_Async_End|,
- * or |Dart_Timeline_Event_Async_Instant|, the async ID associated with the
- * event should be passed through |timestamp1_or_id|. When reporting an
- * event of type |Dart_Timeline_Event_Flow_Begin|,
- * |Dart_Timeline_Event_Flow_Step|, or |Dart_Timeline_Event_Flow_End|, the
- * flow ID associated with the event should be passed through
- * |timestamp1_or_id|. When reporting an event of type
- * |Dart_Timeline_Event_Begin| or |Dart_Timeline_Event_End|, the event ID
- * associated with the event should be passed through |timestamp1_or_id|.
- * Note that this event ID will only be used by the MacOS recorder. The
- * argument to |timestamp1_or_id| will not be used when reporting events of
- * other types.
- * \param flow_id_count The number of flow IDs associated with this event.
- * \param flow_ids An array of flow IDs associated with this event. The array
- * may be reclaimed when this call returns.
- * \param argument_count The number of argument names and values.
- * \param argument_names An array of names of the arguments. The lifetime of the
- * names must extend at least until Dart_Cleanup. The array may be reclaimed
- * when this call returns.
- * \param argument_values An array of values of the arguments. The values and
- * the array may be reclaimed when this call returns.
- */
-DART_EXPORT void Dart_RecordTimelineEvent(const char* label,
- int64_t timestamp0,
- int64_t timestamp1_or_id,
- intptr_t flow_id_count,
- const int64_t* flow_ids,
- Dart_Timeline_Event_Type type,
- intptr_t argument_count,
- const char** argument_names,
- const char** argument_values);
-
-/**
- * Associates a name with the current thread. This name will be used to name
- * threads in the timeline. Can only be called after a call to Dart_Initialize.
- *
- * \param name The name of the thread.
- */
-DART_EXPORT void Dart_SetThreadName(const char* name);
-
-typedef struct {
- const char* name;
- const char* value;
-} Dart_TimelineRecorderEvent_Argument;
-
-#define DART_TIMELINE_RECORDER_CURRENT_VERSION (0x00000002)
-
-typedef struct {
- /* Set to DART_TIMELINE_RECORDER_CURRENT_VERSION */
- int32_t version;
-
- /* The event's type / phase. */
- Dart_Timeline_Event_Type type;
-
- /* The event's timestamp according to the same clock as
- * Dart_TimelineGetMicros. For a duration event, this is the beginning time.
- */
- int64_t timestamp0;
-
- /**
- * For a duration event, this is the end time. For an async event, this is the
- * async ID. For a flow event, this is the flow ID. For a begin or end event,
- * this is the event ID (which is only referenced by the MacOS recorder).
- */
- int64_t timestamp1_or_id;
-
- /* The current isolate of the event, as if by Dart_GetMainPortId, or
- * ILLEGAL_PORT if the event had no current isolate. */
- Dart_Port isolate;
-
- /* The current isolate group of the event, as if by
- * Dart_CurrentIsolateGroupId, or ILLEGAL_PORT if the event had no current
- * isolate group. */
- Dart_IsolateGroupId isolate_group;
-
- /* The callback data associated with the isolate if any. */
- void* isolate_data;
-
- /* The callback data associated with the isolate group if any. */
- void* isolate_group_data;
-
- /* The name / label of the event. */
- const char* label;
-
- /* The stream / category of the event. */
- const char* stream;
-
- intptr_t argument_count;
- Dart_TimelineRecorderEvent_Argument* arguments;
-} Dart_TimelineRecorderEvent;
-
-/**
- * Callback provided by the embedder to handle the completion of timeline
- * events.
- *
- * \param event A timeline event that has just been completed. The VM keeps
- * ownership of the event and any field in it (i.e., the embedder should copy
- * any values it needs after the callback returns).
- */
-typedef void (*Dart_TimelineRecorderCallback)(
- Dart_TimelineRecorderEvent* event);
-
-/**
- * Register a `Dart_TimelineRecorderCallback` to be called as timeline events
- * are completed.
- *
- * The callback will be invoked without a current isolate.
- *
- * The callback will be invoked on the thread completing the event. Because
- * `Dart_TimelineEvent` may be called by any thread, the callback may be called
- * on any thread.
- *
- * The callback may be invoked at any time after `Dart_Initialize` is called and
- * before `Dart_Cleanup` returns.
- *
- * If multiple callbacks are registered, only the last callback registered
- * will be remembered. Providing a NULL callback will clear the registration
- * (i.e., a NULL callback produced a no-op instead of a crash).
- *
- * Setting a callback is insufficient to receive events through the callback. The
- * VM flag `timeline_recorder` must also be set to `callback`.
- */
-DART_EXPORT void Dart_SetTimelineRecorderCallback(
- Dart_TimelineRecorderCallback callback);
-
-/*
- * =======
- * Metrics
- * =======
- */
-
-/**
- * Return metrics gathered for the VM and individual isolates.
- */
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapOldUsedMetric(Dart_IsolateGroup group); // Byte
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapOldCapacityMetric(Dart_IsolateGroup group); // Byte
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapOldExternalMetric(Dart_IsolateGroup group); // Byte
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapNewUsedMetric(Dart_IsolateGroup group); // Byte
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapNewCapacityMetric(Dart_IsolateGroup group); // Byte
-DART_EXPORT int64_t
-Dart_IsolateGroupHeapNewExternalMetric(Dart_IsolateGroup group); // Byte
-
-/*
- * ========
- * UserTags
- * ========
- */
-
-/*
- * Gets the current isolate's currently set UserTag instance.
- *
- * \return The currently set UserTag instance.
- */
-DART_EXPORT Dart_Handle Dart_GetCurrentUserTag();
-
-/*
- * Gets the current isolate's default UserTag instance.
- *
- * \return The default UserTag with label 'Default'
- */
-DART_EXPORT Dart_Handle Dart_GetDefaultUserTag();
-
-/*
- * Creates a new UserTag instance.
- *
- * \param label The name of the new UserTag.
- *
- * \return The newly created UserTag instance or an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewUserTag(const char* label);
-
-/*
- * Updates the current isolate's UserTag to a new value.
- *
- * \param user_tag The UserTag to be set as the current UserTag.
- *
- * \return The previously set UserTag instance or an error handle.
- */
-DART_EXPORT Dart_Handle Dart_SetCurrentUserTag(Dart_Handle user_tag);
-
-/*
- * Returns the label of a given UserTag instance.
- *
- * \param user_tag The UserTag from which the label will be retrieved.
- *
- * \return The UserTag's label. NULL if the user_tag is invalid. The caller is
- * responsible for freeing the returned label.
- */
-DART_EXPORT DART_WARN_UNUSED_RESULT char* Dart_GetUserTagLabel(
- Dart_Handle user_tag);
-
-/*
- * =======
- * Heap Snapshot
- * =======
- */
-
-/**
- * Callback provided by the caller of `Dart_WriteHeapSnapshot` which is
- * used to write out chunks of the requested heap snapshot.
- *
- * \param context An opaque context which was passed to `Dart_WriteHeapSnapshot`
- * together with this callback.
- *
- * \param buffer Pointer to the buffer containing a chunk of the snapshot.
- * The callback owns the buffer and needs to `free` it.
- *
- * \param size Number of bytes in the `buffer` to be written.
- *
- * \param is_last Set to `true` for the last chunk. The callback will not
- * be invoked again after it was invoked once with `is_last` set to `true`.
- */
-typedef void (*Dart_HeapSnapshotWriteChunkCallback)(void* context,
- uint8_t* buffer,
- intptr_t size,
- bool is_last);
-
-/**
- * Generate heap snapshot of the current isolate group and stream it into the
- * given `callback`. VM would produce snapshot in chunks and send these chunks
- * one by one back to the embedder by invoking the provided `callback`.
- *
- * This API enables embedder to stream snapshot into a file or socket without
- * allocating a buffer to hold the whole snapshot in memory.
- *
- * The isolate group will be paused for the duration of this operation.
- *
- * \param write Callback used to write chunks of the heap snapshot.
- *
- * \param context Opaque context which would be passed on each invocation of
- * `write` callback.
- *
- * \returns `nullptr` if the operation is successful otherwise error message.
- * Caller owns error message string and needs to `free` it.
- */
-DART_EXPORT char* Dart_WriteHeapSnapshot(
- Dart_HeapSnapshotWriteChunkCallback write,
- void* context);
-
-#endif // RUNTIME_INCLUDE_DART_TOOLS_API_H_
diff --git a/libcore/bridge/include/dart_version.h b/libcore/bridge/include/dart_version.h
deleted file mode 100644
index e2d3651..0000000
--- a/libcore/bridge/include/dart_version.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_DART_VERSION_H_
-#define RUNTIME_INCLUDE_DART_VERSION_H_
-
-// On breaking changes the major version is increased.
-// On backwards compatible changes the minor version is increased.
-// The versioning covers the symbols exposed in dart_api_dl.h
-#define DART_API_DL_MAJOR_VERSION 2
-#define DART_API_DL_MINOR_VERSION 3
-
-#endif /* RUNTIME_INCLUDE_DART_VERSION_H_ */ /* NOLINT */
diff --git a/libcore/bridge/include/internal/dart_api_dl_impl.h b/libcore/bridge/include/internal/dart_api_dl_impl.h
deleted file mode 100644
index e4a5689..0000000
--- a/libcore/bridge/include/internal/dart_api_dl_impl.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
- * for details. All rights reserved. Use of this source code is governed by a
- * BSD-style license that can be found in the LICENSE file.
- */
-
-#ifndef RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
-#define RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
-
-typedef struct {
- const char* name;
- void (*function)(void);
-} DartApiEntry;
-
-typedef struct {
- const int major;
- const int minor;
- const DartApiEntry* const functions;
-} DartApi;
-
-#endif /* RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ */ /* NOLINT */
diff --git a/libcore/build_windows.bat b/libcore/build_windows.bat
deleted file mode 100644
index 153248a..0000000
--- a/libcore/build_windows.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-@echo off
-set GOOS=windows
-set GOARCH=amd64
-set CC=x86_64-w64-mingw32-gcc
-set CGO_ENABLED=1
-go run ./cli tunnel exit
-del bin\libcore.dll bin\HiddifyCli.exe
-set CGO_LDFLAGS=
-go build -trimpath -tags with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc -ldflags="-w -s" -buildmode=c-shared -o bin/libcore.dll ./custom
-go get github.com/akavel/rsrc
-go install github.com/akavel/rsrc
-
-rsrc -ico .\assets\hiddify-cli.ico -o cli\bydll\cli.syso
-
-copy bin\libcore.dll .
-set CGO_LDFLAGS="libcore.dll"
-go build -o bin/HiddifyCli.exe ./cli/bydll/
-del libcore.dll
diff --git a/libcore/cli/bydll/clibydll.go b/libcore/cli/bydll/clibydll.go
deleted file mode 100644
index 02c7184..0000000
--- a/libcore/cli/bydll/clibydll.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package main
-
-/*
-#include
-#include
-
-// Import the function from the DLL
-char* parseCli(int argc, char** argv);
-*/
-import "C"
-
-import (
- "fmt"
- "os"
- "unsafe"
-)
-
-func main() {
- args := os.Args
-
- // Convert []string to []*C.char
- var cArgs []*C.char
- for _, arg := range args {
- cArgs = append(cArgs, C.CString(arg))
- }
- defer func() {
- for _, arg := range cArgs {
- C.free(unsafe.Pointer(arg))
- }
- }()
-
- // Call the C function
- result := C.parseCli(C.int(len(cArgs)), (**C.char)(unsafe.Pointer(&cArgs[0])))
- fmt.Println(C.GoString(result))
-}
diff --git a/libcore/cli/main.go b/libcore/cli/main.go
deleted file mode 100644
index 13953ff..0000000
--- a/libcore/cli/main.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/hiddify/hiddify-core/cmd"
-)
-
-type UpdateRequest struct {
- Description string `json:"description,omitempty"`
- PrivatePods bool `json:"private_pods"`
- OperatingMode string `json:"operating_mode,omitempty"`
- ActivationState string `json:"activation_state,omitempty"`
-}
-
-func main() {
- cmd.ParseCli(os.Args[1:])
-
- // var request UpdateRequest
- // // jsonTag, err2 := validation.ErrorFieldName(&request, &request.OperatingMode)
- // jsonTag, err2 := request.ValName(&request.OperatingMode)
-
- // fmt.Println(jsonTag, err2)
- // RegisterExtension("com.example.extension", NewExampleExtension())
- // ex := extensionsMap["com.example.extension"].(*Extension[struct])
- // fmt.Println(NewExampleExtension().Get())
-
- // fmt.Println(ex.Get())
-}
diff --git a/libcore/cmd.bat b/libcore/cmd.bat
deleted file mode 100644
index 0f7f0c1..0000000
--- a/libcore/cmd.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-set TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
-@REM set TAGS=with_dhcp,with_low_memory,with_conntrack
-go run --tags %TAGS% ./cli %*
\ No newline at end of file
diff --git a/libcore/cmd.sh b/libcore/cmd.sh
deleted file mode 100755
index c547a19..0000000
--- a/libcore/cmd.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-go mod tidy
-TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
-# TAGS=with_dhcp,with_low_memory,with_conntrack
-go run --tags $TAGS ./cli $@
\ No newline at end of file
diff --git a/libcore/cmd/cmd_config.go b/libcore/cmd/cmd_config.go
deleted file mode 100644
index f34ebb3..0000000
--- a/libcore/cmd/cmd_config.go
+++ /dev/null
@@ -1,188 +0,0 @@
-package cmd
-
-import (
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/hiddify/hiddify-core/config"
- pb "github.com/hiddify/hiddify-core/hiddifyrpc"
- v2 "github.com/hiddify/hiddify-core/v2"
- "github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing-box/log"
- "github.com/sagernet/sing-box/option"
-
- "github.com/spf13/cobra"
-)
-
-var (
- hiddifySettingPath string
- configPath string
- defaultConfigs config.HiddifyOptions = *config.DefaultHiddifyOptions()
- commandBuildOutputPath string
-)
-
-var commandBuild = &cobra.Command{
- Use: "build",
- Short: "Build configuration",
- Run: func(cmd *cobra.Command, args []string) {
- err := build(configPath, hiddifySettingPath)
- if err != nil {
- log.Fatal(err)
- }
- },
-}
-
-var generateConfig = &cobra.Command{
- Use: "gen",
- Short: "gen configuration",
- Run: func(cmd *cobra.Command, args []string) {
- conf, err := v2.GenerateConfig(&pb.GenerateConfigRequest{
- Path: args[0],
- })
- if err != nil {
- log.Fatal(err)
- }
- log.Debug(string(conf.ConfigContent))
- },
-}
-
-var commandCheck = &cobra.Command{
- Use: "check",
- Short: "Check configuration",
- Run: func(cmd *cobra.Command, args []string) {
- err := check(configPath)
- if err != nil {
- log.Fatal(err)
- }
- },
-}
-
-func init() {
- commandBuild.Flags().StringVarP(&commandBuildOutputPath, "output", "o", "", "write result to file path instead of stdout")
- addHConfigFlags(commandBuild)
-
- mainCommand.AddCommand(commandBuild)
- mainCommand.AddCommand(generateConfig)
-}
-
-func build(path string, optionsPath string) error {
- if workingDir != "" {
- path = filepath.Join(workingDir, path)
- if optionsPath != "" {
- optionsPath = filepath.Join(workingDir, optionsPath)
- }
- os.Chdir(workingDir)
- }
- options, err := readConfigAt(path)
- if err != nil {
- return err
- }
-
- HiddifyOptions := &defaultConfigs // config.DefaultHiddifyOptions()
- if optionsPath != "" {
- HiddifyOptions, err = readHiddifyOptionsAt(optionsPath)
- if err != nil {
- return err
- }
- }
- config, err := config.BuildConfigJson(*HiddifyOptions, *options)
- if err != nil {
- return err
- }
- if commandBuildOutputPath != "" {
- outputPath, _ := filepath.Abs(filepath.Join(workingDir, commandBuildOutputPath))
- err = os.WriteFile(outputPath, []byte(config), 0o644)
- if err != nil {
- return err
- }
- fmt.Println("result successfully written to ", outputPath)
- // libbox.Setup(outputPath, workingDir, workingDir, true)
- // instance, err := NewService(*patchedOptions)
- } else {
- os.Stdout.WriteString(config)
- }
- return nil
-}
-
-func check(path string) error {
- content, err := os.ReadFile(path)
- if err != nil {
- return err
- }
- return libbox.CheckConfig(string(content))
-}
-
-func readConfigAt(path string) (*option.Options, error) {
- content, err := os.ReadFile(path)
- if err != nil {
- return nil, err
- }
- var options option.Options
- err = options.UnmarshalJSON(content)
- if err != nil {
- return nil, err
- }
- return &options, nil
-}
-
-func readConfigBytes(content []byte) (*option.Options, error) {
- var options option.Options
- err := options.UnmarshalJSON(content)
- if err != nil {
- return nil, err
- }
- return &options, nil
-}
-
-func readHiddifyOptionsAt(path string) (*config.HiddifyOptions, error) {
- content, err := os.ReadFile(path)
- if err != nil {
- return nil, err
- }
- var options config.HiddifyOptions
- err = json.Unmarshal(content, &options)
- if err != nil {
- return nil, err
- }
- if options.Warp.WireguardConfigStr != "" {
- err := json.Unmarshal([]byte(options.Warp.WireguardConfigStr), &options.Warp.WireguardConfig)
- if err != nil {
- return nil, err
- }
- }
- if options.Warp2.WireguardConfigStr != "" {
- err := json.Unmarshal([]byte(options.Warp2.WireguardConfigStr), &options.Warp2.WireguardConfig)
- if err != nil {
- return nil, err
- }
- }
-
- return &options, nil
-}
-
-func addHConfigFlags(commandRun *cobra.Command) {
- commandRun.Flags().StringVarP(&configPath, "config", "c", "", "proxy config path or url")
- commandRun.MarkFlagRequired("config")
- commandRun.Flags().StringVarP(&hiddifySettingPath, "hiddify", "d", "", "Hiddify Setting JSON Path")
- commandRun.Flags().BoolVar(&defaultConfigs.EnableFullConfig, "full-config", false, "allows including tags other than output")
- commandRun.Flags().StringVar(&defaultConfigs.LogLevel, "log", "warn", "log level")
- commandRun.Flags().BoolVar(&defaultConfigs.InboundOptions.EnableTun, "tun", false, "Enable Tun")
- commandRun.Flags().BoolVar(&defaultConfigs.InboundOptions.EnableTunService, "tun-service", false, "Enable Tun Service")
- commandRun.Flags().BoolVar(&defaultConfigs.InboundOptions.SetSystemProxy, "system-proxy", false, "Enable System Proxy")
- commandRun.Flags().Uint16Var(&defaultConfigs.InboundOptions.MixedPort, "in-proxy-port", 2334, "Input Mixed Port")
- commandRun.Flags().BoolVar(&defaultConfigs.TLSTricks.EnableFragment, "fragment", false, "Enable Fragment")
- commandRun.Flags().StringVar(&defaultConfigs.TLSTricks.FragmentSize, "fragment-size", "2-4", "FragmentSize")
- commandRun.Flags().StringVar(&defaultConfigs.TLSTricks.FragmentSleep, "fragment-sleep", "2-4", "FragmentSleep")
-
- commandRun.Flags().BoolVar(&defaultConfigs.TLSTricks.EnablePadding, "padding", false, "Enable Padding")
- commandRun.Flags().StringVar(&defaultConfigs.TLSTricks.PaddingSize, "padding-size", "1300-1400", "PaddingSize")
-
- commandRun.Flags().BoolVar(&defaultConfigs.TLSTricks.MixedSNICase, "mixed-sni-case", false, "MixedSNICase")
-
- commandRun.Flags().StringVar(&defaultConfigs.RemoteDnsAddress, "dns-remote", "1.1.1.1", "RemoteDNS (1.1.1.1, https://1.1.1.1/dns-query)")
- commandRun.Flags().StringVar(&defaultConfigs.DirectDnsAddress, "dns-direct", "1.1.1.1", "DirectDNS (1.1.1.1, https://1.1.1.1/dns-query)")
- commandRun.Flags().StringVar(&defaultConfigs.ClashApiSecret, "web-secret", "", "Web Server Secret")
- commandRun.Flags().Uint16Var(&defaultConfigs.ClashApiPort, "web-port", 6756, "Web Server Port")
-}
diff --git a/libcore/cmd/cmd_extension.go b/libcore/cmd/cmd_extension.go
deleted file mode 100644
index fffa5d5..0000000
--- a/libcore/cmd/cmd_extension.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package cmd
-
-import (
- _ "github.com/hiddify/hiddify-core/extension/repository"
- "github.com/hiddify/hiddify-core/extension/server"
- "github.com/spf13/cobra"
-)
-
-var commandExtension = &cobra.Command{
- Use: "extension",
- Short: "extension configuration",
- Args: cobra.MaximumNArgs(0),
- Run: func(cmd *cobra.Command, args []string) {
- server.StartTestExtensionServer()
- },
-}
-
-func init() {
- // commandWarp.Flags().StringVarP(&warpKey, "key", "k", "", "warp key")
- mainCommand.AddCommand(commandExtension)
-}
diff --git a/libcore/cmd/cmd_gen_cert.go b/libcore/cmd/cmd_gen_cert.go
deleted file mode 100644
index cd78289..0000000
--- a/libcore/cmd/cmd_gen_cert.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package cmd
-
-import (
- "os"
-
- "github.com/hiddify/hiddify-core/utils"
- "github.com/spf13/cobra"
-)
-
-var commandGenerateCertification = &cobra.Command{
- Use: "gen-cert",
- Short: "Generate certification for web server",
- Run: func(cmd *cobra.Command, args []string) {
- err := os.MkdirAll("cert", 0o644)
- if err != nil {
- panic("Error: " + err.Error())
- }
- utils.GenerateCertificate("cert/server-cert.pem", "cert/server-key.pem", true, true)
- utils.GenerateCertificate("cert/client-cert.pem", "cert/client-key.pem", false, true)
- },
-}
diff --git a/libcore/cmd/cmd_instance.go b/libcore/cmd/cmd_instance.go
deleted file mode 100644
index 936ed25..0000000
--- a/libcore/cmd/cmd_instance.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package cmd
-
-import (
- "os"
- "os/signal"
- "syscall"
-
- v2 "github.com/hiddify/hiddify-core/v2"
- "github.com/sagernet/sing-box/log"
- "github.com/spf13/cobra"
-)
-
-var commandInstance = &cobra.Command{
- Use: "instance",
- Short: "instance",
- Args: cobra.OnlyValidArgs,
- Run: func(cmd *cobra.Command, args []string) {
- hiddifySetting := defaultConfigs
- if hiddifySettingPath != "" {
- hiddifySetting2, err := v2.ReadHiddifyOptionsAt(hiddifySettingPath)
- if err != nil {
- log.Fatal(err)
- }
- hiddifySetting = *hiddifySetting2
- }
-
- instance, err := v2.RunInstanceString(&hiddifySetting, configPath)
- if err != nil {
- log.Fatal(err)
- }
- defer instance.Close()
- ping, err := instance.PingAverage("http://cp.cloudflare.com", 4)
- if err != nil {
- // log.Fatal(err)
- }
- log.Info("Average Ping to Cloudflare : ", ping, "\n")
-
- for i := 1; i <= 4; i++ {
- ping, err := instance.PingCloudflare()
- if err != nil {
- log.Warn(i, " Error ", err, "\n")
- } else {
- log.Info(i, " Ping time: ", ping, " ms\n")
- }
- }
- log.Info("Instance is running on port socks5://127.0.0.1:", instance.ListenPort, "\n")
- log.Info("Press Ctrl+C to exit\n")
- sigChan := make(chan os.Signal, 1)
- signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
- <-sigChan
- log.Info("CTRL+C recived-->stopping\n")
- instance.Close()
- },
-}
-
-func init() {
- mainCommand.AddCommand(commandInstance)
- addHConfigFlags(commandInstance)
-}
diff --git a/libcore/cmd/cmd_parse.go b/libcore/cmd/cmd_parse.go
deleted file mode 100644
index 9862bfd..0000000
--- a/libcore/cmd/cmd_parse.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package cmd
-
-import (
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/hiddify/hiddify-core/config"
- "github.com/sagernet/sing-box/log"
- "github.com/spf13/cobra"
-)
-
-var commandParseOutputPath string
-
-var commandParse = &cobra.Command{
- Use: "parse",
- Short: "Parse configuration",
- Args: cobra.ExactArgs(1),
- Run: func(cmd *cobra.Command, args []string) {
- err := parse(args[0])
- if err != nil {
- log.Fatal(err)
- }
- },
-}
-
-func init() {
- commandParse.Flags().StringVarP(&commandParseOutputPath, "output", "o", "", "write result to file path instead of stdout")
-
- mainCommand.AddCommand(commandParse)
-}
-
-func parse(path string) error {
- if workingDir != "" {
- path = filepath.Join(workingDir, path)
- }
- config, err := config.ParseConfig(path, true)
- if err != nil {
- return err
- }
- if commandParseOutputPath != "" {
- outputPath, _ := filepath.Abs(filepath.Join(workingDir, commandParseOutputPath))
- err = os.WriteFile(outputPath, config, 0644)
- if err != nil {
- return err
- }
- fmt.Println("result successfully written to ", outputPath)
- } else {
- os.Stdout.Write(config)
- }
- return nil
-}
diff --git a/libcore/cmd/cmd_run.go b/libcore/cmd/cmd_run.go
deleted file mode 100644
index a0f5d3e..0000000
--- a/libcore/cmd/cmd_run.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package cmd
-
-import (
- v2 "github.com/hiddify/hiddify-core/v2"
-
- "github.com/spf13/cobra"
-)
-
-var commandRun = &cobra.Command{
- Use: "run",
- Short: "run",
- Args: cobra.OnlyValidArgs,
- Run: runCommand,
-}
-
-func init() {
- // commandRun.PersistentFlags().BoolP("help", "", false, "help for this command")
- // commandRun.Flags().StringVarP(&hiddifySettingPath, "hiddify", "d", "", "Hiddify Setting JSON Path")
-
- addHConfigFlags(commandRun)
-
- mainCommand.AddCommand(commandRun)
-}
-
-func runCommand(cmd *cobra.Command, args []string) {
- v2.Setup("./tmp", "./", "./tmp", 0, false)
- v2.RunStandalone(hiddifySettingPath, configPath, defaultConfigs)
-}
diff --git a/libcore/cmd/cmd_temp.go b/libcore/cmd/cmd_temp.go
deleted file mode 100644
index 55832b7..0000000
--- a/libcore/cmd/cmd_temp.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package cmd
-
-// import (
-// "context"
-// "fmt"
-// "io"
-// "math/rand"
-// "net/http"
-// "net/netip"
-// "time"
-
-// "github.com/hiddify/hiddify-core/common"
-// // "github.com/hiddify/hiddify-core/extension_repository/cleanip_scanner"
-// "github.com/spf13/cobra"
-// "golang.org/x/net/proxy"
-// )
-
-// var commandTemp = &cobra.Command{
-// Use: "temp",
-// Short: "temp",
-// Args: cobra.MaximumNArgs(2),
-// Run: func(cmd *cobra.Command, args []string) {
-// // fmt.Printf("Ping time: %d ms\n", Ping())
-// scanner := cleanip_scanner.NewScannerEngine(&cleanip_scanner.ScannerOptions{
-// UseIPv4: true,
-// UseIPv6: common.CanConnectIPv6(),
-// MaxDesirableRTT: 500 * time.Millisecond,
-// IPQueueSize: 4,
-// IPQueueTTL: 10 * time.Second,
-// ConcurrentPings: 10,
-// // MaxDesirableIPs: e.count,
-// CidrList: cleanip_scanner.DefaultCFRanges(),
-// PingFunc: func(ip netip.Addr) (cleanip_scanner.IPInfo, error) {
-// fmt.Printf("Ping: %s\n", ip.String())
-// return cleanip_scanner.IPInfo{
-// AddrPort: netip.AddrPortFrom(ip, 80),
-// RTT: time.Duration(rand.Intn(1000)),
-// CreatedAt: time.Now(),
-// }, nil
-// },
-// },
-// )
-
-// ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
-// defer cancel()
-
-// scanner.Run(ctx)
-
-// t := time.NewTicker(1 * time.Second)
-// defer t.Stop()
-
-// for {
-// ipList := scanner.GetAvailableIPs(false)
-// if len(ipList) > 1 {
-// // e.result = ""
-// for i := 0; i < 2; i++ {
-// // result = append(result, ipList[i])
-// // e.result = e.result + ipList[i].AddrPort.String() + "\n"
-// fmt.Printf("%d %s\n", ipList[i].RTT, ipList[i].AddrPort.String())
-// }
-// return
-// }
-
-// select {
-// case <-ctx.Done():
-// // Context is done
-// return
-// case <-t.C:
-// // Prevent the loop from spinning too fast
-// continue
-// }
-// }
-// },
-// }
-
-// func init() {
-// mainCommand.AddCommand(commandTemp)
-// }
-
-// func GetContent(url string) (string, error) {
-// return ContentFromURL("GET", url, 10*time.Second)
-// }
-
-// func ContentFromURL(method string, url string, timeout time.Duration) (string, error) {
-// if method == "" {
-// return "", fmt.Errorf("empty method")
-// }
-// if url == "" {
-// return "", fmt.Errorf("empty url")
-// }
-
-// req, err := http.NewRequest(method, url, nil)
-// if err != nil {
-// return "", err
-// }
-
-// dialer, err := proxy.SOCKS5("tcp", "127.0.0.1:12334", nil, proxy.Direct)
-// if err != nil {
-// return "", err
-// }
-
-// transport := &http.Transport{
-// Dial: dialer.Dial,
-// }
-
-// client := &http.Client{
-// Transport: transport,
-// Timeout: timeout,
-// }
-
-// resp, err := client.Do(req)
-// if err != nil {
-// return "", err
-// }
-// defer resp.Body.Close()
-
-// if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent {
-// return "", fmt.Errorf("request failed with status code: %d", resp.StatusCode)
-// }
-
-// body, err := io.ReadAll(resp.Body)
-// if err != nil {
-// return "", err
-// }
-
-// if body == nil {
-// return "", fmt.Errorf("empty body")
-// }
-
-// return string(body), nil
-// }
-
-// func Ping() int {
-// startTime := time.Now()
-// _, err := ContentFromURL("HEAD", "https://cp.cloudflare.com", 4*time.Second)
-// if err != nil {
-// return -1
-// }
-// duration := time.Since(startTime)
-// return int(duration.Milliseconds())
-// }
diff --git a/libcore/cmd/cmd_tunnel_service.go b/libcore/cmd/cmd_tunnel_service.go
deleted file mode 100644
index 899cce5..0000000
--- a/libcore/cmd/cmd_tunnel_service.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package cmd
-
-import (
- "fmt"
- "time"
-
- "github.com/hiddify/hiddify-core/config"
- v2 "github.com/hiddify/hiddify-core/v2"
-
- "github.com/spf13/cobra"
-)
-
-var commandService = &cobra.Command{
- Use: "tunnel run/start/stop/install/uninstall/activate/deactivate/exit",
- Short: "Tunnel Service run/start/stop/install/uninstall/activate/deactivate/exit",
- ValidArgs: []string{"run", "start", "stop", "install", "uninstall", "activate", "deactivate", "exit"},
- Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
- Run: func(cmd *cobra.Command, args []string) {
- arg := args[0]
- switch arg {
- case "activate":
- config.ActivateTunnelService(config.HiddifyOptions{
- InboundOptions: config.InboundOptions{
- EnableTunService: true,
- MixedPort: 12334,
- TUNStack: "gvisor",
- },
- })
- <-time.After(1 * time.Second)
-
- case "deactivate":
- config.DeactivateTunnelServiceForce()
- case "exit":
- config.ExitTunnelService()
- default:
- code, out := v2.StartTunnelService(arg)
- fmt.Printf("exitCode:%d msg=%s", code, out)
- }
- },
-}
diff --git a/libcore/cmd/cmd_warp.go b/libcore/cmd/cmd_warp.go
deleted file mode 100644
index df10be3..0000000
--- a/libcore/cmd/cmd_warp.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package cmd
-
-import (
- "bufio"
- "encoding/json"
- "fmt"
-
- "os"
- "strings"
-
- "github.com/hiddify/hiddify-core/config"
- T "github.com/sagernet/sing-box/option"
- "github.com/spf13/cobra"
-)
-
-var warpKey string
-
-var commandWarp = &cobra.Command{
- Use: "warp",
- Short: "warp configuration",
- Args: cobra.ExactArgs(0),
- Run: func(cmd *cobra.Command, args []string) {
- out, err := generateWarp()
- fmt.Printf("out=%v Error! %v", out, err)
- if err != nil {
- fmt.Printf("Error! %v", err)
- }
- },
-}
-
-func init() {
- // commandWarp.Flags().StringVarP(&warpKey, "key", "k", "", "warp key")
- mainCommand.AddCommand(commandWarp)
-}
-
-type WireGuardConfig struct {
- Interface InterfaceConfig `json:"Interface"`
- Peer PeerConfig `json:"Peer"`
-}
-
-type InterfaceConfig struct {
- PrivateKey string `json:"PrivateKey"`
- DNS string `json:"DNS"`
- Address []string `json:"Address"`
-}
-
-type PeerConfig struct {
- PublicKey string `json:"PublicKey"`
- AllowedIPs []string `json:"AllowedIPs"`
- Endpoint string `json:"Endpoint"`
-}
-
-type SingboxConfig struct {
- Type string `json:"type"`
- Tag string `json:"tag"`
- Server string `json:"server"`
- ServerPort int `json:"server_port"`
- LocalAddress []string `json:"local_address"`
- PrivateKey string `json:"private_key"`
- PeerPublicKey string `json:"peer_public_key"`
- Reserved []int `json:"reserved"`
- MTU int `json:"mtu"`
-}
-
-func readWireGuardConfig(filePath string) (WireGuardConfig, error) {
- file, err := os.Open(filePath)
- if err != nil {
- return WireGuardConfig{}, err
- }
- defer file.Close()
-
- scanner := bufio.NewScanner(file)
-
- var wgConfig WireGuardConfig
- var currentSection string
-
- for scanner.Scan() {
- line := scanner.Text()
-
- if strings.HasPrefix(line, "[") && strings.HasSuffix(line, "]") {
- currentSection = strings.TrimSpace(line[1 : len(line)-1])
- continue
- }
-
- if currentSection == "Interface" {
- parseInterfaceConfig(&wgConfig.Interface, line)
- } else if currentSection == "Peer" {
- parsePeerConfig(&wgConfig.Peer, line)
- }
- }
-
- return wgConfig, nil
-}
-
-func parseInterfaceConfig(interfaceConfig *InterfaceConfig, line string) {
- if strings.HasPrefix(line, "PrivateKey") {
- interfaceConfig.PrivateKey = strings.TrimSpace(strings.SplitN(line, "=", 2)[1])
- } else if strings.HasPrefix(line, "DNS") {
- interfaceConfig.DNS = strings.TrimSpace(strings.SplitN(line, "=", 2)[1])
- } else if strings.HasPrefix(line, "Address") {
- interfaceConfig.Address = append(interfaceConfig.Address, strings.TrimSpace(strings.SplitN(line, "=", 2)[1]))
- }
-}
-
-func parsePeerConfig(peerConfig *PeerConfig, line string) {
- if strings.HasPrefix(line, "PublicKey") {
- peerConfig.PublicKey = strings.TrimSpace(strings.SplitN(line, "=", 2)[1])
- } else if strings.HasPrefix(line, "AllowedIPs") {
- peerConfig.AllowedIPs = append(peerConfig.AllowedIPs, strings.TrimSpace(strings.SplitN(line, "=", 2)[1]))
- } else if strings.HasPrefix(line, "Endpoint") {
- peerConfig.Endpoint = strings.TrimSpace(strings.SplitN(line, "=", 2)[1])
- }
-}
-func generateWarp() (*T.Outbound, error) {
- _, _, wg, err := config.GenerateWarpInfo("", "", "")
-
- // fmt.Printf("%v", wgConfig)
- singboxConfig, err := config.GenerateWarpSingbox(*wg, "", 0, "", "", "", "")
- singboxJSON, err := json.MarshalIndent(singboxConfig, "", " ")
- if err != nil {
- fmt.Println("Error marshaling Singbox configuration:", err)
- return nil, err
- }
- fmt.Println(string(singboxJSON))
- return nil, nil
-}
diff --git a/libcore/cmd/interface.go b/libcore/cmd/interface.go
deleted file mode 100644
index 8d05e91..0000000
--- a/libcore/cmd/interface.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package cmd
-
-import (
- "os"
- "time"
-
- "context"
-
- "github.com/sagernet/sing-box/log"
-
- "github.com/spf13/cobra"
-)
-
-var (
- workingDir string
- disableColor bool
-)
-
-var mainCommand = &cobra.Command{
- Use: "HiddifyCli",
- PersistentPreRun: preRun,
-}
-
-func init() {
- mainCommand.AddCommand(commandService)
- mainCommand.AddCommand(commandGenerateCertification)
-
- mainCommand.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
- mainCommand.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
-
-}
-
-func ParseCli(args []string) error {
- mainCommand.SetArgs(args)
- err := mainCommand.Execute()
- if err != nil {
- log.Fatal(err)
- }
- return err
-}
-
-func preRun(cmd *cobra.Command, args []string) {
- if disableColor {
- log.SetStdLogger(log.NewDefaultFactory(context.Background(), log.Formatter{BaseTime: time.Now(), DisableColors: true}, os.Stderr, "", nil, false).Logger())
- }
- if workingDir != "" {
- _, err := os.Stat(workingDir)
- if err != nil {
- os.MkdirAll(workingDir, 0o0644)
- }
- if err := os.Chdir(workingDir); err != nil {
- log.Fatal(err)
- }
- }
-}
diff --git a/libcore/cmd/internal/build_libcore/main.go b/libcore/cmd/internal/build_libcore/main.go
deleted file mode 100644
index f47357b..0000000
--- a/libcore/cmd/internal/build_libcore/main.go
+++ /dev/null
@@ -1,217 +0,0 @@
-package main
-
-import (
- "flag"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
-
- "github.com/hiddify/hiddify-core/cmd/internal/build_shared"
- _ "github.com/sagernet/gomobile"
- "github.com/sagernet/sing-box/log"
- "github.com/sagernet/sing/common/rw"
-)
-
-var target string
-
-func init() {
- flag.StringVar(&target, "target", "android", "target platform")
-}
-
-func main() {
- flag.Parse()
-
- switch target {
- case "windows":
- buildWindows()
- case "linux":
- buildLinux()
- case "macos":
- buildMacOS()
- case "android":
- buildAndroid()
- case "ios":
- buildIOS()
- }
-}
-
-var (
- sharedFlags []string
- sharedTags []string
- iosTags []string
-)
-
-const libName = "libcore"
-
-func init() {
- sharedFlags = append(sharedFlags, "-trimpath")
- sharedFlags = append(sharedFlags, "-ldflags", "-s -w")
- sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_ech", "with_utls", "with_clash_api", "with_grpc")
- iosTags = append(iosTags, "with_dhcp", "with_low_memory", "with_conntrack")
-}
-
-func setDesktopEnv() {
- os.Setenv("CGO_ENABLED", "1")
- os.Setenv("buildmode", "c-shared")
-}
-
-func buildWindows() {
- setDesktopEnv()
- os.Setenv("GOOS", "windows")
- os.Setenv("GOARCH", "amd64")
- os.Setenv("CC", "x86_64-w64-mingw32-gcc")
-
- args := []string{"build"}
- args = append(args, sharedFlags...)
- args = append(args, "-tags")
- args = append(args, strings.Join(sharedTags, ","))
-
- output := filepath.Join("bin", libName+".dll")
- args = append(args, "-o", output, "./custom")
-
- command := exec.Command("go", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func buildLinux() {
- setDesktopEnv()
- os.Setenv("GOOS", "linux")
- os.Setenv("GOARCH", "amd64")
-
- args := []string{"build"}
- args = append(args, sharedFlags...)
- args = append(args, "-tags")
- args = append(args, strings.Join(sharedTags, ","))
-
- output := filepath.Join("bin", libName+".so")
- args = append(args, "-o", output, "./custom")
-
- command := exec.Command("go", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func buildMacOS() {
- libPaths := []string{}
- for _, arch := range []string{"amd64", "arm64"} {
- out, err := buildMacOSArch(arch)
- if err != nil {
- log.Fatal(err)
- return
- }
- libPaths = append(libPaths, out)
- }
-
- args := []string{"-create"}
- args = append(args, libPaths...)
- args = append(args, "-output", filepath.Join("bin", libName+".dylib"))
-
- command := exec.Command("lipo", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func buildMacOSArch(arch string) (string, error) {
- setDesktopEnv()
- os.Setenv("GOOS", "darwin")
- os.Setenv("GOARCH", arch)
- os.Setenv("CGO_CFLAGS", "-mmacosx-version-min=10.11")
- os.Setenv("CGO_LDFLAGS", "-mmacosx-version-min=10.11")
-
- args := []string{"build"}
- args = append(args, sharedFlags...)
- tags := append(sharedTags, iosTags...)
- args = append(args, "-tags")
- args = append(args, strings.Join(tags, ","))
-
- filename := libName + "-" + arch + ".dylib"
- output := filepath.Join("bin", filename)
- args = append(args, "-o", output, "./custom")
-
- command := exec.Command("go", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- return "", err
- }
- return output, nil
-}
-
-func buildAndroid() {
- build_shared.FindMobile()
- build_shared.FindSDK()
-
- args := []string{
- "bind",
- "-v",
- "-androidapi", "21",
- "-javapkg=io.nekohasekai",
- "-libname=box",
- "-target=android",
- }
-
- args = append(args, sharedFlags...)
- args = append(args, "-tags")
- args = append(args, strings.Join(sharedTags, ","))
-
- output := filepath.Join("bin", libName+".aar")
- args = append(args, "-o", output, "github.com/sagernet/sing-box/experimental/libbox", "./mobile")
-
- command := exec.Command(build_shared.GoBinPath+"/gomobile", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func buildIOS() {
- build_shared.FindMobile()
-
- args := []string{
- "bind",
- "-v",
- "-libname=box",
- "-target", "ios,iossimulator,tvos,tvossimulator,macos",
- }
-
- args = append(args, sharedFlags...)
- tags := append(sharedTags, iosTags...)
- args = append(args, "-tags")
- args = append(args, strings.Join(tags, ","))
-
- output := filepath.Join("bin", "Libcore.xcframework")
- args = append(args, "-o", output, "github.com/sagernet/sing-box/experimental/libbox", "./mobile")
-
- command := exec.Command(build_shared.GoBinPath+"/gomobile", args...)
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
- log.Debug("command: ", command.String())
- err := command.Run()
- if err != nil {
- log.Fatal(err)
- }
-
- rw.CopyFile("Info.plist", filepath.Join(output, "Info.plist"))
-}
diff --git a/libcore/cmd/internal/build_shared/sdk.go b/libcore/cmd/internal/build_shared/sdk.go
deleted file mode 100644
index 5d651e5..0000000
--- a/libcore/cmd/internal/build_shared/sdk.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package build_shared
-
-import (
- "go/build"
- "os"
- "path/filepath"
- "runtime"
- "sort"
- "strconv"
- "strings"
-
- "github.com/sagernet/sing-box/log"
- "github.com/sagernet/sing/common"
- "github.com/sagernet/sing/common/rw"
-)
-
-var (
- androidSDKPath string
- androidNDKPath string
-)
-
-func FindSDK() {
- searchPath := []string{
- "$ANDROID_HOME",
- "$HOME/Android/Sdk",
- "$HOME/.local/lib/android/sdk",
- "$HOME/Library/Android/sdk",
- }
- for _, path := range searchPath {
- path = os.ExpandEnv(path)
- if rw.FileExists(path + "/licenses/android-sdk-license") {
- androidSDKPath = path
- break
- }
- }
- if androidSDKPath == "" {
- log.Fatal("android SDK not found")
- }
- if !findNDK() {
- log.Fatal("android NDK not found")
- }
-
- os.Setenv("ANDROID_HOME", androidSDKPath)
- os.Setenv("ANDROID_SDK_HOME", androidSDKPath)
- os.Setenv("ANDROID_NDK_HOME", androidNDKPath)
- os.Setenv("NDK", androidNDKPath)
- os.Setenv("PATH", os.Getenv("PATH")+":"+filepath.Join(androidNDKPath, "toolchains", "llvm", "prebuilt", runtime.GOOS+"-x86_64", "bin"))
-}
-
-func findNDK() bool {
- if rw.FileExists(androidSDKPath + "/ndk/26.1.10909125") {
- androidNDKPath = androidSDKPath + "/ndk/26.1.10909125"
- return true
- }
- ndkVersions, err := os.ReadDir(androidSDKPath + "/ndk")
- if err != nil {
- return false
- }
- versionNames := common.Map(ndkVersions, os.DirEntry.Name)
- if len(versionNames) == 0 {
- return false
- }
- sort.Slice(versionNames, func(i, j int) bool {
- iVersions := strings.Split(versionNames[i], ".")
- jVersions := strings.Split(versionNames[j], ".")
- for k := 0; k < len(iVersions) && k < len(jVersions); k++ {
- iVersion, _ := strconv.Atoi(iVersions[k])
- jVersion, _ := strconv.Atoi(jVersions[k])
- if iVersion != jVersion {
- return iVersion > jVersion
- }
- }
- return true
- })
- for _, versionName := range versionNames {
- if rw.FileExists(androidSDKPath + "/ndk/" + versionName) {
- androidNDKPath = androidSDKPath + "/ndk/" + versionName
- return true
- }
- }
- return false
-}
-
-var GoBinPath string
-
-func FindMobile() {
- goBin := filepath.Join(build.Default.GOPATH, "bin")
-
- if runtime.GOOS == "windows" {
- if !rw.FileExists(goBin + "/" + "gobind.exe") {
- log.Fatal("missing gomobile.exe installation")
- }
- } else {
- if !rw.FileExists(goBin + "/" + "gobind") {
- log.Fatal("missing gomobile installation")
- }
- }
- GoBinPath = goBin
-}
diff --git a/libcore/config/admin_service_cmd_runner.go b/libcore/config/admin_service_cmd_runner.go
deleted file mode 100644
index 761b94a..0000000
--- a/libcore/config/admin_service_cmd_runner.go
+++ /dev/null
@@ -1,49 +0,0 @@
-//go:build !windows
-
-package config
-
-import (
- "fmt"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
-)
-
-func ExecuteCmd(executablePath string, background bool, args ...string) (string, error) {
- cwd := filepath.Dir(executablePath)
- if appimage := os.Getenv("APPIMAGE"); appimage != "" {
- executablePath = appimage
- if !background {
- return "Fail", fmt.Errorf("Appimage cannot have service")
- }
- }
-
- commands := [][]string{
- {"cocoasudo", "--prompt=Hiddify needs root for tunneling.", executablePath},
- {"gksu", executablePath},
- {"pkexec", executablePath},
- {"xterm", "-e", "sudo", executablePath, strings.Join(args, " ")},
- {"sudo", executablePath},
- }
-
- var err error
- var cmd *exec.Cmd
- for _, command := range commands {
- cmd = exec.Command(command[0], command[1:]...)
- cmd.Dir = cwd
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
- fmt.Printf("Running command: %v\n", command)
- if background {
- err = cmd.Start()
- } else {
- err = cmd.Run()
- }
- if err == nil {
- return "Ok", nil
- }
- }
-
- return "", fmt.Errorf("Error executing run as root shell command")
-}
diff --git a/libcore/config/admin_service_cmd_runner_windows.go b/libcore/config/admin_service_cmd_runner_windows.go
deleted file mode 100644
index d7047e0..0000000
--- a/libcore/config/admin_service_cmd_runner_windows.go
+++ /dev/null
@@ -1,32 +0,0 @@
-//go:build windows
-
-package config
-
-import (
- "os"
- "strings"
- "syscall"
-
- "golang.org/x/sys/windows"
-)
-
-func ExecuteCmd(exe string, background bool, args ...string) (string, error) {
- verb := "runas"
- cwd, err := os.Getwd() // Error handling added
- if err != nil {
- return "", err
- }
-
- verbPtr, _ := syscall.UTF16PtrFromString(verb)
- exePtr, _ := syscall.UTF16PtrFromString(exe)
- cwdPtr, _ := syscall.UTF16PtrFromString(cwd)
- argPtr, _ := syscall.UTF16PtrFromString(strings.Join(args, " "))
-
- var showCmd int32 = 0 // SW_NORMAL
-
- err = windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
- if err != nil {
- return "", err
- }
- return "", nil
-}
diff --git a/libcore/config/admin_service_commander.go b/libcore/config/admin_service_commander.go
deleted file mode 100644
index ef422a9..0000000
--- a/libcore/config/admin_service_commander.go
+++ /dev/null
@@ -1,188 +0,0 @@
-package config
-
-import (
- context "context"
- "fmt"
- "log"
- "net"
- "os"
- "path/filepath"
- "runtime"
- "time"
-
- pb "github.com/hiddify/hiddify-core/hiddifyrpc"
- "github.com/sagernet/sing-box/option"
- dns "github.com/sagernet/sing-dns"
- grpc "google.golang.org/grpc"
-)
-
-const (
- serviceURL = "http://localhost:18020"
- startEndpoint = "/start"
- stopEndpoint = "/stop"
-)
-
-var tunnelServiceRunning = false
-
-func isSupportedOS() bool {
- return runtime.GOOS == "windows" || runtime.GOOS == "linux"
-}
-
-func ActivateTunnelService(opt HiddifyOptions) (bool, error) {
- tunnelServiceRunning = true
- // if !isSupportedOS() {
- // return false, E.New("Unsupported OS: " + runtime.GOOS)
- // }
-
- go startTunnelRequestWithFailover(opt, true)
- return true, nil
-}
-
-func DeactivateTunnelServiceForce() (bool, error) {
- return stopTunnelRequest()
-}
-
-func DeactivateTunnelService() (bool, error) {
- // if !isSupportedOS() {
- // return true, nil
- // }
-
- if tunnelServiceRunning {
- res, err := stopTunnelRequest()
- if err != nil {
- tunnelServiceRunning = false
- }
- return res, err
- } else {
- go stopTunnelRequest()
- }
-
- return true, nil
-}
-
-func startTunnelRequestWithFailover(opt HiddifyOptions, installService bool) {
- res, err := startTunnelRequest(opt, installService)
- fmt.Printf("Start Tunnel Result: %v\n", res)
- if err != nil {
- fmt.Printf("Start Tunnel Failed! Stopping core... err=%v\n", err)
- // StopAndAlert(pb.MessageType.MessageType_UNEXPECTED_ERROR, "Start Tunnel Failed! Stopping...")
- }
-}
-
-func isPortInUse(port string) bool {
- listener, err := net.Listen("tcp", "127.0.0.1:"+port)
- if err != nil {
- return true // Port is in use
- }
- defer listener.Close()
- return false // Port is available
-}
-
-func startTunnelRequest(opt HiddifyOptions, installService bool) (bool, error) {
- if !isPortInUse("18020") {
- if installService {
- return runTunnelService(opt)
- }
- return false, fmt.Errorf("service is not running")
- }
- conn, err := grpc.Dial("127.0.0.1:18020", grpc.WithInsecure())
- if err != nil {
- log.Printf("did not connect: %v", err)
- }
- defer conn.Close()
- c := pb.NewTunnelServiceClient(conn)
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
- defer cancel()
- _, _ = c.Stop(ctx, &pb.Empty{})
- res, err := c.Start(ctx, &pb.TunnelStartRequest{
- Ipv6: opt.IPv6Mode == option.DomainStrategy(dns.DomainStrategyUseIPv4),
- ServerPort: int32(opt.InboundOptions.MixedPort),
- StrictRoute: opt.InboundOptions.StrictRoute,
- EndpointIndependentNat: true,
- Stack: opt.InboundOptions.TUNStack,
- })
- if err != nil {
- log.Printf("could not greet: %+v %+v", res, err)
-
- if installService {
- ExitTunnelService()
- return runTunnelService(opt)
- }
- return false, err
- }
-
- return true, nil
-}
-
-func stopTunnelRequest() (bool, error) {
- conn, err := grpc.Dial("127.0.0.1:18020", grpc.WithInsecure())
- if err != nil {
- log.Printf("did not connect: %v", err)
- return false, err
- }
- defer conn.Close()
- c := pb.NewTunnelServiceClient(conn)
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
- defer cancel()
-
- res, err := c.Stop(ctx, &pb.Empty{})
- if err != nil {
- log.Printf("did not Stopped: %v %v", res, err)
- _, _ = c.Stop(ctx, &pb.Empty{})
- return false, err
- }
-
- return true, nil
-}
-
-func ExitTunnelService() (bool, error) {
- conn, err := grpc.Dial("127.0.0.1:18020", grpc.WithInsecure())
- if err != nil {
- log.Printf("did not connect: %v", err)
- return false, err
- }
- defer conn.Close()
- c := pb.NewTunnelServiceClient(conn)
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
- defer cancel()
-
- res, err := c.Exit(ctx, &pb.Empty{})
- if res != nil {
- log.Printf("did not exit: %v %v", res, err)
- return false, err
- }
-
- return true, nil
-}
-
-func runTunnelService(opt HiddifyOptions) (bool, error) {
- executablePath := getTunnelServicePath()
- fmt.Printf("Executable path is %s", executablePath)
- out, err := ExecuteCmd(executablePath, false, "tunnel", "install")
- fmt.Println("Shell command executed:", out, err)
- if err != nil {
- out, err = ExecuteCmd(executablePath, true, "tunnel", "run")
- fmt.Println("Shell command executed without flag:", out, err)
- }
- if err == nil {
- <-time.After(1 * time.Second) // wait until service loaded completely
- }
- return startTunnelRequest(opt, false)
-}
-
-func getTunnelServicePath() string {
- var fullPath string
- exePath, _ := os.Executable()
- binFolder := filepath.Dir(exePath)
- switch runtime.GOOS {
- case "windows":
- fullPath = "HiddifyCli.exe"
- case "darwin":
- fallthrough
- default:
- fullPath = "HiddifyCli"
- }
-
- abspath, _ := filepath.Abs(filepath.Join(binFolder, fullPath))
- return abspath
-}
diff --git a/libcore/config/config.go b/libcore/config/config.go
deleted file mode 100644
index 89b513e..0000000
--- a/libcore/config/config.go
+++ /dev/null
@@ -1,869 +0,0 @@
-package config
-
-import (
- "bytes"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "math/rand"
- "net"
- "net/netip"
- "net/url"
- "runtime"
- "strings"
- "time"
-
- C "github.com/sagernet/sing-box/constant"
- "github.com/sagernet/sing-box/option"
- dns "github.com/sagernet/sing-dns"
-)
-
-const (
- DNSRemoteTag = "dns-remote"
- DNSLocalTag = "dns-local"
- DNSDirectTag = "dns-direct"
- DNSBlockTag = "dns-block"
- DNSFakeTag = "dns-fake"
- DNSTricksDirectTag = "dns-trick-direct"
-
- OutboundDirectTag = "direct"
- OutboundBypassTag = "bypass"
- OutboundBlockTag = "block"
- OutboundSelectTag = "select"
- OutboundURLTestTag = "auto"
- OutboundDNSTag = "dns-out"
- OutboundDirectFragmentTag = "direct-fragment"
-
- InboundTUNTag = "tun-in"
- InboundMixedTag = "mixed-in"
- InboundDNSTag = "dns-in"
-)
-
-var OutboundMainProxyTag = OutboundSelectTag
-
-func BuildConfigJson(configOpt HiddifyOptions, input option.Options) (string, error) {
- options, err := BuildConfig(configOpt, input)
- if err != nil {
- return "", err
- }
- var buffer bytes.Buffer
- json.NewEncoder(&buffer)
- encoder := json.NewEncoder(&buffer)
- encoder.SetIndent("", " ")
- err = encoder.Encode(options)
- if err != nil {
- return "", err
- }
- return buffer.String(), nil
-}
-
-// TODO include selectors
-func BuildConfig(opt HiddifyOptions, input option.Options) (*option.Options, error) {
- fmt.Printf("config options: %++v\n", opt)
-
- var options option.Options
- if opt.EnableFullConfig {
- options.Inbounds = input.Inbounds
- options.DNS = input.DNS
- options.Route = input.Route
- }
-
- setClashAPI(&options, &opt)
- setLog(&options, &opt)
- setInbound(&options, &opt)
- setDns(&options, &opt)
- setRoutingOptions(&options, &opt)
- setFakeDns(&options, &opt)
- err := setOutbounds(&options, &input, &opt)
- if err != nil {
- return nil, err
- }
-
- return &options, nil
-}
-
-func addForceDirect(options *option.Options, opt *HiddifyOptions, directDNSDomains map[string]bool) {
- remoteDNSAddress := opt.RemoteDnsAddress
- if strings.Contains(remoteDNSAddress, "://") {
- remoteDNSAddress = strings.SplitAfter(remoteDNSAddress, "://")[1]
- }
- parsedUrl, err := url.Parse(fmt.Sprintf("https://%s", remoteDNSAddress))
- if err == nil && net.ParseIP(parsedUrl.Host) == nil {
- directDNSDomains[parsedUrl.Host] = true
- }
- if len(directDNSDomains) > 0 {
- // trickDnsDomains := []string{}
- // directDNSDomains = removeDuplicateStr(directDNSDomains)
- // b, _ := batch.New(context.Background(), batch.WithConcurrencyNum[bool](10))
- // for _, d := range directDNSDomains {
- // b.Go(d, func() (bool, error) {
- // return isBlockedDomain(d), nil
- // })
- // }
- // b.Wait()
- // for domain, isBlock := range b.Result() {
- // if isBlock.Value {
- // trickDnsDomains = append(trickDnsDomains, domain)
- // }
- // }
-
- // trickDomains := strings.Join(trickDnsDomains, ",")
- // trickRule := Rule{Domains: trickDomains, Outbound: OutboundBypassTag}
- // trickDnsRule := trickRule.MakeDNSRule()
- // trickDnsRule.Server = DNSTricksDirectTag
- // options.DNS.Rules = append([]option.DNSRule{{Type: C.RuleTypeDefault, DefaultOptions: trickDnsRule}}, options.DNS.Rules...)
-
- directDNSDomainskeys := make([]string, 0, len(directDNSDomains))
- for key := range directDNSDomains {
- directDNSDomainskeys = append(directDNSDomainskeys, key)
- }
-
- domains := strings.Join(directDNSDomainskeys, ",")
- directRule := Rule{Domains: domains, Outbound: OutboundBypassTag}
- dnsRule := directRule.MakeDNSRule()
- dnsRule.Server = DNSDirectTag
- options.DNS.Rules = append([]option.DNSRule{{Type: C.RuleTypeDefault, DefaultOptions: dnsRule}}, options.DNS.Rules...)
- }
-}
-
-func setOutbounds(options *option.Options, input *option.Options, opt *HiddifyOptions) error {
- directDNSDomains := make(map[string]bool)
- var outbounds []option.Outbound
- var tags []string
- OutboundMainProxyTag = OutboundSelectTag
- // inbound==warp over proxies
- // outbound==proxies over warp
- if opt.Warp.EnableWarp {
- for _, out := range input.Outbounds {
- if out.Type == C.TypeCustom {
- if warp, ok := out.CustomOptions["warp"].(map[string]interface{}); ok {
- key, _ := warp["key"].(string)
- if key == "p1" {
- opt.Warp.EnableWarp = false
- break
- }
- }
- }
- if out.Type == C.TypeWireGuard && (out.WireGuardOptions.PrivateKey == opt.Warp.WireguardConfig.PrivateKey || out.WireGuardOptions.PrivateKey == "p1") {
- opt.Warp.EnableWarp = false
- break
- }
- }
- }
- if opt.Warp.EnableWarp && (opt.Warp.Mode == "warp_over_proxy" || opt.Warp.Mode == "proxy_over_warp") {
- out, err := GenerateWarpSingbox(opt.Warp.WireguardConfig, opt.Warp.CleanIP, opt.Warp.CleanPort, opt.Warp.FakePackets, opt.Warp.FakePacketSize, opt.Warp.FakePacketDelay, opt.Warp.FakePacketMode)
- if err != nil {
- return fmt.Errorf("failed to generate warp config: %v", err)
- }
- out.Tag = "Hiddify Warp ✅"
- if opt.Warp.Mode == "warp_over_proxy" {
- out.WireGuardOptions.Detour = OutboundSelectTag
- OutboundMainProxyTag = out.Tag
- } else {
- out.WireGuardOptions.Detour = OutboundDirectTag
- }
- patchWarp(out, opt, true, nil)
- outbounds = append(outbounds, *out)
- // tags = append(tags, out.Tag)
- }
- for _, out := range input.Outbounds {
- outbound, serverDomain, err := patchOutbound(out, *opt, options.DNS.StaticIPs)
- if err != nil {
- return err
- }
-
- if serverDomain != "" {
- directDNSDomains[serverDomain] = true
- }
- out = *outbound
-
- switch out.Type {
- case C.TypeDirect, C.TypeBlock, C.TypeDNS:
- continue
- case C.TypeSelector, C.TypeURLTest:
- continue
- case C.TypeCustom:
- continue
- default:
- if !strings.Contains(out.Tag, "§hide§") {
- tags = append(tags, out.Tag)
- }
- out = patchHiddifyWarpFromConfig(out, *opt)
- outbounds = append(outbounds, out)
- }
- }
-
- urlTest := option.Outbound{
- Type: C.TypeURLTest,
- Tag: OutboundURLTestTag,
- URLTestOptions: option.URLTestOutboundOptions{
- Outbounds: tags,
- URL: opt.ConnectionTestUrl,
- Interval: option.Duration(opt.URLTestInterval.Duration()),
- // IdleTimeout: option.Duration(opt.URLTestIdleTimeout.Duration()),
- Tolerance: 1,
- IdleTimeout: option.Duration(opt.URLTestInterval.Duration().Nanoseconds() * 3),
- InterruptExistConnections: true,
- },
- }
- defaultSelect := urlTest.Tag
-
- for _, tag := range tags {
- if strings.Contains(tag, "§default§") {
- defaultSelect = "§default§"
- }
- }
- selector := option.Outbound{
- Type: C.TypeSelector,
- Tag: OutboundSelectTag,
- SelectorOptions: option.SelectorOutboundOptions{
- Outbounds: append([]string{urlTest.Tag}, tags...),
- Default: defaultSelect,
- InterruptExistConnections: true,
- },
- }
-
- outbounds = append([]option.Outbound{selector, urlTest}, outbounds...)
-
- options.Outbounds = append(
- outbounds,
- []option.Outbound{
- {
- Tag: OutboundDNSTag,
- Type: C.TypeDNS,
- },
- {
- Tag: OutboundDirectTag,
- Type: C.TypeDirect,
- },
- {
- Tag: OutboundDirectFragmentTag,
- Type: C.TypeDirect,
- DirectOptions: option.DirectOutboundOptions{
- DialerOptions: option.DialerOptions{
- TCPFastOpen: false,
- TLSFragment: option.TLSFragmentOptions{
- Enabled: true,
- Size: opt.TLSTricks.FragmentSize,
- Sleep: opt.TLSTricks.FragmentSleep,
- },
- },
- },
- },
- {
- Tag: OutboundBypassTag,
- Type: C.TypeDirect,
- },
- {
- Tag: OutboundBlockTag,
- Type: C.TypeBlock,
- },
- }...,
- )
-
- addForceDirect(options, opt, directDNSDomains)
- return nil
-}
-
-func setClashAPI(options *option.Options, opt *HiddifyOptions) {
- if opt.EnableClashApi {
- if opt.ClashApiSecret == "" {
- opt.ClashApiSecret = generateRandomString(16)
- }
- options.Experimental = &option.ExperimentalOptions{
- ClashAPI: &option.ClashAPIOptions{
- ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort),
- Secret: opt.ClashApiSecret,
- },
-
- CacheFile: &option.CacheFileOptions{
- Enabled: true,
- Path: "clash.db",
- },
- }
- }
-}
-
-func setLog(options *option.Options, opt *HiddifyOptions) {
- options.Log = &option.LogOptions{
- Level: opt.LogLevel,
- Output: opt.LogFile,
- Disabled: false,
- Timestamp: true,
- DisableColor: true,
- }
-}
-
-func setInbound(options *option.Options, opt *HiddifyOptions) {
- var inboundDomainStrategy option.DomainStrategy
- if !opt.ResolveDestination {
- inboundDomainStrategy = option.DomainStrategy(dns.DomainStrategyAsIS)
- } else {
- inboundDomainStrategy = opt.IPv6Mode
- }
- if opt.EnableTunService {
- ActivateTunnelService(*opt)
- } else if opt.EnableTun {
- tunInbound := option.Inbound{
- Type: C.TypeTun,
- Tag: InboundTUNTag,
-
- TunOptions: option.TunInboundOptions{
- Stack: opt.TUNStack,
- MTU: opt.MTU,
- AutoRoute: true,
- StrictRoute: opt.StrictRoute,
- EndpointIndependentNat: true,
- // GSO: runtime.GOOS != "windows",
- InboundOptions: option.InboundOptions{
- SniffEnabled: true,
- SniffOverrideDestination: false,
- DomainStrategy: inboundDomainStrategy,
- },
- },
- }
- switch opt.IPv6Mode {
- case option.DomainStrategy(dns.DomainStrategyUseIPv4):
- tunInbound.TunOptions.Inet4Address = []netip.Prefix{
- netip.MustParsePrefix("172.19.0.1/28"),
- }
- case option.DomainStrategy(dns.DomainStrategyUseIPv6):
- tunInbound.TunOptions.Inet6Address = []netip.Prefix{
- netip.MustParsePrefix("fdfe:dcba:9876::1/126"),
- }
- default:
- tunInbound.TunOptions.Inet4Address = []netip.Prefix{
- netip.MustParsePrefix("172.19.0.1/28"),
- }
- tunInbound.TunOptions.Inet6Address = []netip.Prefix{
- netip.MustParsePrefix("fdfe:dcba:9876::1/126"),
- }
- }
- options.Inbounds = append(options.Inbounds, tunInbound)
-
- }
-
- var bind string
- if opt.AllowConnectionFromLAN {
- bind = "0.0.0.0"
- } else {
- bind = "127.0.0.1"
- }
-
- options.Inbounds = append(
- options.Inbounds,
- option.Inbound{
- Type: C.TypeMixed,
- Tag: InboundMixedTag,
- MixedOptions: option.HTTPMixedInboundOptions{
- ListenOptions: option.ListenOptions{
- Listen: option.NewListenAddress(netip.MustParseAddr(bind)),
- ListenPort: opt.MixedPort,
- InboundOptions: option.InboundOptions{
- SniffEnabled: true,
- SniffOverrideDestination: true,
- DomainStrategy: inboundDomainStrategy,
- },
- },
- SetSystemProxy: opt.SetSystemProxy,
- },
- },
- )
-
- options.Inbounds = append(
- options.Inbounds,
- option.Inbound{
- Type: C.TypeDirect,
- Tag: InboundDNSTag,
- DirectOptions: option.DirectInboundOptions{
- ListenOptions: option.ListenOptions{
- Listen: option.NewListenAddress(netip.MustParseAddr(bind)),
- ListenPort: opt.LocalDnsPort,
- },
- // OverrideAddress: "1.1.1.1",
- // OverridePort: 53,
- },
- },
- )
-}
-
-func setDns(options *option.Options, opt *HiddifyOptions) {
- options.DNS = &option.DNSOptions{
- StaticIPs: map[string][]string{},
- DNSClientOptions: option.DNSClientOptions{
- IndependentCache: opt.IndependentDNSCache,
- },
- Final: DNSRemoteTag,
- Servers: []option.DNSServerOptions{
- {
- Tag: DNSRemoteTag,
- Address: opt.RemoteDnsAddress,
- AddressResolver: DNSDirectTag,
- Strategy: opt.RemoteDnsDomainStrategy,
- },
- {
- Tag: DNSTricksDirectTag,
- Address: "https://sky.rethinkdns.com/",
- // AddressResolver: "dns-local",
- Strategy: opt.DirectDnsDomainStrategy,
- Detour: OutboundDirectFragmentTag,
- },
- {
- Tag: DNSDirectTag,
- Address: opt.DirectDnsAddress,
- AddressResolver: DNSLocalTag,
- Strategy: opt.DirectDnsDomainStrategy,
- Detour: OutboundDirectTag,
- },
- {
- Tag: DNSLocalTag,
- Address: "local",
- Detour: OutboundDirectTag,
- },
- {
- Tag: DNSBlockTag,
- Address: "rcode://success",
- },
- },
- }
- sky_rethinkdns := getIPs([]string{"www.speedtest.net", "sky.rethinkdns.com"})
- if len(sky_rethinkdns) > 0 {
- options.DNS.StaticIPs["sky.rethinkdns.com"] = sky_rethinkdns
- }
-}
-
-func setFakeDns(options *option.Options, opt *HiddifyOptions) {
- if opt.EnableFakeDNS {
- inet4Range := netip.MustParsePrefix("198.18.0.0/15")
- inet6Range := netip.MustParsePrefix("fc00::/18")
- options.DNS.FakeIP = &option.DNSFakeIPOptions{
- Enabled: true,
- Inet4Range: &inet4Range,
- Inet6Range: &inet6Range,
- }
- options.DNS.Servers = append(
- options.DNS.Servers,
- option.DNSServerOptions{
- Tag: DNSFakeTag,
- Address: "fakeip",
- Strategy: option.DomainStrategy(dns.DomainStrategyUseIPv4),
- },
- )
- options.DNS.Rules = append(
- options.DNS.Rules,
- option.DNSRule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultDNSRule{
- Inbound: []string{InboundTUNTag},
- Server: DNSFakeTag,
- DisableCache: true,
- },
- },
- )
-
- }
-}
-
-func setRoutingOptions(options *option.Options, opt *HiddifyOptions) {
- dnsRules := []option.DefaultDNSRule{}
- routeRules := []option.Rule{}
- rulesets := []option.RuleSet{}
-
- if opt.EnableTun && runtime.GOOS == "android" {
- routeRules = append(
- routeRules,
- option.Rule{
- Type: C.RuleTypeDefault,
-
- DefaultOptions: option.DefaultRule{
- Inbound: []string{InboundTUNTag},
- PackageName: []string{"app.brAccelerator.com"},
- Outbound: OutboundBypassTag,
- },
- },
- )
- // routeRules = append(
- // routeRules,
- // option.Rule{
- // Type: C.RuleTypeDefault,
- // DefaultOptions: option.DefaultRule{
- // ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"},
- // Outbound: OutboundBypassTag,
- // },
- // },
- // )
- }
- routeRules = append(routeRules, option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- Inbound: []string{InboundDNSTag},
- Outbound: OutboundDNSTag,
- },
- })
- routeRules = append(routeRules, option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- Port: []uint16{53},
- Outbound: OutboundDNSTag,
- },
- })
-
- // {
- // Type: C.RuleTypeDefault,
- // DefaultOptions: option.DefaultRule{
- // ClashMode: "Direct",
- // Outbound: OutboundDirectTag,
- // },
- // },
- // {
- // Type: C.RuleTypeDefault,
- // DefaultOptions: option.DefaultRule{
- // ClashMode: "Global",
- // Outbound: OutboundMainProxyTag,
- // },
- // }, }
-
- if opt.BypassLAN {
- routeRules = append(
- routeRules,
- option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- // GeoIP: []string{"private"},
- IPIsPrivate: true,
- Outbound: OutboundBypassTag,
- },
- },
- )
- }
-
- for _, rule := range opt.Rules {
- routeRule := rule.MakeRule()
- switch rule.Outbound {
- case "bypass":
- routeRule.Outbound = OutboundBypassTag
- case "block":
- routeRule.Outbound = OutboundBlockTag
- case "proxy":
- routeRule.Outbound = OutboundMainProxyTag
- }
-
- if routeRule.IsValid() {
- routeRules = append(
- routeRules,
- option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: routeRule,
- },
- )
- }
-
- dnsRule := rule.MakeDNSRule()
- switch rule.Outbound {
- case "bypass":
- dnsRule.Server = DNSDirectTag
- case "block":
- dnsRule.Server = DNSBlockTag
- dnsRule.DisableCache = true
- case "proxy":
- if opt.EnableFakeDNS {
- fakeDnsRule := dnsRule
- fakeDnsRule.Server = DNSFakeTag
- fakeDnsRule.Inbound = []string{InboundTUNTag, InboundMixedTag}
- dnsRules = append(dnsRules, fakeDnsRule)
- }
- dnsRule.Server = DNSRemoteTag
- }
- dnsRules = append(dnsRules, dnsRule)
- }
-
- parsedURL, err := url.Parse(opt.ConnectionTestUrl)
- if err == nil {
- var dnsCPttl uint32 = 3000
- dnsRules = append(dnsRules, option.DefaultDNSRule{
- Domain: []string{parsedURL.Host},
- Server: DNSRemoteTag,
- RewriteTTL: &dnsCPttl,
- DisableCache: false,
- })
- }
-
- if opt.BlockAds {
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geosite-ads",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geosite-malware",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geosite-phishing",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geosite-cryptominers",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geoip-phishing",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geoip-malware",
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
-
- routeRules = append(routeRules, option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- RuleSet: []string{
- "geosite-ads",
- "geosite-malware",
- "geosite-phishing",
- "geosite-cryptominers",
- "geoip-malware",
- "geoip-phishing",
- },
- Outbound: OutboundBlockTag,
- },
- })
- dnsRules = append(dnsRules, option.DefaultDNSRule{
- RuleSet: []string{
- "geosite-ads",
- "geosite-malware",
- "geosite-phishing",
- "geosite-cryptominers",
- "geoip-malware",
- "geoip-phishing",
- },
- Server: DNSBlockTag,
- // DisableCache: true,
- })
-
- }
- if opt.Region != "other" {
- dnsRules = append(dnsRules, option.DefaultDNSRule{
- DomainSuffix: []string{"." + opt.Region},
- Server: DNSDirectTag,
- })
- routeRules = append(routeRules, option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- DomainSuffix: []string{"." + opt.Region},
- Outbound: OutboundDirectTag,
- },
- })
- dnsRules = append(dnsRules, option.DefaultDNSRule{
- RuleSet: []string{
- "geoip-" + opt.Region,
- "geosite-" + opt.Region,
- },
- Server: DNSDirectTag,
- })
-
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geoip-" + opt.Region,
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
- rulesets = append(rulesets, option.RuleSet{
- Type: C.RuleSetTypeRemote,
- Tag: "geosite-" + opt.Region,
- Format: C.RuleSetFormatBinary,
- RemoteOptions: option.RemoteRuleSet{
- URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs",
- UpdateInterval: option.Duration(5 * time.Hour * 24),
- },
- })
-
- routeRules = append(routeRules, option.Rule{
- Type: C.RuleTypeDefault,
- DefaultOptions: option.DefaultRule{
- RuleSet: []string{
- "geoip-" + opt.Region,
- "geosite-" + opt.Region,
- },
- Outbound: OutboundDirectTag,
- },
- })
-
- }
- options.Route = &option.RouteOptions{
- Rules: routeRules,
- Final: OutboundMainProxyTag,
- AutoDetectInterface: true,
- OverrideAndroidVPN: true,
- RuleSet: rulesets,
- // GeoIP: &option.GeoIPOptions{
- // Path: opt.GeoIPPath,
- // },
- // Geosite: &option.GeositeOptions{
- // Path: opt.GeoSitePath,
- // },
- }
- if opt.EnableDNSRouting {
- for _, dnsRule := range dnsRules {
- if dnsRule.IsValid() {
- options.DNS.Rules = append(
- options.DNS.Rules,
- option.DNSRule{
- Type: C.RuleTypeDefault,
- DefaultOptions: dnsRule,
- },
- )
- }
- }
- }
-}
-
-func patchHiddifyWarpFromConfig(out option.Outbound, opt HiddifyOptions) option.Outbound {
- if opt.Warp.EnableWarp && opt.Warp.Mode == "proxy_over_warp" {
- if out.DirectOptions.Detour == "" {
- out.DirectOptions.Detour = "Hiddify Warp ✅"
- }
- if out.HTTPOptions.Detour == "" {
- out.HTTPOptions.Detour = "Hiddify Warp ✅"
- }
- if out.Hysteria2Options.Detour == "" {
- out.Hysteria2Options.Detour = "Hiddify Warp ✅"
- }
- if out.HysteriaOptions.Detour == "" {
- out.HysteriaOptions.Detour = "Hiddify Warp ✅"
- }
- if out.SSHOptions.Detour == "" {
- out.SSHOptions.Detour = "Hiddify Warp ✅"
- }
- if out.ShadowTLSOptions.Detour == "" {
- out.ShadowTLSOptions.Detour = "Hiddify Warp ✅"
- }
- if out.ShadowsocksOptions.Detour == "" {
- out.ShadowsocksOptions.Detour = "Hiddify Warp ✅"
- }
- if out.ShadowsocksROptions.Detour == "" {
- out.ShadowsocksROptions.Detour = "Hiddify Warp ✅"
- }
- if out.SocksOptions.Detour == "" {
- out.SocksOptions.Detour = "Hiddify Warp ✅"
- }
- if out.TUICOptions.Detour == "" {
- out.TUICOptions.Detour = "Hiddify Warp ✅"
- }
- if out.TorOptions.Detour == "" {
- out.TorOptions.Detour = "Hiddify Warp ✅"
- }
- if out.TrojanOptions.Detour == "" {
- out.TrojanOptions.Detour = "Hiddify Warp ✅"
- }
- if out.VLESSOptions.Detour == "" {
- out.VLESSOptions.Detour = "Hiddify Warp ✅"
- }
- if out.VMessOptions.Detour == "" {
- out.VMessOptions.Detour = "Hiddify Warp ✅"
- }
- if out.WireGuardOptions.Detour == "" {
- out.WireGuardOptions.Detour = "Hiddify Warp ✅"
- }
- }
- return out
-}
-
-func getIPs(domains []string) []string {
- res := []string{}
- for _, d := range domains {
- ips, err := net.LookupHost(d)
- if err != nil {
- continue
- }
- for _, ip := range ips {
- if !strings.HasPrefix(ip, "10.") {
- res = append(res, ip)
- }
- }
- }
- return res
-}
-
-func isBlockedDomain(domain string) bool {
- if strings.HasPrefix("full:", domain) {
- return false
- }
- ips, err := net.LookupHost(domain)
- if err != nil {
- // fmt.Println(err)
- return true
- }
-
- // Print the IP addresses associated with the domain
- fmt.Printf("IP addresses for %s:\n", domain)
- for _, ip := range ips {
- if strings.HasPrefix(ip, "10.") {
- return true
- }
- }
- return false
-}
-
-func removeDuplicateStr(strSlice []string) []string {
- allKeys := make(map[string]bool)
- list := []string{}
- for _, item := range strSlice {
- if _, value := allKeys[item]; !value {
- allKeys[item] = true
- list = append(list, item)
- }
- }
- return list
-}
-
-func generateRandomString(length int) string {
- // Determine the number of bytes needed
- bytesNeeded := (length*6 + 7) / 8
-
- // Generate random bytes
- randomBytes := make([]byte, bytesNeeded)
- _, err := rand.Read(randomBytes)
- if err != nil {
- return "hiddify"
- }
-
- // Encode random bytes to base64
- randomString := base64.URLEncoding.EncodeToString(randomBytes)
-
- // Trim padding characters and return the string
- return randomString[:length]
-}
diff --git a/libcore/config/config.json.template b/libcore/config/config.json.template
deleted file mode 100644
index 06c91ad..0000000
--- a/libcore/config/config.json.template
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "log": {},
- "dns": {},
- "inbounds": [],
- "outbounds": [],
- "route": {},
- "experimental": {}
-}
\ No newline at end of file
diff --git a/libcore/config/constant.go b/libcore/config/constant.go
deleted file mode 100644
index b781d61..0000000
--- a/libcore/config/constant.go
+++ /dev/null
@@ -1,6 +0,0 @@
-package config
-
-const (
- WarpOverProxy = "warp_over_proxy"
- ProxyOverWarp = "proxy_over_warp"
-)
diff --git a/libcore/config/core.pb.go b/libcore/config/core.pb.go
deleted file mode 100644
index ea37d77..0000000
--- a/libcore/config/core.pb.go
+++ /dev/null
@@ -1,389 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.33.0
-// protoc v4.25.3
-// source: core.proto
-
-package config
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- reflect "reflect"
- sync "sync"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type ParseConfigRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- TempPath string `protobuf:"bytes,1,opt,name=tempPath,proto3" json:"tempPath,omitempty"`
- Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
- Debug bool `protobuf:"varint,3,opt,name=debug,proto3" json:"debug,omitempty"`
-}
-
-func (x *ParseConfigRequest) Reset() {
- *x = ParseConfigRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_core_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ParseConfigRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ParseConfigRequest) ProtoMessage() {}
-
-func (x *ParseConfigRequest) ProtoReflect() protoreflect.Message {
- mi := &file_core_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ParseConfigRequest.ProtoReflect.Descriptor instead.
-func (*ParseConfigRequest) Descriptor() ([]byte, []int) {
- return file_core_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *ParseConfigRequest) GetTempPath() string {
- if x != nil {
- return x.TempPath
- }
- return ""
-}
-
-func (x *ParseConfigRequest) GetPath() string {
- if x != nil {
- return x.Path
- }
- return ""
-}
-
-func (x *ParseConfigRequest) GetDebug() bool {
- if x != nil {
- return x.Debug
- }
- return false
-}
-
-type ParseConfigResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Error *string `protobuf:"bytes,1,opt,name=error,proto3,oneof" json:"error,omitempty"`
-}
-
-func (x *ParseConfigResponse) Reset() {
- *x = ParseConfigResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_core_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ParseConfigResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ParseConfigResponse) ProtoMessage() {}
-
-func (x *ParseConfigResponse) ProtoReflect() protoreflect.Message {
- mi := &file_core_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ParseConfigResponse.ProtoReflect.Descriptor instead.
-func (*ParseConfigResponse) Descriptor() ([]byte, []int) {
- return file_core_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *ParseConfigResponse) GetError() string {
- if x != nil && x.Error != nil {
- return *x.Error
- }
- return ""
-}
-
-type GenerateConfigRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
- Debug bool `protobuf:"varint,2,opt,name=debug,proto3" json:"debug,omitempty"`
-}
-
-func (x *GenerateConfigRequest) Reset() {
- *x = GenerateConfigRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_core_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GenerateConfigRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GenerateConfigRequest) ProtoMessage() {}
-
-func (x *GenerateConfigRequest) ProtoReflect() protoreflect.Message {
- mi := &file_core_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GenerateConfigRequest.ProtoReflect.Descriptor instead.
-func (*GenerateConfigRequest) Descriptor() ([]byte, []int) {
- return file_core_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *GenerateConfigRequest) GetPath() string {
- if x != nil {
- return x.Path
- }
- return ""
-}
-
-func (x *GenerateConfigRequest) GetDebug() bool {
- if x != nil {
- return x.Debug
- }
- return false
-}
-
-type GenerateConfigResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Config string `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
- Error *string `protobuf:"bytes,2,opt,name=error,proto3,oneof" json:"error,omitempty"`
-}
-
-func (x *GenerateConfigResponse) Reset() {
- *x = GenerateConfigResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_core_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GenerateConfigResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GenerateConfigResponse) ProtoMessage() {}
-
-func (x *GenerateConfigResponse) ProtoReflect() protoreflect.Message {
- mi := &file_core_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GenerateConfigResponse.ProtoReflect.Descriptor instead.
-func (*GenerateConfigResponse) Descriptor() ([]byte, []int) {
- return file_core_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *GenerateConfigResponse) GetConfig() string {
- if x != nil {
- return x.Config
- }
- return ""
-}
-
-func (x *GenerateConfigResponse) GetError() string {
- if x != nil && x.Error != nil {
- return *x.Error
- }
- return ""
-}
-
-var File_core_proto protoreflect.FileDescriptor
-
-var file_core_proto_rawDesc = []byte{
- 0x0a, 0x0a, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x43, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x5a, 0x0a, 0x12, 0x50,
- 0x61, 0x72, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a,
- 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74,
- 0x68, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x3a, 0x0a, 0x13, 0x50, 0x61, 0x72, 0x73, 0x65,
- 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19,
- 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
- 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72,
- 0x72, 0x6f, 0x72, 0x22, 0x41, 0x0a, 0x15, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04,
- 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68,
- 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
- 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x55, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,
- 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,
- 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
- 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0xc6, 0x01,
- 0x0a, 0x0b, 0x43, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a,
- 0x0b, 0x50, 0x61, 0x72, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x21, 0x2e, 0x43,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x61, 0x72,
- 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x22, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
- 0x50, 0x61, 0x72, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46,
- 0x75, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x24, 0x2e, 0x43, 0x6f, 0x6e, 0x66,
- 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,
- 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x25, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
- 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2e, 0x2f, 0x63, 0x6f, 0x6e,
- 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_core_proto_rawDescOnce sync.Once
- file_core_proto_rawDescData = file_core_proto_rawDesc
-)
-
-func file_core_proto_rawDescGZIP() []byte {
- file_core_proto_rawDescOnce.Do(func() {
- file_core_proto_rawDescData = protoimpl.X.CompressGZIP(file_core_proto_rawDescData)
- })
- return file_core_proto_rawDescData
-}
-
-var file_core_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
-var file_core_proto_goTypes = []interface{}{
- (*ParseConfigRequest)(nil), // 0: HiddifyOptions.ParseConfigRequest
- (*ParseConfigResponse)(nil), // 1: HiddifyOptions.ParseConfigResponse
- (*GenerateConfigRequest)(nil), // 2: HiddifyOptions.GenerateConfigRequest
- (*GenerateConfigResponse)(nil), // 3: HiddifyOptions.GenerateConfigResponse
-}
-var file_core_proto_depIdxs = []int32{
- 0, // 0: HiddifyOptions.CoreService.ParseConfig:input_type -> HiddifyOptions.ParseConfigRequest
- 2, // 1: HiddifyOptions.CoreService.GenerateFullConfig:input_type -> HiddifyOptions.GenerateConfigRequest
- 1, // 2: HiddifyOptions.CoreService.ParseConfig:output_type -> HiddifyOptions.ParseConfigResponse
- 3, // 3: HiddifyOptions.CoreService.GenerateFullConfig:output_type -> HiddifyOptions.GenerateConfigResponse
- 2, // [2:4] is the sub-list for method output_type
- 0, // [0:2] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_core_proto_init() }
-func file_core_proto_init() {
- if File_core_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ParseConfigRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_core_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ParseConfigResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_core_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GenerateConfigRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_core_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GenerateConfigResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- file_core_proto_msgTypes[1].OneofWrappers = []interface{}{}
- file_core_proto_msgTypes[3].OneofWrappers = []interface{}{}
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_core_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 4,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_core_proto_goTypes,
- DependencyIndexes: file_core_proto_depIdxs,
- MessageInfos: file_core_proto_msgTypes,
- }.Build()
- File_core_proto = out.File
- file_core_proto_rawDesc = nil
- file_core_proto_goTypes = nil
- file_core_proto_depIdxs = nil
-}
diff --git a/libcore/config/core_grpc.pb.go b/libcore/config/core_grpc.pb.go
deleted file mode 100644
index 17efffd..0000000
--- a/libcore/config/core_grpc.pb.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.3.0
-// - protoc v4.25.3
-// source: core.proto
-
-package config
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
-const _ = grpc.SupportPackageIsVersion7
-
-const (
- CoreService_ParseConfig_FullMethodName = "/HiddifyOptions.CoreService/ParseConfig"
- CoreService_GenerateFullConfig_FullMethodName = "/HiddifyOptions.CoreService/GenerateFullConfig"
-)
-
-// CoreServiceClient is the client API for CoreService service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type CoreServiceClient interface {
- ParseConfig(ctx context.Context, in *ParseConfigRequest, opts ...grpc.CallOption) (*ParseConfigResponse, error)
- GenerateFullConfig(ctx context.Context, in *GenerateConfigRequest, opts ...grpc.CallOption) (*GenerateConfigResponse, error)
-}
-
-type coreServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewCoreServiceClient(cc grpc.ClientConnInterface) CoreServiceClient {
- return &coreServiceClient{cc}
-}
-
-func (c *coreServiceClient) ParseConfig(ctx context.Context, in *ParseConfigRequest, opts ...grpc.CallOption) (*ParseConfigResponse, error) {
- out := new(ParseConfigResponse)
- err := c.cc.Invoke(ctx, CoreService_ParseConfig_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *coreServiceClient) GenerateFullConfig(ctx context.Context, in *GenerateConfigRequest, opts ...grpc.CallOption) (*GenerateConfigResponse, error) {
- out := new(GenerateConfigResponse)
- err := c.cc.Invoke(ctx, CoreService_GenerateFullConfig_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// CoreServiceServer is the server API for CoreService service.
-// All implementations must embed UnimplementedCoreServiceServer
-// for forward compatibility
-type CoreServiceServer interface {
- ParseConfig(context.Context, *ParseConfigRequest) (*ParseConfigResponse, error)
- GenerateFullConfig(context.Context, *GenerateConfigRequest) (*GenerateConfigResponse, error)
- mustEmbedUnimplementedCoreServiceServer()
-}
-
-// UnimplementedCoreServiceServer must be embedded to have forward compatible implementations.
-type UnimplementedCoreServiceServer struct {
-}
-
-func (UnimplementedCoreServiceServer) ParseConfig(context.Context, *ParseConfigRequest) (*ParseConfigResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ParseConfig not implemented")
-}
-func (UnimplementedCoreServiceServer) GenerateFullConfig(context.Context, *GenerateConfigRequest) (*GenerateConfigResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GenerateFullConfig not implemented")
-}
-func (UnimplementedCoreServiceServer) mustEmbedUnimplementedCoreServiceServer() {}
-
-// UnsafeCoreServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to CoreServiceServer will
-// result in compilation errors.
-type UnsafeCoreServiceServer interface {
- mustEmbedUnimplementedCoreServiceServer()
-}
-
-func RegisterCoreServiceServer(s grpc.ServiceRegistrar, srv CoreServiceServer) {
- s.RegisterService(&CoreService_ServiceDesc, srv)
-}
-
-func _CoreService_ParseConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ParseConfigRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(CoreServiceServer).ParseConfig(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: CoreService_ParseConfig_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(CoreServiceServer).ParseConfig(ctx, req.(*ParseConfigRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _CoreService_GenerateFullConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GenerateConfigRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(CoreServiceServer).GenerateFullConfig(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: CoreService_GenerateFullConfig_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(CoreServiceServer).GenerateFullConfig(ctx, req.(*GenerateConfigRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// CoreService_ServiceDesc is the grpc.ServiceDesc for CoreService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var CoreService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "HiddifyOptions.CoreService",
- HandlerType: (*CoreServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "ParseConfig",
- Handler: _CoreService_ParseConfig_Handler,
- },
- {
- MethodName: "GenerateFullConfig",
- Handler: _CoreService_GenerateFullConfig_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "core.proto",
-}
diff --git a/libcore/config/debug.go b/libcore/config/debug.go
deleted file mode 100644
index fab5a9e..0000000
--- a/libcore/config/debug.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package config
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
- "runtime/debug"
-
- "github.com/sagernet/sing-box/option"
-)
-
-func SaveCurrentConfig(path string, options option.Options) error {
- json, err := ToJson(options)
- if err != nil {
- return err
- }
- p, err := filepath.Abs(path)
- fmt.Printf("Saving config to %v %+v\n", p, err)
- if err != nil {
- return err
- }
- return os.WriteFile(p, []byte(json), 0644)
-}
-
-func ToJson(options option.Options) (string, error) {
- var buffer bytes.Buffer
- encoder := json.NewEncoder(&buffer)
- encoder.SetIndent("", " ")
- // fmt.Printf("%+v\n", options)
- err := encoder.Encode(options)
- if err != nil {
- fmt.Printf("ERROR in coding:%+v\n", err)
- return "", err
- }
- return buffer.String(), nil
-}
-
-func DeferPanicToError(name string, err func(error)) {
- if r := recover(); r != nil {
- s := fmt.Errorf("%s panic: %s\n%s", name, r, string(debug.Stack()))
- err(s)
- }
-}
diff --git a/libcore/config/hiddify_option.go b/libcore/config/hiddify_option.go
deleted file mode 100644
index 5b13242..0000000
--- a/libcore/config/hiddify_option.go
+++ /dev/null
@@ -1,155 +0,0 @@
-package config
-
-import (
- "github.com/sagernet/sing-box/option"
- dns "github.com/sagernet/sing-dns"
-)
-
-type HiddifyOptions struct {
- EnableFullConfig bool `json:"enable-full-config"`
- LogLevel string `json:"log-level"`
- LogFile string `json:"log-file"`
- EnableClashApi bool `json:"enable-clash-api"`
- ClashApiPort uint16 `json:"clash-api-port"`
- ClashApiSecret string `json:"web-secret"`
- Region string `json:"region"`
- BlockAds bool `json:"block-ads"`
- UseXrayCoreWhenPossible bool `json:"use-xray-core-when-possible"`
- // GeoIPPath string `json:"geoip-path"`
- // GeoSitePath string `json:"geosite-path"`
- Rules []Rule `json:"rules"`
- Warp WarpOptions `json:"warp"`
- Warp2 WarpOptions `json:"warp2"`
- Mux MuxOptions `json:"mux"`
- TLSTricks TLSTricks `json:"tls-tricks"`
- DNSOptions
- InboundOptions
- URLTestOptions
- RouteOptions
-}
-
-type DNSOptions struct {
- RemoteDnsAddress string `json:"remote-dns-address"`
- RemoteDnsDomainStrategy option.DomainStrategy `json:"remote-dns-domain-strategy"`
- DirectDnsAddress string `json:"direct-dns-address"`
- DirectDnsDomainStrategy option.DomainStrategy `json:"direct-dns-domain-strategy"`
- IndependentDNSCache bool `json:"independent-dns-cache"`
- EnableFakeDNS bool `json:"enable-fake-dns"`
- EnableDNSRouting bool `json:"enable-dns-routing"`
-}
-
-type InboundOptions struct {
- EnableTun bool `json:"enable-tun"`
- EnableTunService bool `json:"enable-tun-service"`
- SetSystemProxy bool `json:"set-system-proxy"`
- MixedPort uint16 `json:"mixed-port"`
- TProxyPort uint16 `json:"tproxy-port"`
- LocalDnsPort uint16 `json:"local-dns-port"`
- MTU uint32 `json:"mtu"`
- StrictRoute bool `json:"strict-route"`
- TUNStack string `json:"tun-implementation"`
-}
-
-type URLTestOptions struct {
- ConnectionTestUrl string `json:"connection-test-url"`
- URLTestInterval DurationInSeconds `json:"url-test-interval"`
- // URLTestIdleTimeout DurationInSeconds `json:"url-test-idle-timeout"`
-}
-
-type RouteOptions struct {
- ResolveDestination bool `json:"resolve-destination"`
- IPv6Mode option.DomainStrategy `json:"ipv6-mode"`
- BypassLAN bool `json:"bypass-lan"`
- AllowConnectionFromLAN bool `json:"allow-connection-from-lan"`
-}
-
-type TLSTricks struct {
- EnableFragment bool `json:"enable-fragment"`
- FragmentSize string `json:"fragment-size"`
- FragmentSleep string `json:"fragment-sleep"`
- MixedSNICase bool `json:"mixed-sni-case"`
- EnablePadding bool `json:"enable-padding"`
- PaddingSize string `json:"padding-size"`
-}
-
-type MuxOptions struct {
- Enable bool `json:"enable"`
- Padding bool `json:"padding"`
- MaxStreams int `json:"max-streams"`
- Protocol string `json:"protocol"`
-}
-
-type WarpOptions struct {
- Id string `json:"id"`
- EnableWarp bool `json:"enable"`
- Mode string `json:"mode"`
- WireguardConfigStr string `json:"wireguard-config"`
- WireguardConfig WarpWireguardConfig `json:"wireguardConfig"` // TODO check
- FakePackets string `json:"noise"`
- FakePacketSize string `json:"noise-size"`
- FakePacketDelay string `json:"noise-delay"`
- FakePacketMode string `json:"noise-mode"`
- CleanIP string `json:"clean-ip"`
- CleanPort uint16 `json:"clean-port"`
- Account WarpAccount
-}
-
-func DefaultHiddifyOptions() *HiddifyOptions {
- return &HiddifyOptions{
- DNSOptions: DNSOptions{
- RemoteDnsAddress: "1.1.1.1",
- RemoteDnsDomainStrategy: option.DomainStrategy(dns.DomainStrategyAsIS),
- DirectDnsAddress: "1.1.1.1",
- DirectDnsDomainStrategy: option.DomainStrategy(dns.DomainStrategyAsIS),
- IndependentDNSCache: false,
- EnableFakeDNS: false,
- EnableDNSRouting: false,
- },
- InboundOptions: InboundOptions{
- EnableTun: false,
- SetSystemProxy: false,
- MixedPort: 12334,
- TProxyPort: 12335,
- LocalDnsPort: 16450,
- MTU: 9000,
- StrictRoute: true,
- TUNStack: "mixed",
- },
- URLTestOptions: URLTestOptions{
- ConnectionTestUrl: "http://cp.cloudflare.com/",
- URLTestInterval: DurationInSeconds(600),
- // URLTestIdleTimeout: DurationInSeconds(6000),
- },
- RouteOptions: RouteOptions{
- ResolveDestination: false,
- IPv6Mode: option.DomainStrategy(dns.DomainStrategyAsIS),
- BypassLAN: false,
- AllowConnectionFromLAN: false,
- },
- LogLevel: "warn",
- // LogFile: "/dev/null",
- LogFile: "box.log",
- Region: "other",
- EnableClashApi: true,
- ClashApiPort: 16756,
- ClashApiSecret: "",
- // GeoIPPath: "geoip.db",
- // GeoSitePath: "geosite.db",
- Rules: []Rule{},
- Mux: MuxOptions{
- Enable: false,
- Padding: true,
- MaxStreams: 8,
- Protocol: "h2mux",
- },
- TLSTricks: TLSTricks{
- EnableFragment: false,
- FragmentSize: "10-100",
- FragmentSleep: "50-200",
- MixedSNICase: false,
- EnablePadding: false,
- PaddingSize: "1200-1500",
- },
- UseXrayCoreWhenPossible: false,
- }
-}
diff --git a/libcore/config/outbound.go b/libcore/config/outbound.go
deleted file mode 100644
index 73e0886..0000000
--- a/libcore/config/outbound.go
+++ /dev/null
@@ -1,185 +0,0 @@
-package config
-
-import (
- "encoding/json"
- "fmt"
- "net"
-
- C "github.com/sagernet/sing-box/constant"
- "github.com/sagernet/sing-box/option"
-)
-
-type outboundMap map[string]interface{}
-
-func patchOutboundMux(base option.Outbound, configOpt HiddifyOptions, obj outboundMap) outboundMap {
- if configOpt.Mux.Enable {
- multiplex := option.OutboundMultiplexOptions{
- Enabled: true,
- Padding: configOpt.Mux.Padding,
- MaxStreams: configOpt.Mux.MaxStreams,
- Protocol: configOpt.Mux.Protocol,
- }
- obj["multiplex"] = multiplex
- // } else {
- // delete(obj, "multiplex")
- }
- return obj
-}
-
-func patchOutboundTLSTricks(base option.Outbound, configOpt HiddifyOptions, obj outboundMap) outboundMap {
- if base.Type == C.TypeSelector || base.Type == C.TypeURLTest || base.Type == C.TypeBlock || base.Type == C.TypeDNS {
- return obj
- }
- if isOutboundReality(base) {
- return obj
- }
-
- var tls *option.OutboundTLSOptions
- var transport *option.V2RayTransportOptions
- if base.VLESSOptions.OutboundTLSOptionsContainer.TLS != nil {
- tls = base.VLESSOptions.OutboundTLSOptionsContainer.TLS
- transport = base.VLESSOptions.Transport
- } else if base.TrojanOptions.OutboundTLSOptionsContainer.TLS != nil {
- tls = base.TrojanOptions.OutboundTLSOptionsContainer.TLS
- transport = base.TrojanOptions.Transport
- } else if base.VMessOptions.OutboundTLSOptionsContainer.TLS != nil {
- tls = base.VMessOptions.OutboundTLSOptionsContainer.TLS
- transport = base.VMessOptions.Transport
- }
- if base.Type == C.TypeXray {
- if configOpt.TLSTricks.EnableFragment {
- if obj["xray_fragment"] == nil || obj["xray_fragment"].(map[string]any)["packets"] == "" {
- obj["xray_fragment"] = map[string]any{
- "packets": "tlshello",
- "length": configOpt.TLSTricks.FragmentSize,
- "interval": configOpt.TLSTricks.FragmentSleep,
- }
- }
- }
- }
- if base.Type == C.TypeDirect {
- return patchOutboundFragment(base, configOpt, obj)
- }
-
- if tls == nil || !tls.Enabled || transport == nil {
- return obj
- }
-
- if transport.Type != C.V2RayTransportTypeWebsocket && transport.Type != C.V2RayTransportTypeGRPC && transport.Type != C.V2RayTransportTypeHTTPUpgrade {
- return obj
- }
-
- if outtls, ok := obj["tls"].(map[string]interface{}); ok {
- obj = patchOutboundFragment(base, configOpt, obj)
- tlsTricks := tls.TLSTricks
- if tlsTricks == nil {
- tlsTricks = &option.TLSTricksOptions{}
- }
- tlsTricks.MixedCaseSNI = tlsTricks.MixedCaseSNI || configOpt.TLSTricks.MixedSNICase
-
- if configOpt.TLSTricks.EnablePadding {
- tlsTricks.PaddingMode = "random"
- tlsTricks.PaddingSize = configOpt.TLSTricks.PaddingSize
- // fmt.Printf("--------------------%+v----%+v", tlsTricks.PaddingSize, configOpt)
- outtls["utls"] = map[string]interface{}{
- "enabled": true,
- "fingerprint": "custom",
- }
- }
-
- outtls["tls_tricks"] = tlsTricks
- // if tlsTricks.MixedCaseSNI || tlsTricks.PaddingMode != "" {
- // // } else {
- // // tls["tls_tricks"] = nil
- // }
- // fmt.Printf("-------%+v------------- ", tlsTricks)
- }
- return obj
-}
-
-func patchOutboundFragment(base option.Outbound, configOpt HiddifyOptions, obj outboundMap) outboundMap {
- if configOpt.TLSTricks.EnableFragment {
- obj["tcp_fast_open"] = false
- obj["tls_fragment"] = option.TLSFragmentOptions{
- Enabled: configOpt.TLSTricks.EnableFragment,
- Size: configOpt.TLSTricks.FragmentSize,
- Sleep: configOpt.TLSTricks.FragmentSleep,
- }
-
- }
-
- return obj
-}
-
-func isOutboundReality(base option.Outbound) bool {
- // this function checks reality status ONLY FOR VLESS.
- // Some other protocols can also use reality, but it's discouraged as stated in the reality document
- if base.Type != C.TypeVLESS {
- return false
- }
- if base.VLESSOptions.OutboundTLSOptionsContainer.TLS == nil {
- return false
- }
- if base.VLESSOptions.OutboundTLSOptionsContainer.TLS.Reality == nil {
- return false
- }
- return base.VLESSOptions.OutboundTLSOptionsContainer.TLS.Reality.Enabled
-}
-
-func patchOutbound(base option.Outbound, configOpt HiddifyOptions, staticIpsDns map[string][]string) (*option.Outbound, string, error) {
- formatErr := func(err error) error {
- return fmt.Errorf("error patching outbound[%s][%s]: %w", base.Tag, base.Type, err)
- }
- err := patchWarp(&base, &configOpt, true, staticIpsDns)
- if err != nil {
- return nil, "", formatErr(err)
- }
- var outbound option.Outbound
-
- jsonData, err := base.MarshalJSON()
- if err != nil {
- return nil, "", formatErr(err)
- }
-
- var obj outboundMap
- err = json.Unmarshal(jsonData, &obj)
- if err != nil {
- return nil, "", formatErr(err)
- }
- var serverDomain string
- if detour, ok := obj["detour"].(string); !ok || detour == "" {
- if server, ok := obj["server"].(string); ok {
- if server != "" && net.ParseIP(server) == nil {
- serverDomain = fmt.Sprintf("full:%s", server)
- }
- }
- }
-
- obj = patchOutboundTLSTricks(base, configOpt, obj)
-
- switch base.Type {
- case C.TypeVMess, C.TypeVLESS, C.TypeTrojan, C.TypeShadowsocks:
- obj = patchOutboundMux(base, configOpt, obj)
- }
-
- modifiedJson, err := json.Marshal(obj)
- if err != nil {
- return nil, "", formatErr(err)
- }
-
- err = outbound.UnmarshalJSON(modifiedJson)
- if err != nil {
- return nil, "", formatErr(err)
- }
-
- return &outbound, serverDomain, nil
-}
-
-// func (o outboundMap) transportType() string {
-// if transport, ok := o["transport"].(map[string]interface{}); ok {
-// if transportType, ok := transport["type"].(string); ok {
-// return transportType
-// }
-// }
-// return ""
-// }
diff --git a/libcore/config/parser.go b/libcore/config/parser.go
deleted file mode 100644
index b6e23de..0000000
--- a/libcore/config/parser.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package config
-
-import (
- "bytes"
- "context"
- _ "embed"
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/hiddify/ray2sing/ray2sing"
- "github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing-box/option"
- "github.com/sagernet/sing/common/batch"
- SJ "github.com/sagernet/sing/common/json"
- "github.com/xmdhs/clash2singbox/convert"
- "github.com/xmdhs/clash2singbox/model/clash"
- "gopkg.in/yaml.v3"
-)
-
-//go:embed config.json.template
-var configByte []byte
-
-func ParseConfig(path string, debug bool) ([]byte, error) {
- content, err := os.ReadFile(path)
- os.Chdir(filepath.Dir(path))
- if err != nil {
- return nil, err
- }
- return ParseConfigContent(string(content), debug, nil, false)
-}
-
-func ParseConfigContentToOptions(contentstr string, debug bool, configOpt *HiddifyOptions, fullConfig bool) (*option.Options, error) {
- content, err := ParseConfigContent(contentstr, debug, configOpt, fullConfig)
- if err != nil {
- return nil, err
- }
- var options option.Options
- err = json.Unmarshal(content, &options)
- if err != nil {
- return nil, err
- }
- return &options, nil
-}
-
-func ParseConfigContent(contentstr string, debug bool, configOpt *HiddifyOptions, fullConfig bool) ([]byte, error) {
- if configOpt == nil {
- configOpt = DefaultHiddifyOptions()
- }
- content := []byte(contentstr)
- var jsonObj map[string]interface{} = make(map[string]interface{})
-
- fmt.Printf("Convert using json\n")
- var tmpJsonResult any
- jsonDecoder := json.NewDecoder(SJ.NewCommentFilter(bytes.NewReader(content)))
- if err := jsonDecoder.Decode(&tmpJsonResult); err == nil {
- if tmpJsonObj, ok := tmpJsonResult.(map[string]interface{}); ok {
- if tmpJsonObj["outbounds"] == nil {
- jsonObj["outbounds"] = []interface{}{jsonObj}
- } else {
- if fullConfig || (configOpt != nil && configOpt.EnableFullConfig) {
- jsonObj = tmpJsonObj
- } else {
- jsonObj["outbounds"] = tmpJsonObj["outbounds"]
- }
- }
- } else if jsonArray, ok := tmpJsonResult.([]map[string]interface{}); ok {
- jsonObj["outbounds"] = jsonArray
- } else {
- return nil, fmt.Errorf("[SingboxParser] Incorrect Json Format")
- }
-
- newContent, _ := json.MarshalIndent(jsonObj, "", " ")
-
- return patchConfig(newContent, "SingboxParser", configOpt)
- }
-
- v2rayStr, err := ray2sing.Ray2Singbox(string(content), configOpt.UseXrayCoreWhenPossible)
- if err == nil {
- return patchConfig([]byte(v2rayStr), "V2rayParser", configOpt)
- }
- fmt.Printf("Convert using clash\n")
- clashObj := clash.Clash{}
- if err := yaml.Unmarshal(content, &clashObj); err == nil && clashObj.Proxies != nil {
- if len(clashObj.Proxies) == 0 {
- return nil, fmt.Errorf("[ClashParser] no outbounds found")
- }
- converted, err := convert.Clash2sing(clashObj)
- if err != nil {
- return nil, fmt.Errorf("[ClashParser] converting clash to sing-box error: %w", err)
- }
- output := configByte
- output, err = convert.Patch(output, converted, "", "", nil)
- if err != nil {
- return nil, fmt.Errorf("[ClashParser] patching clash config error: %w", err)
- }
- return patchConfig(output, "ClashParser", configOpt)
- }
-
- return nil, fmt.Errorf("unable to determine config format")
-}
-
-func patchConfig(content []byte, name string, configOpt *HiddifyOptions) ([]byte, error) {
- options := option.Options{}
- err := json.Unmarshal(content, &options)
- if err != nil {
- return nil, fmt.Errorf("[SingboxParser] unmarshal error: %w", err)
- }
- b, _ := batch.New(context.Background(), batch.WithConcurrencyNum[*option.Outbound](2))
- for _, base := range options.Outbounds {
- out := base
- b.Go(base.Tag, func() (*option.Outbound, error) {
- err := patchWarp(&out, configOpt, false, nil)
- if err != nil {
- return nil, fmt.Errorf("[Warp] patch warp error: %w", err)
- }
- // options.Outbounds[i] = base
- return &out, nil
- })
- }
- if res, err := b.WaitAndGetResult(); err != nil {
- return nil, err
- } else {
- for i, base := range options.Outbounds {
- options.Outbounds[i] = *res[base.Tag].Value
- }
- }
-
- content, _ = json.MarshalIndent(options, "", " ")
-
- fmt.Printf("%s\n", content)
- return validateResult(content, name)
-}
-
-func validateResult(content []byte, name string) ([]byte, error) {
- err := libbox.CheckConfig(string(content))
- if err != nil {
- return nil, fmt.Errorf("[%s] invalid sing-box config: %w", name, err)
- }
- return content, nil
-}
diff --git a/libcore/config/rules.go b/libcore/config/rules.go
deleted file mode 100644
index d9be177..0000000
--- a/libcore/config/rules.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package config
-
-import (
- "strconv"
- "strings"
-
- "github.com/sagernet/sing-box/option"
-)
-
-type Rule struct {
- RuleSetUrl string `json:"rule-set-url"`
- Domains string `json:"domains"`
- IP string `json:"ip"`
- Port string `json:"port"`
- Network string `json:"network"`
- Protocol string `json:"protocol"`
- Outbound string `json:"outbound"`
-}
-
-func (r *Rule) MakeRule() option.DefaultRule {
- rule := option.DefaultRule{}
- if len(r.Domains) > 0 {
- rule = makeDomainRule(rule, strings.Split(r.Domains, ","))
- }
- if len(r.IP) > 0 {
- rule = makeIpRule(rule, strings.Split(r.IP, ","))
- }
- if len(r.Port) > 0 {
- rule = makePortRule(rule, strings.Split(r.Port, ","))
- }
- if len(r.Network) > 0 {
- rule.Network = append(rule.Network, r.Network)
- }
- if len(r.Protocol) > 0 {
- rule.Protocol = append(rule.Protocol, strings.Split(r.Protocol, ",")...)
- }
- return rule
-}
-
-func (r *Rule) MakeDNSRule() option.DefaultDNSRule {
- rule := option.DefaultDNSRule{}
- domains := strings.Split(r.Domains, ",")
- for _, item := range domains {
- if strings.HasPrefix(item, "geosite:") {
- rule.Geosite = append(rule.Geosite, strings.TrimPrefix(item, "geosite:"))
- } else if strings.HasPrefix(item, "full:") {
- rule.Domain = append(rule.Domain, strings.ToLower(strings.TrimPrefix(item, "full:")))
- } else if strings.HasPrefix(item, "domain:") {
- rule.DomainSuffix = append(rule.DomainSuffix, strings.ToLower(strings.TrimPrefix(item, "domain:")))
- } else if strings.HasPrefix(item, "regexp:") {
- rule.DomainRegex = append(rule.DomainRegex, strings.ToLower(strings.TrimPrefix(item, "regexp:")))
- } else if strings.HasPrefix(item, "keyword:") {
- rule.DomainKeyword = append(rule.DomainKeyword, strings.ToLower(strings.TrimPrefix(item, "keyword:")))
- }
- }
- return rule
-}
-
-func makeDomainRule(options option.DefaultRule, list []string) option.DefaultRule {
- for _, item := range list {
- if strings.HasPrefix(item, "geosite:") {
- options.Geosite = append(options.Geosite, strings.TrimPrefix(item, "geosite:"))
- } else if strings.HasPrefix(item, "full:") {
- options.Domain = append(options.Domain, strings.ToLower(strings.TrimPrefix(item, "full:")))
- } else if strings.HasPrefix(item, "domain:") {
- options.DomainSuffix = append(options.DomainSuffix, strings.ToLower(strings.TrimPrefix(item, "domain:")))
- } else if strings.HasPrefix(item, "regexp:") {
- options.DomainRegex = append(options.DomainRegex, strings.ToLower(strings.TrimPrefix(item, "regexp:")))
- } else if strings.HasPrefix(item, "keyword:") {
- options.DomainKeyword = append(options.DomainKeyword, strings.ToLower(strings.TrimPrefix(item, "keyword:")))
- }
- }
- return options
-}
-
-func makeIpRule(options option.DefaultRule, list []string) option.DefaultRule {
- for _, item := range list {
- if strings.HasPrefix(item, "geoip:") {
- options.GeoIP = append(options.GeoIP, strings.TrimPrefix(item, "geoip:"))
- } else {
- options.IPCIDR = append(options.IPCIDR, item)
- }
- }
- return options
-}
-
-func makePortRule(options option.DefaultRule, list []string) option.DefaultRule {
- for _, item := range list {
- if strings.Contains(item, ":") {
- options.PortRange = append(options.PortRange, item)
- } else if i, err := strconv.Atoi(item); err == nil {
- options.Port = append(options.Port, uint16(i))
- }
- }
- return options
-}
diff --git a/libcore/config/server.go b/libcore/config/server.go
deleted file mode 100644
index 6824220..0000000
--- a/libcore/config/server.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package config
-
-import (
- context "context"
- "fmt"
- "log"
- "net"
- "os"
- "path/filepath"
-
- "github.com/sagernet/sing-box/option"
- "google.golang.org/grpc"
-)
-
-type server struct {
- UnimplementedCoreServiceServer
-}
-
-func String(s string) *string {
- return &s
-}
-
-func (s *server) ParseConfig(ctx context.Context, in *ParseConfigRequest) (*ParseConfigResponse, error) {
- config, err := ParseConfig(in.TempPath, in.Debug)
- if err != nil {
- return &ParseConfigResponse{Error: String(err.Error())}, nil
- }
- err = os.WriteFile(in.Path, config, 0o644)
- if err != nil {
- return nil, err
- }
- return &ParseConfigResponse{Error: String("")}, nil
-}
-
-func (s *server) GenerateFullConfig(ctx context.Context, in *GenerateConfigRequest) (*GenerateConfigResponse, error) {
- os.Chdir(filepath.Dir(in.Path))
- content, err := os.ReadFile(in.Path)
- if err != nil {
- return nil, err
- }
- var options option.Options
- err = options.UnmarshalJSON(content)
- if err != nil {
- return nil, err
- }
- if err != nil {
- return nil, err
- }
- config, err := BuildConfigJson(*DefaultHiddifyOptions(), options)
- if err != nil {
- return nil, err
- }
- return &GenerateConfigResponse{
- Config: config,
- }, nil
-}
-
-func StartGRPCServer(port uint16) error {
- lis, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
- if err != nil {
- log.Fatalf("Failed to listen: %v", err)
- }
-
- s := grpc.NewServer()
- RegisterCoreServiceServer(s, &server{})
-
- log.Println("Server started on :", port)
- go func() {
- if err := s.Serve(lis); err != nil {
- log.Fatalf("Failed to serve: %v", err)
- }
- }()
-
- return nil
-}
diff --git a/libcore/config/types.go b/libcore/config/types.go
deleted file mode 100644
index 9fe6cc5..0000000
--- a/libcore/config/types.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package config
-
-import (
- "encoding/json"
- "time"
-)
-
-type DurationInSeconds int
-
-func (d DurationInSeconds) MarshalJSON() ([]byte, error) {
- return json.Marshal(int64(d))
-}
-
-func (d *DurationInSeconds) UnmarshalJSON(bytes []byte) error {
- var v int64
- if err := json.Unmarshal(bytes, &v); err != nil {
- return err
- }
- *d = DurationInSeconds(v)
- return nil
-}
-
-func (d DurationInSeconds) Duration() time.Duration {
- return time.Duration(d) * time.Second
-}
diff --git a/libcore/config/warp.go b/libcore/config/warp.go
deleted file mode 100644
index 36a3416..0000000
--- a/libcore/config/warp.go
+++ /dev/null
@@ -1,270 +0,0 @@
-package config
-
-import (
- "encoding/base64"
- "fmt"
- "log/slog"
- "net/netip"
- "os"
- "strings"
-
- "github.com/bepass-org/warp-plus/warp"
- "github.com/hiddify/hiddify-core/v2/common"
- C "github.com/sagernet/sing-box/constant"
-
- // "github.com/bepass-org/wireguard-go/warp"
- "github.com/hiddify/hiddify-core/v2/db"
-
- "github.com/sagernet/sing-box/option"
- T "github.com/sagernet/sing-box/option"
-)
-
-type SingboxConfig struct {
- Type string `json:"type"`
- Tag string `json:"tag"`
- Server string `json:"server"`
- ServerPort int `json:"server_port"`
- LocalAddress []string `json:"local_address"`
- PrivateKey string `json:"private_key"`
- PeerPublicKey string `json:"peer_public_key"`
- Reserved []int `json:"reserved"`
- MTU int `json:"mtu"`
-}
-
-func wireGuardToSingbox(wgConfig WarpWireguardConfig, server string, port uint16) (*T.Outbound, error) {
- clientID, _ := base64.StdEncoding.DecodeString(wgConfig.ClientID)
- if len(clientID) < 2 {
- clientID = []byte{0, 0, 0}
- }
- out := T.Outbound{
- Type: "wireguard",
- Tag: "WARP",
- WireGuardOptions: T.WireGuardOutboundOptions{
- ServerOptions: T.ServerOptions{
- Server: server,
- ServerPort: port,
- },
-
- PrivateKey: wgConfig.PrivateKey,
- PeerPublicKey: wgConfig.PeerPublicKey,
- Reserved: []uint8{clientID[0], clientID[1], clientID[2]},
- // Reserved: []uint8{0, 0, 0},
- MTU: 1330,
- },
- }
- ips := []string{wgConfig.LocalAddressIPv4 + "/24", wgConfig.LocalAddressIPv6 + "/128"}
-
- for _, addr := range ips {
- if addr == "" {
- continue
- }
- prefix, err := netip.ParsePrefix(addr)
- if err != nil {
- return nil, err // Handle the error appropriately
- }
- out.WireGuardOptions.LocalAddress = append(out.WireGuardOptions.LocalAddress, prefix)
- }
- return &out, nil
-}
-
-func getRandomIP() string {
- ipPort, err := warp.RandomWarpEndpoint(true, true)
- if err == nil {
- return ipPort.Addr().String()
- }
- return "engage.cloudflareclient.com"
-}
-
-func generateWarp(license string, host string, port uint16, fakePackets string, fakePacketsSize string, fakePacketsDelay string, fakePacketsMode string) (*T.Outbound, error) {
- _, _, wgConfig, err := GenerateWarpInfo(license, "", "")
- if err != nil {
- return nil, err
- }
- if wgConfig == nil {
- return nil, fmt.Errorf("invalid warp config")
- }
-
- return GenerateWarpSingbox(*wgConfig, host, port, fakePackets, fakePacketsSize, fakePacketsDelay, fakePacketsMode)
-}
-
-func GenerateWarpSingbox(wgConfig WarpWireguardConfig, host string, port uint16, fakePackets string, fakePacketsSize string, fakePacketsDelay string, fakePacketMode string) (*T.Outbound, error) {
- if host == "" {
- host = "auto4"
- }
-
- if (host == "auto" || host == "auto4" || host == "auto6") && fakePackets == "" {
- fakePackets = "1-3"
- }
- if fakePackets != "" && fakePacketsSize == "" {
- fakePacketsSize = "10-30"
- }
- if fakePackets != "" && fakePacketsDelay == "" {
- fakePacketsDelay = "10-30"
- }
- singboxConfig, err := wireGuardToSingbox(wgConfig, host, port)
- if err != nil {
- fmt.Printf("%v %v", singboxConfig, err)
- return nil, err
- }
-
- singboxConfig.WireGuardOptions.FakePackets = fakePackets
- singboxConfig.WireGuardOptions.FakePacketsSize = fakePacketsSize
- singboxConfig.WireGuardOptions.FakePacketsDelay = fakePacketsDelay
- singboxConfig.WireGuardOptions.FakePacketsMode = fakePacketMode
-
- return singboxConfig, nil
-}
-
-func GenerateWarpInfo(license string, oldAccountId string, oldAccessToken string) (*warp.Identity, string, *WarpWireguardConfig, error) {
- if oldAccountId != "" && oldAccessToken != "" {
- err := warp.DeleteDevice(oldAccessToken, oldAccountId)
- if err != nil {
- fmt.Printf("Error in removing old device: %v\n", err)
- } else {
- fmt.Printf("Old Device Removed")
- }
- }
- l := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo}))
- identity, err := warp.CreateIdentityOnly(l, license)
- res := "Error!"
- var warpcfg WarpWireguardConfig
- if err == nil {
- res = "Success"
- res = fmt.Sprintf("Warp+ enabled: %t\n", identity.Account.WarpPlus)
- res += fmt.Sprintf("\nAccount type: %s\n", identity.Account.AccountType)
- warpcfg = WarpWireguardConfig{
- PrivateKey: identity.PrivateKey,
- PeerPublicKey: identity.Config.Peers[0].PublicKey,
- LocalAddressIPv4: identity.Config.Interface.Addresses.V4,
- LocalAddressIPv6: identity.Config.Interface.Addresses.V6,
- ClientID: identity.Config.ClientID,
- }
- }
-
- return &identity, res, &warpcfg, err
-}
-
-func getOrGenerateWarpLocallyIfNeeded(warpOptions *WarpOptions) WarpWireguardConfig {
- if warpOptions.WireguardConfig.PrivateKey != "" {
- return warpOptions.WireguardConfig
- }
- table := db.GetTable[WarpOptions]()
- dbWarpOptions, err := table.Get(warpOptions.Id)
- if err == nil && dbWarpOptions.WireguardConfig.PrivateKey != "" {
- return warpOptions.WireguardConfig
- }
- license := ""
- if len(warpOptions.Id) == 26 { // warp key is 26 characters long
- license = warpOptions.Id
- } else if len(warpOptions.Id) > 28 && warpOptions.Id[2] == '_' { // warp key is 26 characters long
- license = warpOptions.Id[3:]
- }
-
- accountidentity, _, wireguardConfig, err := GenerateWarpInfo(license, warpOptions.Account.AccountID, warpOptions.Account.AccessToken)
- if err != nil {
- return WarpWireguardConfig{}
- }
- warpOptions.Account = WarpAccount{
- AccountID: accountidentity.ID,
- AccessToken: accountidentity.Token,
- }
- warpOptions.WireguardConfig = *wireguardConfig
- table.UpdateInsert(warpOptions)
-
- return *wireguardConfig
-}
-
-func patchWarp(base *option.Outbound, configOpt *HiddifyOptions, final bool, staticIpsDns map[string][]string) error {
- if base.Type == C.TypeCustom {
- if warp, ok := base.CustomOptions["warp"].(map[string]interface{}); ok {
- key, _ := warp["key"].(string)
- host, _ := warp["host"].(string)
- port, _ := warp["port"].(uint16)
- detour, _ := warp["detour"].(string)
- fakePackets, _ := warp["fake_packets"].(string)
- fakePacketsSize, _ := warp["fake_packets_size"].(string)
- fakePacketsDelay, _ := warp["fake_packets_delay"].(string)
- fakePacketsMode, _ := warp["fake_packets_mode"].(string)
- var warpOutbound *T.Outbound
- var err error
-
- is_saved_key := len(key) > 1 && key[0] == 'p'
-
- if (configOpt == nil || !final) && is_saved_key {
- return nil
- }
- var wireguardConfig WarpWireguardConfig
- if is_saved_key {
- var warpOpt *WarpOptions
- if key == "p1" {
- warpOpt = &configOpt.Warp
- } else if key == "p2" {
- warpOpt = &configOpt.Warp2
- } else {
- warpOpt = &WarpOptions{
- Id: key,
- }
- }
- warpOpt.Id = key
-
- wireguardConfig = getOrGenerateWarpLocallyIfNeeded(warpOpt)
- } else {
- _, _, wgConfig, err := GenerateWarpInfo(key, "", "")
- if err != nil {
- return err
- }
- wireguardConfig = *wgConfig
- }
- warpOutbound, err = GenerateWarpSingbox(wireguardConfig, host, port, fakePackets, fakePacketsSize, fakePacketsDelay, fakePacketsMode)
- if err != nil {
- fmt.Printf("Error generating warp config: %v", err)
- return err
- }
- warpOutbound.WireGuardOptions.Detour = detour
- base.Type = C.TypeWireGuard
- base.WireGuardOptions = warpOutbound.WireGuardOptions
- }
- }
-
- if final && base.Type == C.TypeWireGuard {
- host := base.WireGuardOptions.Server
-
- if host == "default" || host == "random" || host == "auto" || host == "auto4" || host == "auto6" || isBlockedDomain(host) {
- // if base.WireGuardOptions.Detour != "" {
- // base.WireGuardOptions.Server = "162.159.192.1"
- // } else {
- rndDomain := strings.ToLower(generateRandomString(20))
- staticIpsDns[rndDomain] = []string{}
- if host != "auto4" {
- if host == "auto6" || common.CanConnectIPv6() {
- randomIpPort, _ := warp.RandomWarpEndpoint(false, true)
- staticIpsDns[rndDomain] = append(staticIpsDns[rndDomain], randomIpPort.Addr().String())
- }
- }
- if host != "auto6" {
- randomIpPort, _ := warp.RandomWarpEndpoint(true, false)
- staticIpsDns[rndDomain] = append(staticIpsDns[rndDomain], randomIpPort.Addr().String())
- }
- base.WireGuardOptions.Server = rndDomain
- // }
- }
- if base.WireGuardOptions.ServerPort == 0 {
- port := warp.RandomWarpPort()
- base.WireGuardOptions.ServerPort = port
- }
-
- if base.WireGuardOptions.Detour != "" {
- if base.WireGuardOptions.MTU < 100 {
- base.WireGuardOptions.MTU = 1280
- }
- base.WireGuardOptions.FakePackets = ""
- base.WireGuardOptions.FakePacketsDelay = ""
- base.WireGuardOptions.FakePacketsSize = ""
- }
- // if base.WireGuardOptions.Detour == "" {
- // base.WireGuardOptions.GSO = runtime.GOOS != "windows"
- // }
- }
-
- return nil
-}
diff --git a/libcore/config/warp_account.go b/libcore/config/warp_account.go
deleted file mode 100644
index 2578e35..0000000
--- a/libcore/config/warp_account.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package config
-
-import (
- "encoding/json"
-)
-
-type WarpAccount struct {
- AccountID string `json:"account-id"`
- AccessToken string `json:"access-token"`
-}
-
-type WarpWireguardConfig struct {
- PrivateKey string `json:"private-key"`
- LocalAddressIPv4 string `json:"local-address-ipv4"`
- LocalAddressIPv6 string `json:"local-address-ipv6"`
- PeerPublicKey string `json:"peer-public-key"`
- ClientID string `json:"client-id"`
-}
-
-type WarpGenerationResponse struct {
- WarpAccount
- Log string `json:"log"`
- Config WarpWireguardConfig `json:"config"`
-}
-
-func GenerateWarpAccount(licenseKey string, accountId string, accessToken string) (string, error) {
- identity, log, wg, err := GenerateWarpInfo(licenseKey, accountId, accessToken)
- if err != nil {
- return "", err
- }
-
- warpAccount := WarpAccount{
- AccountID: identity.ID,
- AccessToken: identity.Token,
- }
- warpConfig := WarpWireguardConfig{
- PrivateKey: wg.PrivateKey,
- LocalAddressIPv4: wg.LocalAddressIPv4,
- LocalAddressIPv6: wg.LocalAddressIPv6,
- PeerPublicKey: wg.PeerPublicKey,
- ClientID: wg.ClientID,
- }
- response := WarpGenerationResponse{warpAccount, log, warpConfig}
-
- responseJson, err := json.Marshal(response)
- if err != nil {
- return "", err
- }
- return string(responseJson), nil
-}
diff --git a/libcore/custom/cmd_interface.go b/libcore/custom/cmd_interface.go
deleted file mode 100644
index 28c34b8..0000000
--- a/libcore/custom/cmd_interface.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package main
-
-/*
-#include
-*/
-import "C"
-import (
- "unsafe"
-
- "github.com/hiddify/hiddify-core/cmd"
-)
-
-//export parseCli
-func parseCli(argc C.int, argv **C.char) *C.char {
- args := make([]string, argc)
- for i := 0; i < int(argc); i++ {
- // fmt.Println("parseCli", C.GoString(*argv))
- args[i] = C.GoString(*argv)
- argv = (**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(argv)) + uintptr(unsafe.Sizeof(*argv))))
- }
- err := cmd.ParseCli(args[1:])
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
-}
diff --git a/libcore/custom/custom.go b/libcore/custom/custom.go
deleted file mode 100644
index ff99021..0000000
--- a/libcore/custom/custom.go
+++ /dev/null
@@ -1,169 +0,0 @@
-package main
-
-/*
-#include "stdint.h"
-*/
-import "C"
-
-import (
- "encoding/json"
- "fmt"
- "os"
- "unsafe"
-
- "github.com/hiddify/hiddify-core/bridge"
- "github.com/hiddify/hiddify-core/config"
- pb "github.com/hiddify/hiddify-core/hiddifyrpc"
- v2 "github.com/hiddify/hiddify-core/v2"
-
- "github.com/sagernet/sing-box/log"
-)
-
-//export setupOnce
-func setupOnce(api unsafe.Pointer) {
- bridge.InitializeDartApi(api)
-}
-
-//export setup
-func setup(baseDir *C.char, workingDir *C.char, tempDir *C.char, statusPort C.longlong, debug bool) (CErr *C.char) {
- err := v2.Setup(C.GoString(baseDir), C.GoString(workingDir), C.GoString(tempDir), int64(statusPort), debug)
- return emptyOrErrorC(err)
-}
-
-//export parse
-func parse(path *C.char, tempPath *C.char, debug bool) (CErr *C.char) {
- res, err := v2.Parse(&pb.ParseRequest{
- ConfigPath: C.GoString(path),
- TempPath: C.GoString(tempPath),
- })
- if err != nil {
- log.Error(err.Error())
- return C.CString(err.Error())
- }
-
- err = os.WriteFile(C.GoString(path), []byte(res.Content), 0o644)
- return emptyOrErrorC(err)
-}
-
-//export changeHiddifyOptions
-func changeHiddifyOptions(HiddifyOptionsJson *C.char) (CErr *C.char) {
- _, err := v2.ChangeHiddifySettings(&pb.ChangeHiddifySettingsRequest{
- HiddifySettingsJson: C.GoString(HiddifyOptionsJson),
- })
- return emptyOrErrorC(err)
-}
-
-//export generateConfig
-func generateConfig(path *C.char) (res *C.char) {
- conf, err := v2.GenerateConfig(&pb.GenerateConfigRequest{
- Path: C.GoString(path),
- })
- if err != nil {
- return emptyOrErrorC(err)
- }
- fmt.Printf("Config: %+v\n", conf)
- fmt.Printf("ConfigContent: %+v\n", conf.ConfigContent)
- return C.CString(conf.ConfigContent)
-}
-
-//export start
-func start(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) {
- _, err := v2.Start(&pb.StartRequest{
- ConfigPath: C.GoString(configPath),
- EnableOldCommandServer: true,
- DisableMemoryLimit: disableMemoryLimit,
- })
- return emptyOrErrorC(err)
-}
-
-//export stop
-func stop() (CErr *C.char) {
- _, err := v2.Stop()
- return emptyOrErrorC(err)
-}
-
-//export restart
-func restart(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) {
- _, err := v2.Restart(&pb.StartRequest{
- ConfigPath: C.GoString(configPath),
- EnableOldCommandServer: true,
- DisableMemoryLimit: disableMemoryLimit,
- })
- return emptyOrErrorC(err)
-}
-
-//export startCommandClient
-func startCommandClient(command C.int, port C.longlong) *C.char {
- err := v2.StartCommand(int32(command), int64(port))
- return emptyOrErrorC(err)
-}
-
-//export stopCommandClient
-func stopCommandClient(command C.int) *C.char {
- err := v2.StopCommand(int32(command))
- return emptyOrErrorC(err)
-}
-
-//export selectOutbound
-func selectOutbound(groupTag *C.char, outboundTag *C.char) (CErr *C.char) {
- _, err := v2.SelectOutbound(&pb.SelectOutboundRequest{
- GroupTag: C.GoString(groupTag),
- OutboundTag: C.GoString(outboundTag),
- })
-
- return emptyOrErrorC(err)
-}
-
-//export urlTest
-func urlTest(groupTag *C.char) (CErr *C.char) {
- _, err := v2.UrlTest(&pb.UrlTestRequest{
- GroupTag: C.GoString(groupTag),
- })
-
- return emptyOrErrorC(err)
-}
-
-func emptyOrErrorC(err error) *C.char {
- if err == nil {
- return C.CString("")
- }
- log.Error(err.Error())
- return C.CString(err.Error())
-}
-
-//export generateWarpConfig
-func generateWarpConfig(licenseKey *C.char, accountId *C.char, accessToken *C.char) (CResp *C.char) {
- res, err := v2.GenerateWarpConfig(&pb.GenerateWarpConfigRequest{
- LicenseKey: C.GoString(licenseKey),
- AccountId: C.GoString(accountId),
- AccessToken: C.GoString(accessToken),
- })
- if err != nil {
- return C.CString(fmt.Sprint("error: ", err.Error()))
- }
- warpAccount := config.WarpAccount{
- AccountID: res.Account.AccountId,
- AccessToken: res.Account.AccessToken,
- }
- warpConfig := config.WarpWireguardConfig{
- PrivateKey: res.Config.PrivateKey,
- LocalAddressIPv4: res.Config.LocalAddressIpv4,
- LocalAddressIPv6: res.Config.LocalAddressIpv6,
- PeerPublicKey: res.Config.PeerPublicKey,
- ClientID: res.Config.ClientId,
- }
- log := res.Log
- response := &config.WarpGenerationResponse{
- WarpAccount: warpAccount,
- Log: log,
- Config: warpConfig,
- }
-
- responseJson, err := json.Marshal(response)
- if err != nil {
- return C.CString("")
- }
- return C.CString(string(responseJson))
-}
-
-func main() {}
diff --git a/libcore/custom/grpc_interface.go b/libcore/custom/grpc_interface.go
deleted file mode 100644
index b9cab67..0000000
--- a/libcore/custom/grpc_interface.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package main
-
-import "C"
-import v2 "github.com/hiddify/hiddify-core/v2"
-
-//export StartCoreGrpcServer
-func StartCoreGrpcServer(listenAddress *C.char) (CErr *C.char) {
- _, err := v2.StartCoreGrpcServer(C.GoString(listenAddress))
- return emptyOrErrorC(err)
-}
diff --git a/libcore/docker-compile.sh b/libcore/docker-compile.sh
deleted file mode 100755
index 0963791..0000000
--- a/libcore/docker-compile.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-set -e
-
-echo "安装构建依赖..."
-apt-get update -qq
-apt-get install -y -qq wget unzip openjdk-17-jdk build-essential npm
-
-echo "创建Android SDK目录结构..."
-mkdir -p /opt/android-sdk/cmdline-tools
-
-echo "下载Android SDK命令行工具..."
-cd /tmp
-wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
-unzip -q commandlinetools-linux-11076708_latest.zip
-mv cmdline-tools /opt/android-sdk/cmdline-tools/latest
-
-export ANDROID_HOME=/opt/android-sdk
-export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
-
-echo "接受Android SDK许可..."
-yes | sdkmanager --licenses > /dev/null 2>&1 || true
-
-echo "安装Android SDK Platform 21和Build Tools..."
-sdkmanager "platforms;android-21" "build-tools;30.0.3" "platform-tools"
-
-echo "安装Android NDK..."
-cd /tmp
-wget -q https://dl.google.com/android/repository/android-ndk-r26c-linux.zip
-unzip -q android-ndk-r26c-linux.zip
-export ANDROID_NDK_HOME=/tmp/android-ndk-r26c
-
-echo "安装gomobile..."
-go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.1
-go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.1
-
-export PATH=$PATH:/root/go/bin
-
-echo "安装npm依赖..."
-npm install --silent
-
-echo "初始化gomobile..."
-gomobile init -ndk $ANDROID_NDK_HOME
-
-cd /workspace
-
-echo "开始使用gomobile编译..."
-gomobile bind -v \
- -androidapi=21 \
- -javapkg=io.nekohasekai \
- -libname=box \
- -tags="with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc" \
- -trimpath \
- -target=android/arm64 \
- -o libcore.aar \
- github.com/sagernet/sing-box/experimental/libbox ./mobile
-
-if [ ! -f libcore.aar ]; then
- echo "❌ 编译失败: libcore.aar未生成"
- exit 1
-fi
-
-echo "提取libbox.so..."
-unzip -j libcore.aar jni/arm64-v8a/libbox.so -d /tmp/
-if [ -f /tmp/libbox.so ]; then
- cp /tmp/libbox.so /workspace/libbox-new.so
- echo "✅ 编译成功!"
- ls -lh /workspace/libbox-new.so
- md5sum /workspace/libbox-new.so
-else
- echo "❌ 提取失败: libbox.so未找到"
- exit 1
-fi
diff --git a/libcore/docker/Dockerfile b/libcore/docker/Dockerfile
deleted file mode 100644
index be0c723..0000000
--- a/libcore/docker/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-FROM alpine:latest
-ENV CONFIG='https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)'
-ENV VERSION=v3.1.7
-WORKDIR /hiddify
-RUN apk add curl tar gzip libc6-compat # iptables ip6tables
-
-RUN echo "architecture: $(apk --print-arch)" && \
- case "$(apk --print-arch)" in \
- x86_64) ARCH=amd64 ;; \
- i386|x86) ARCH=386 ;; \
- aarch64) ARCH=arm64 ;; \
- armv7) ARCH=armv7 ;; \
- armv6|armhf) ARCH=armv6 ;; \
- armv5) ARCH=armv5 ;; \
- s390x) ARCH=s390x ;; \
- *) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
- esac && \
- echo "Downloading https://github.com/hiddify/hiddify-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz" && \
- curl -L -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
- tar -xzf hiddify-cli.tar.gz && rm hiddify-cli.tar.gz
-COPY hiddify.sh .
-RUN chmod +x hiddify.sh
-
-EXPOSE 12334
-EXPOSE 12335
-EXPOSE 16756
-EXPOSE 16450
-
-
-ENTRYPOINT [ "/hiddify/hiddify.sh" ]
diff --git a/libcore/docker/docker-compose.yml b/libcore/docker/docker-compose.yml
deleted file mode 100644
index c1275eb..0000000
--- a/libcore/docker/docker-compose.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-version: '3.8'
-
-services:
- hiddify:
- image: ghcr.io/hiddify/hiddify-core:latest
- network_mode: host
- environment:
- CONFIG: "https://github.com/hiddify/hiddify-next/raw/refs/heads/main/test.configs/warp"
- volumes:
- - ./hiddify.json:/hiddify/hiddify.json
- command: ["/opt/hiddify.sh"]
diff --git a/libcore/docker/hiddify.json b/libcore/docker/hiddify.json
deleted file mode 100644
index 29e01c2..0000000
--- a/libcore/docker/hiddify.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "region":"other",
- "service-mode": "proxy",
- "log-level": "info",
- "resolve-destination": true,
- "ipv6-mode": "prefer_ipv4",
- "remote-dns-address": "tcp://1.1.1.1",
- "remote-dns-domain-strategy": "",
- "direct-dns-address": "1.1.1.1",
- "direct-dns-domain-strategy": "",
- "mixed-port": 12334,
- "local-dns-port": 16450,
- "tun-implementation": "mixed",
- "mtu": 9000,
- "strict-route": false,
- "connection-test-url": "https://www.gstatic.com/generate_204",
- "url-test-interval": 600,
- "enable-clash-api": true,
- "clash-api-port": 16756,
- "bypass-lan": false,
- "allow-connection-from-lan": true,
- "enable-fake-dns": false,
- "enable-dns-routing": true,
- "independent-dns-cache": true,
- "enable-tls-fragment": false,
- "tls-fragment-size": "20-70",
- "tls-fragment-sleep": "10-30",
- "enable-tls-mixed-sni-case": false,
- "enable-tls-padding": false,
- "tls-padding-size": "15-30",
- "enable-mux": false,
- "mux-padding": false,
- "mux-max-streams": 4,
- "mux-protocol": "h2mux",
- "enable-warp": false,
- "warp-detour-mode": "outbound",
- "warp-license-key": "",
- "warp-clean-ip": "auto",
- "warp-port": 0,
- "warp-noise": "5-10",
- "warp-noise-delay": "20-200"
-}
\ No newline at end of file
diff --git a/libcore/docker/hiddify.sh b/libcore/docker/hiddify.sh
deleted file mode 100644
index 5b1f805..0000000
--- a/libcore/docker/hiddify.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# sysctl -w net.ipv4.ip_forward=1
-# sysctl -w net.ipv6.ip_forward=1
-
-# ip rule add fwmark 1 table 100 ;
-# ip route add local 0.0.0.0/0 dev lo table 100
-
-# # CREATE TABLE
-# iptables -t mangle -N hiddify
-
-# # RETURN LOCAL AND LANS
-# iptables -t mangle -A OUTPUT -j RETURN
-# iptables -t nat -A hiddify --dport 2334 -j RETURN
-
-# iptables -t mangle -A hiddify -d 10.0.0.0/8 -j RETURN
-# iptables -t mangle -A hiddify -d 127.0.0.0/8 -j RETURN
-# iptables -t mangle -A hiddify -d 169.254.0.0/16 -j RETURN
-# iptables -t mangle -A hiddify -d 172.16.0.0/12 -j RETURN
-# iptables -t mangle -A hiddify -d 192.168.50.0/16 -j RETURN
-# iptables -t mangle -A hiddify -d 192.168.9.0/16 -j RETURN
-# iptables -t mangle -A hiddify -d 224.0.0.0/4 -j RETURN
-# iptables -t mangle -A hiddify -d 240.0.0.0/4 -j RETURN
-
-# iptables -t mangle -A hiddify -p udp -j TPROXY --on-port 2334 --tproxy-mark 1
-# iptables -t mangle -A hiddify -p tcp -j TPROXY --on-port 2334 --tproxy-mark 1
-
-# # HIJACK ICMP (untested)
-# # iptables -t mangle -A hiddify -p icmp -j DNAT --to-destination 127.0.0.1
-
-# # REDIRECT
-# iptables -t mangle -A PREROUTING -j hiddify
-
-
-if [ -f "/hiddify/hiddify.json" ]; then
- /hiddify/HiddifyCli run --config "$CONFIG" -d /hiddify/hiddify.json
-else
- /hiddify/HiddifyCli run --config "$CONFIG"
-fi
-
-
diff --git a/libcore/extension/extension.go b/libcore/extension/extension.go
deleted file mode 100644
index 09dc4e7..0000000
--- a/libcore/extension/extension.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package extension
-
-import (
- "encoding/json"
-
- "github.com/hiddify/hiddify-core/config"
- "github.com/hiddify/hiddify-core/extension/ui"
- pb "github.com/hiddify/hiddify-core/hiddifyrpc"
- "github.com/hiddify/hiddify-core/v2/db"
- "github.com/jellydator/validation"
- "github.com/sagernet/sing-box/log"
- "github.com/sagernet/sing-box/option"
-)
-
-type Extension interface {
- GetUI() ui.Form
- SubmitData(button string, data map[string]string) error
- Close() error
- UpdateUI(form ui.Form) error
-
- BeforeAppConnect(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) error
-
- StoreData()
-
- init(id string)
- getQueue() chan *pb.ExtensionResponse
- getId() string
-}
-
-type Base[T any] struct {
- id string
- // responseStream grpc.ServerStreamingServer[pb.ExtensionResponse]
- queue chan *pb.ExtensionResponse
- Data T
-}
-
-// func (b *Base) mustEmbdedBaseExtension() {
-// }
-
-func (b *Base[T]) BeforeAppConnect(hiddifySettings *config.HiddifyOptions, singconfig *option.Options) error {
- return nil
-}
-
-func (b *Base[T]) StoreData() {
- table := db.GetTable[extensionData]()
- ed, err := table.Get(b.id)
- if err != nil {
- log.Warn("error: ", err)
- return
- }
- res, err := json.Marshal(b.Data)
- if err != nil {
- log.Warn("error: ", err)
- return
- }
- ed.JsonData = (res)
- table.UpdateInsert(ed)
-}
-
-func (b *Base[T]) init(id string) {
- b.id = id
- b.queue = make(chan *pb.ExtensionResponse, 1)
- table := db.GetTable[extensionData]()
- extdata, err := table.Get(b.id)
- if err != nil {
- log.Warn("error: ", err)
- return
- }
- if extdata == nil {
- log.Warn("extension data not found ", id)
- return
- }
- if extdata.JsonData != nil {
- var t T
- if err := json.Unmarshal(extdata.JsonData, &t); err != nil {
- log.Warn("error loading data of ", id, " : ", err)
- } else {
- b.Data = t
- }
- }
-}
-
-func (b *Base[T]) getQueue() chan *pb.ExtensionResponse {
- return b.queue
-}
-
-func (b *Base[T]) getId() string {
- return b.id
-}
-
-func (e *Base[T]) ShowMessage(title string, msg string) error {
- return e.ShowDialog(ui.Form{
- Title: title,
- Description: msg,
- Fields: [][]ui.FormField{
- {{
- Type: ui.FieldButton,
- Key: ui.ButtonDialogOk,
- Label: "Ok",
- }},
- },
- // Buttons: []string{ui.Button_Ok},
- })
-}
-
-func (p *Base[T]) UpdateUI(form ui.Form) error {
- p.queue <- &pb.ExtensionResponse{
- ExtensionId: p.id,
- Type: pb.ExtensionResponseType_UPDATE_UI,
- JsonUi: form.ToJSON(),
- }
- return nil
-}
-
-func (p *Base[T]) ShowDialog(form ui.Form) error {
- p.queue <- &pb.ExtensionResponse{
- ExtensionId: p.id,
- Type: pb.ExtensionResponseType_SHOW_DIALOG,
- JsonUi: form.ToJSON(),
- }
- // log.Printf("Updated UI for extension %s: %s", err, p.id)
- return nil
-}
-
-func (base *Base[T]) ValName(fieldPtr interface{}) string {
- val, err := validation.ErrorFieldName(&base.Data, fieldPtr)
- if err != nil {
- log.Warn(err)
- return ""
- }
- if val == "" {
- log.Warn("Field not found")
- return ""
- }
- return val
-}
-
-type ExtensionFactory struct {
- Id string
- Title string
- Description string
- Builder func() Extension
-}
diff --git a/libcore/extension/extension_host.go b/libcore/extension/extension_host.go
deleted file mode 100644
index c66e07f..0000000
--- a/libcore/extension/extension_host.go
+++ /dev/null
@@ -1,146 +0,0 @@
-package extension
-
-import (
- "context"
- "fmt"
- "log"
-
- pb "github.com/hiddify/hiddify-core/hiddifyrpc"
- "github.com/hiddify/hiddify-core/v2/db"
- "google.golang.org/grpc"
-)
-
-type ExtensionHostService struct {
- pb.UnimplementedExtensionHostServiceServer
-}
-
-func (ExtensionHostService) ListExtensions(ctx context.Context, empty *pb.Empty) (*pb.ExtensionList, error) {
- extensionList := &pb.ExtensionList{
- Extensions: make([]*pb.Extension, 0),
- }
- allext, err := db.GetTable[extensionData]().All()
- if err != nil {
- return nil, err
- }
- for _, dbext := range allext {
- if ext, ok := allExtensionsMap[dbext.Id]; ok {
- extensionList.Extensions = append(extensionList.Extensions, &pb.Extension{
- Id: ext.Id,
- Title: ext.Title,
- Description: ext.Description,
- Enable: dbext.Enable,
- })
- }
- }
-
- return extensionList, nil
-}
-
-func getExtension(id string) (*Extension, error) {
- if !isEnable(id) {
- return nil, fmt.Errorf("Extension with ID %s is not enabled", id)
- }
- if extension, ok := enabledExtensionsMap[id]; ok {
- return extension, nil
- }
- return nil, fmt.Errorf("Extension with ID %s not found", id)
-}
-
-func (e ExtensionHostService) Connect(req *pb.ExtensionRequest, stream grpc.ServerStreamingServer[pb.ExtensionResponse]) error {
- extension, err := getExtension(req.GetExtensionId())
- if err != nil {
- log.Printf("Error connecting stream for extension %s: %v", req.GetExtensionId(), err)
- return err
- }
-
- log.Printf("Connecting stream for extension %s", req.GetExtensionId())
- log.Printf("Extension data: %+v", extension)
-
- if err := (*extension).UpdateUI((*extension).GetUI()); err != nil {
- log.Printf("Error updating UI for extension %s: %v", req.GetExtensionId(), err)
- }
-
- for {
- select {
- case <-stream.Context().Done():
- return nil
- case info := <-(*extension).getQueue():
- stream.Send(info)
- if info.GetType() == pb.ExtensionResponseType_END {
- return nil
- }
- }
- }
-}
-
-func (e ExtensionHostService) SubmitForm(ctx context.Context, req *pb.SendExtensionDataRequest) (*pb.ExtensionActionResult, error) {
- extension, err := getExtension(req.GetExtensionId())
- if err != nil {
- log.Println(err)
- return &pb.ExtensionActionResult{
- ExtensionId: req.ExtensionId,
- Code: pb.ResponseCode_FAILED,
- Message: err.Error(),
- }, err
- }
- (*extension).SubmitData(req.Button, req.GetData())
-
- return &pb.ExtensionActionResult{
- ExtensionId: req.ExtensionId,
- Code: pb.ResponseCode_OK,
- Message: "Success",
- }, nil
-}
-
-func (e ExtensionHostService) Close(ctx context.Context, req *pb.ExtensionRequest) (*pb.ExtensionActionResult, error) {
- extension, err := getExtension(req.GetExtensionId())
- if err != nil {
- log.Println(err)
- return &pb.ExtensionActionResult{
- ExtensionId: req.ExtensionId,
- Code: pb.ResponseCode_FAILED,
- Message: err.Error(),
- }, err
- }
- (*extension).Close()
- (*extension).StoreData()
- return &pb.ExtensionActionResult{
- ExtensionId: req.ExtensionId,
- Code: pb.ResponseCode_OK,
- Message: "Success",
- }, nil
-}
-
-func (e ExtensionHostService) EditExtension(ctx context.Context, req *pb.EditExtensionRequest) (*pb.ExtensionActionResult, error) {
- if !req.Enable {
- extension, _ := getExtension(req.GetExtensionId())
- if extension != nil {
- (*extension).Close()
- (*extension).StoreData()
- }
- delete(enabledExtensionsMap, req.GetExtensionId())
- }
- table := db.GetTable[extensionData]()
- data, err := table.Get(req.GetExtensionId())
- if err != nil {
- return nil, err
- }
- data.Enable = req.Enable
- table.UpdateInsert(data)
-
- if req.Enable {
- loadExtension(allExtensionsMap[req.GetExtensionId()])
- }
-
- return &pb.ExtensionActionResult{
- ExtensionId: req.ExtensionId,
- Code: pb.ResponseCode_OK,
- Message: "Success",
- }, nil
-}
-
-type extensionData struct {
- Id string `json:"id"`
- Enable bool `json:"enable"`
- JsonData []byte
-}
diff --git a/libcore/extension/html/a.js b/libcore/extension/html/a.js
deleted file mode 100644
index c161e8c..0000000
--- a/libcore/extension/html/a.js
+++ /dev/null
@@ -1,12 +0,0 @@
-
-import * as a from "./rpc/extension_grpc_web_pb.js";
-const client = new ExtensionHostServiceClient('http://localhost:8080');
-const request = new GetHelloRequest();
-export const getHello = (name) => {
- request.setName(name)
-client.getHello(request, {}, (err, response) => {
- console.log(request.getName());
- console.log(response.toObject());
- });
-}
-getHello("D")
\ No newline at end of file
diff --git a/libcore/extension/html/index.html b/libcore/extension/html/index.html
deleted file mode 100644
index d201fb9..0000000
--- a/libcore/extension/html/index.html
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
- Hiddify Extensions
-
-
-
-
-
-
-
-
-
-
-
-
Connection Settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Connecting...
-
-
-
-
-
- Extension List
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Extension List
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libcore/extension/html/rpc.js b/libcore/extension/html/rpc.js
deleted file mode 100644
index 6d13d8b..0000000
--- a/libcore/extension/html/rpc.js
+++ /dev/null
@@ -1,10048 +0,0 @@
-(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.HelloRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.HelloRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.HelloRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-name: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.HelloRequest}
- */
-proto.hiddifyrpc.HelloRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.HelloRequest;
- return proto.hiddifyrpc.HelloRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.HelloRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.HelloRequest}
- */
-proto.hiddifyrpc.HelloRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setName(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.HelloRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.HelloRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.HelloRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getName();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string name = 1;
- * @return {string}
- */
-proto.hiddifyrpc.HelloRequest.prototype.getName = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.HelloRequest} returns this
- */
-proto.hiddifyrpc.HelloRequest.prototype.setName = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.HelloResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.HelloResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.HelloResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-message: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.HelloResponse}
- */
-proto.hiddifyrpc.HelloResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.HelloResponse;
- return proto.hiddifyrpc.HelloResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.HelloResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.HelloResponse}
- */
-proto.hiddifyrpc.HelloResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.HelloResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.HelloResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.HelloResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string message = 1;
- * @return {string}
- */
-proto.hiddifyrpc.HelloResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.HelloResponse} returns this
- */
-proto.hiddifyrpc.HelloResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Empty.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Empty.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Empty} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Empty.toObject = function(includeInstance, msg) {
- var f, obj = {
-
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Empty}
- */
-proto.hiddifyrpc.Empty.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Empty;
- return proto.hiddifyrpc.Empty.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Empty} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Empty}
- */
-proto.hiddifyrpc.Empty.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Empty.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Empty.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Empty} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Empty.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
-};
-
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.ResponseCode = {
- OK: 0,
- FAILED: 1
-};
-
-goog.object.extend(exports, proto.hiddifyrpc);
-
-},{"google-protobuf":12}],2:[function(require,module,exports){
-const hiddify = require("./hiddify_grpc_web_pb.js");
-const extension = require("./extension_grpc_web_pb.js");
-
-const grpcServerAddress = '/';
-const extensionClient = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null);
-const hiddifyClient = new hiddify.CorePromiseClient(grpcServerAddress, null, null);
-
-module.exports = { extensionClient ,hiddifyClient};
-},{"./extension_grpc_web_pb.js":7,"./hiddify_grpc_web_pb.js":10}],3:[function(require,module,exports){
-const { hiddifyClient } = require('./client.js');
-const hiddify = require("./hiddify_grpc_web_pb.js");
-
-function openConnectionPage() {
-
- $("#extension-list-container").show();
- $("#extension-page-container").hide();
- $("#connection-page").show();
- connect();
- $("#connect-button").click(async () => {
- const hsetting_request = new hiddify.ChangeHiddifySettingsRequest();
- hsetting_request.setHiddifySettingsJson($("#hiddify-settings").val());
- try{
- const hres=await hiddifyClient.changeHiddifySettings(hsetting_request, {});
- }catch(err){
- $("#hiddify-settings").val("")
- console.log(err)
- }
-
- const parse_request = new hiddify.ParseRequest();
- parse_request.setContent($("#config-content").val());
- try{
- const pres=await hiddifyClient.parse(parse_request, {});
- if (pres.getResponseCode() !== hiddify.ResponseCode.OK){
- alert(pres.getMessage());
- return
- }
- $("#config-content").val(pres.getContent());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
-
- const request = new hiddify.StartRequest();
-
- request.setConfigContent($("#config-content").val());
- request.setEnableRawConfig(false);
- try{
- const res=await hiddifyClient.start(request, {});
- console.log(res.getCoreState(),res.getMessage())
- handleCoreStatus(res.getCoreState());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
-
-
- })
-
- $("#disconnect-button").click(async () => {
- const request = new hiddify.Empty();
- try{
- const res=await hiddifyClient.stop(request, {});
- console.log(res.getCoreState(),res.getMessage())
- handleCoreStatus(res.getCoreState());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
- })
-}
-
-
-function connect(){
- const request = new hiddify.Empty();
- const stream = hiddifyClient.coreInfoListener(request, {});
- stream.on('data', (response) => {
- console.log('Receving ',response);
- handleCoreStatus(response);
- });
-
- stream.on('error', (err) => {
- console.error('Error opening extension page:', err);
- // openExtensionPage(extensionId);
- });
-
- stream.on('end', () => {
- console.log('Stream ended');
- setTimeout(connect, 1000);
-
- });
-}
-
-
-function handleCoreStatus(status){
- if (status == hiddify.CoreState.STOPPED){
- $("#connection-before-connect").show();
- $("#connection-connecting").hide();
- }else{
- $("#connection-before-connect").hide();
- $("#connection-connecting").show();
- if (status == hiddify.CoreState.STARTING){
- $("#connection-status").text("Starting");
- $("#connection-status").css("color", "yellow");
- }else if (status == hiddify.CoreState.STOPPING){
- $("#connection-status").text("Stopping");
- $("#connection-status").css("color", "red");
- }else if (status == hiddify.CoreState.STARTED){
- $("#connection-status").text("Connected");
- $("#connection-status").css("color", "green");
- }
- }
-}
-
-
-module.exports = { openConnectionPage };
-},{"./client.js":2,"./hiddify_grpc_web_pb.js":10}],4:[function(require,module,exports){
-const { listExtensions } = require('./extensionList.js');
-const { openConnectionPage } = require('./connectionPage.js');
-window.onload = () => {
- listExtensions();
- openConnectionPage();
-};
-
-
-
-},{"./connectionPage.js":3,"./extensionList.js":5}],5:[function(require,module,exports){
-
-const { extensionClient } = require('./client.js');
-const extension = require("./extension_grpc_web_pb.js");
-async function listExtensions() {
- $("#extension-list-container").show();
- $("#extension-page-container").hide();
- $("#connection-page").show();
-
- try {
- const extensionListContainer = document.getElementById('extension-list');
- extensionListContainer.innerHTML = ''; // Clear previous entries
- const response = await extensionClient.listExtensions(new extension.Empty(), {});
-
- const extensionList = response.getExtensionsList();
- extensionList.forEach(ext => {
- const listItem = createExtensionListItem(ext);
- extensionListContainer.appendChild(listItem);
- });
- } catch (err) {
- console.error('Error listing extensions:', err);
- }
-}
-
-function createExtensionListItem(ext) {
- const listItem = document.createElement('li');
- listItem.className = 'list-group-item d-flex justify-content-between align-items-center';
- listItem.setAttribute('data-extension-id', ext.getId());
-
- const contentDiv = document.createElement('div');
-
- const titleElement = document.createElement('span');
- titleElement.innerHTML = `${ext.getTitle()}`;
- contentDiv.appendChild(titleElement);
-
- const descriptionElement = document.createElement('p');
- descriptionElement.className = 'mb-0';
- descriptionElement.textContent = ext.getDescription();
- contentDiv.appendChild(descriptionElement);
- contentDiv.style.width="100%";
- listItem.appendChild(contentDiv);
-
- const switchDiv = createSwitchElement(ext);
- listItem.appendChild(switchDiv);
- const {openExtensionPage} = require('./extensionPage.js');
-
- contentDiv.addEventListener('click', () =>{
- if (!ext.getEnable() ){
- alert("Extension is not enabled")
- return
- }
- openExtensionPage(ext.getId())
- });
-
- return listItem;
-}
-
-function createSwitchElement(ext) {
- const switchDiv = document.createElement('div');
- switchDiv.className = 'form-check form-switch';
-
- const switchButton = document.createElement('input');
- switchButton.type = 'checkbox';
- switchButton.className = 'form-check-input';
- switchButton.checked = ext.getEnable();
- switchButton.addEventListener('change', (e) => {
-
- toggleExtension(ext.getId(), switchButton.checked)
- });
-
- switchDiv.appendChild(switchButton);
- return switchDiv;
-}
-
-async function toggleExtension(extensionId, enable) {
- const request = new extension.EditExtensionRequest();
- request.setExtensionId(extensionId);
- request.setEnable(enable);
-
- try {
- await extensionClient.editExtension(request, {});
- console.log(`Extension ${extensionId} updated to ${enable ? 'enabled' : 'disabled'}`);
- } catch (err) {
- console.error('Error updating extension status:', err);
- }
- listExtensions();
-}
-
-
-
-module.exports = { listExtensions };
-},{"./client.js":2,"./extensionPage.js":6,"./extension_grpc_web_pb.js":7}],6:[function(require,module,exports){
-const { extensionClient } = require('./client.js');
-const extension = require("./extension_grpc_web_pb.js");
-
-const { renderForm } = require('./formRenderer.js');
-const { listExtensions } = require('./extensionList.js');
-var currentExtensionId = undefined;
-function openExtensionPage(extensionId) {
- currentExtensionId = extensionId;
- $("#extension-list-container").hide();
- $("#extension-page-container").show();
- $("#connection-page").hide();
- connect()
-}
-
-function connect() {
- const request = new extension.ExtensionRequest();
- request.setExtensionId(currentExtensionId);
-
- const stream = extensionClient.connect(request, {});
-
- stream.on('data', (response) => {
- console.log('Receiving ', response);
- if (response.getExtensionId() === currentExtensionId) {
- ui = JSON.parse(response.getJsonUi())
- if (response.getType() == proto.hiddifyrpc.ExtensionResponseType.SHOW_DIALOG) {
- renderForm(ui, "dialog", handleSubmitButtonClick, undefined);
- } else {
- renderForm(ui, "", handleSubmitButtonClick, handleStopButtonClick);
- }
-
-
- }
- });
-
- stream.on('error', (err) => {
- console.error('Error opening extension page:', err);
- // openExtensionPage(extensionId);
- });
-
- stream.on('end', () => {
- console.log('Stream ended');
- setTimeout(connect, 1000);
-
- });
-}
-
-async function handleSubmitButtonClick(event, button) {
- event.preventDefault();
- bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
- const request = new extension.SendExtensionDataRequest();
- request.setButton(button);
- if (event.type != 'hidden.bs.modal') {
- const formData = new FormData(event.target.closest('form'));
- const datamap = request.getDataMap()
- formData.forEach((value, key) => {
- datamap.set(key, value);
- });
- }
- request.setExtensionId(currentExtensionId);
-
- try {
- await extensionClient.submitForm(request, {});
- console.log('Form submitted successfully.');
- } catch (err) {
- console.error('Error submitting form:', err);
- }
-}
-
-
-async function handleStopButtonClick(event) {
- event.preventDefault();
- const request = new extension.ExtensionRequest();
- request.setExtensionId(currentExtensionId);
- bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
- try {
- await extensionClient.close(request, {});
- console.log('Extension stopped successfully.');
- currentExtensionId = undefined;
- listExtensions(); // Return to the extension list
- } catch (err) {
- console.error('Error stopping extension:', err);
- }
-}
-
-
-
-module.exports = { openExtensionPage };
-},{"./client.js":2,"./extensionList.js":5,"./extension_grpc_web_pb.js":7,"./formRenderer.js":9}],7:[function(require,module,exports){
-/**
- * @fileoverview gRPC-Web generated client stub for hiddifyrpc
- * @enhanceable
- * @public
- */
-
-// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
-// versions:
-// protoc-gen-grpc-web v1.5.0
-// protoc v5.28.0
-// source: extension.proto
-
-
-/* eslint-disable */
-// @ts-nocheck
-
-
-
-const grpc = {};
-grpc.web = require('grpc-web');
-
-
-var base_pb = require('./base_pb.js')
-const proto = {};
-proto.hiddifyrpc = require('./extension_pb.js');
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.ExtensionHostServiceClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.ExtensionList>}
- */
-const methodDescriptor_ExtensionHostService_ListExtensions = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.ExtensionList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionList)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.listExtensions =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_ListExtensions,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.listExtensions =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_ListExtensions);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionResponse>}
- */
-const methodDescriptor_ExtensionHostService_Connect = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/Connect',
- grpc.web.MethodType.SERVER_STREAMING,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionResponse,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.connect =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Connect',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Connect);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.connect =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Connect',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Connect);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.EditExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_EditExtension = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.EditExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.editExtension =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_EditExtension,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.editExtension =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_EditExtension);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SendExtensionDataRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_SubmitForm = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SendExtensionDataRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.submitForm =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_SubmitForm,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.submitForm =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_SubmitForm);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_Close = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/Close',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.close =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Close',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Close,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.close =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Close',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Close);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_GetUI = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/GetUI',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.getUI =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/GetUI',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_GetUI,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.getUI =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/GetUI',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_GetUI);
-};
-
-
-module.exports = proto.hiddifyrpc;
-
-
-},{"./base_pb.js":1,"./extension_pb.js":8,"grpc-web":13}],8:[function(require,module,exports){
-// source: extension.proto
-/**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
-// GENERATED CODE -- DO NOT EDIT!
-/* eslint-disable */
-// @ts-nocheck
-
-var jspb = require('google-protobuf');
-var goog = jspb;
-var global =
- (typeof globalThis !== 'undefined' && globalThis) ||
- (typeof window !== 'undefined' && window) ||
- (typeof global !== 'undefined' && global) ||
- (typeof self !== 'undefined' && self) ||
- (function () { return this; }).call(null) ||
- Function('return this')();
-
-var base_pb = require('./base_pb.js');
-goog.object.extend(proto, base_pb);
-goog.exportSymbol('proto.hiddifyrpc.EditExtensionRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.Extension', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionActionResult', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionList', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionResponseType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SendExtensionDataRequest', null, global);
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionActionResult = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionActionResult, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionActionResult.displayName = 'proto.hiddifyrpc.ExtensionActionResult';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionList = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.ExtensionList.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionList, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionList.displayName = 'proto.hiddifyrpc.ExtensionList';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.EditExtensionRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.EditExtensionRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.EditExtensionRequest.displayName = 'proto.hiddifyrpc.EditExtensionRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.Extension = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.Extension, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.Extension.displayName = 'proto.hiddifyrpc.Extension';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionRequest.displayName = 'proto.hiddifyrpc.ExtensionRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SendExtensionDataRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SendExtensionDataRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SendExtensionDataRequest.displayName = 'proto.hiddifyrpc.SendExtensionDataRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionResponse.displayName = 'proto.hiddifyrpc.ExtensionResponse';
-}
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionActionResult.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionActionResult} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionActionResult.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-code: jspb.Message.getFieldWithDefault(msg, 2, 0),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionActionResult}
- */
-proto.hiddifyrpc.ExtensionActionResult.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionActionResult;
- return proto.hiddifyrpc.ExtensionActionResult.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionActionResult} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionActionResult}
- */
-proto.hiddifyrpc.ExtensionActionResult.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum());
- msg.setCode(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionActionResult.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionActionResult} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionActionResult.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getCode();
- if (f !== 0.0) {
- writer.writeEnum(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional ResponseCode code = 2;
- * @return {!proto.hiddifyrpc.ResponseCode}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getCode = function() {
- return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ResponseCode} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setCode = function(value) {
- return jspb.Message.setProto3EnumField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.ExtensionList.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionList.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionList.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionList} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionList.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionsList: jspb.Message.toObjectList(msg.getExtensionsList(),
- proto.hiddifyrpc.Extension.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionList}
- */
-proto.hiddifyrpc.ExtensionList.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionList;
- return proto.hiddifyrpc.ExtensionList.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionList} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionList}
- */
-proto.hiddifyrpc.ExtensionList.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.Extension;
- reader.readMessage(value,proto.hiddifyrpc.Extension.deserializeBinaryFromReader);
- msg.addExtensions(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionList.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionList.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionList} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionList.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 1,
- f,
- proto.hiddifyrpc.Extension.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * repeated Extension extensions = 1;
- * @return {!Array}
- */
-proto.hiddifyrpc.ExtensionList.prototype.getExtensionsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.Extension, 1));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.ExtensionList} returns this
-*/
-proto.hiddifyrpc.ExtensionList.prototype.setExtensionsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Extension=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.ExtensionList.prototype.addExtensions = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.hiddifyrpc.Extension, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.ExtensionList} returns this
- */
-proto.hiddifyrpc.ExtensionList.prototype.clearExtensionsList = function() {
- return this.setExtensionsList([]);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.EditExtensionRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.EditExtensionRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.EditExtensionRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-enable: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.EditExtensionRequest}
- */
-proto.hiddifyrpc.EditExtensionRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.EditExtensionRequest;
- return proto.hiddifyrpc.EditExtensionRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.EditExtensionRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.EditExtensionRequest}
- */
-proto.hiddifyrpc.EditExtensionRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnable(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.EditExtensionRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.EditExtensionRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.EditExtensionRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getEnable();
- if (f) {
- writer.writeBool(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.EditExtensionRequest} returns this
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional bool enable = 2;
- * @return {boolean}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.getEnable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.EditExtensionRequest} returns this
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.setEnable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Extension.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Extension.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Extension} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Extension.toObject = function(includeInstance, msg) {
- var f, obj = {
-id: jspb.Message.getFieldWithDefault(msg, 1, ""),
-title: jspb.Message.getFieldWithDefault(msg, 2, ""),
-description: jspb.Message.getFieldWithDefault(msg, 3, ""),
-enable: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.Extension.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Extension;
- return proto.hiddifyrpc.Extension.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Extension} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.Extension.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setTitle(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setDescription(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnable(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Extension.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Extension.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Extension} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Extension.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getTitle();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDescription();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getEnable();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
-};
-
-
-/**
- * optional string id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string title = 2;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getTitle = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setTitle = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string description = 3;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getDescription = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setDescription = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * optional bool enable = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.Extension.prototype.getEnable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setEnable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, undefined) : []
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionRequest}
- */
-proto.hiddifyrpc.ExtensionRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionRequest;
- return proto.hiddifyrpc.ExtensionRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionRequest}
- */
-proto.hiddifyrpc.ExtensionRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = msg.getDataMap();
- reader.readMessage(value, function(message, reader) {
- jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
- });
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getDataMap(true);
- if (f && f.getLength() > 0) {
- f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionRequest} returns this
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * map data = 2;
- * @param {boolean=} opt_noLazyCreate Do not create the map if
- * empty, instead returning `undefined`
- * @return {!jspb.Map}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.getDataMap = function(opt_noLazyCreate) {
- return /** @type {!jspb.Map} */ (
- jspb.Message.getMapField(this, 2, opt_noLazyCreate,
- null));
-};
-
-
-/**
- * Clears values from the map. The map will be non-null.
- * @return {!proto.hiddifyrpc.ExtensionRequest} returns this
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.clearDataMap = function() {
- this.getDataMap().clear();
- return this;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SendExtensionDataRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SendExtensionDataRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-button: jspb.Message.getFieldWithDefault(msg, 2, ""),
-dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, undefined) : []
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SendExtensionDataRequest;
- return proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setButton(value);
- break;
- case 3:
- var value = msg.getDataMap();
- reader.readMessage(value, function(message, reader) {
- jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
- });
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SendExtensionDataRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SendExtensionDataRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getButton();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDataMap(true);
- if (f && f.getLength() > 0) {
- f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string button = 2;
- * @return {string}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getButton = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.setButton = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * map data = 3;
- * @param {boolean=} opt_noLazyCreate Do not create the map if
- * empty, instead returning `undefined`
- * @return {!jspb.Map}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getDataMap = function(opt_noLazyCreate) {
- return /** @type {!jspb.Map} */ (
- jspb.Message.getMapField(this, 3, opt_noLazyCreate,
- null));
-};
-
-
-/**
- * Clears values from the map. The map will be non-null.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.clearDataMap = function() {
- this.getDataMap().clear();
- return this;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-type: jspb.Message.getFieldWithDefault(msg, 1, 0),
-extensionId: jspb.Message.getFieldWithDefault(msg, 2, ""),
-jsonUi: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionResponse}
- */
-proto.hiddifyrpc.ExtensionResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionResponse;
- return proto.hiddifyrpc.ExtensionResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionResponse}
- */
-proto.hiddifyrpc.ExtensionResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.ExtensionResponseType} */ (reader.readEnum());
- msg.setType(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setJsonUi(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getType();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getJsonUi();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional ExtensionResponseType type = 1;
- * @return {!proto.hiddifyrpc.ExtensionResponseType}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getType = function() {
- return /** @type {!proto.hiddifyrpc.ExtensionResponseType} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionResponseType} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setType = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional string extension_id = 2;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string json_ui = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getJsonUi = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setJsonUi = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.ExtensionResponseType = {
- NOTHING: 0,
- UPDATE_UI: 1,
- SHOW_DIALOG: 2,
- END: 3
-};
-
-goog.object.extend(exports, proto.hiddifyrpc);
-
-},{"./base_pb.js":1,"google-protobuf":12}],9:[function(require,module,exports){
-
-const ansi_up = new AnsiUp({
- escape_html: false,
-
-});
-
-
-function renderForm(json, dialog, submitAction, stopAction) {
- const container = document.getElementById(`extension-page-container${dialog}`);
- const formId = `dynamicForm${json.id}${dialog}`;
-
- const existingForm = document.getElementById(formId);
- if (existingForm) {
- existingForm.remove();
- }
- const form = document.createElement('form');
- container.appendChild(form);
- form.id = formId;
-
- if (dialog === "dialog") {
- document.getElementById("modalLabel").textContent = json.title;
- } else {
- const titleElement = createTitleElement(json);
- const stopBtn = document.createElement('button');
- stopBtn.type = 'button';
- stopBtn.className = 'btn btn-danger';
- stopBtn.textContent = 'Close';
- stopBtn.addEventListener('click', stopAction);
- form.appendChild(stopBtn);
- form.appendChild(titleElement);
- }
- addElementsToForm(form, json,submitAction);
-
- if (dialog === "dialog") {
- document.getElementById("modal-footer").innerHTML = '';
- // if ($(form.lastChild).find("button").length > 0) {
-
- // document.getElementById("modal-footer").appendChild(form.lastChild);
-
- // }
- const extensionDialog = document.getElementById("extension-dialog");
- const dialog = bootstrap.Modal.getOrCreateInstance(extensionDialog);
- dialog.show();
- extensionDialog.addEventListener("hidden.bs.modal", (e)=>submitAction(e,"CloseDialog"));
- }
-
-}
-
-function addElementsToForm(form, json,submitAction) {
-
-
-
- const description = document.createElement('p');
- description.textContent = json.description;
- form.appendChild(description);
- if (json.fields) {
- json.fields.forEach(field => {
- div=document.createElement("div")
- div.classList.add("row")
- form.appendChild(div)
- for (let i = 0; i < field.length; i++) {
- const formGroup = createFormGroup(field[i], submitAction);
- formGroup.classList.add("col")
- div.appendChild(formGroup);
- }
- });
- }
-
- return form;
-}
-
-function createTitleElement(json) {
- const title = document.createElement('h1');
- title.textContent = json.title;
- return title;
-}
-
-function createFormGroup(field, submitAction) {
- const formGroup = document.createElement('div');
- formGroup.classList.add('mb-3');
- if (field.type == "Button") {
- const button = document.createElement('button');
- button.textContent = field.label;
- button.name=field.key
- button.classList.add('btn');
- if (field.key == "Submit") {
- button.classList.add('btn-primary');
- } else if (field.key == "Cancel") {
- button.classList.add('btn-secondary');
- }else{
- button.classList.add('btn', 'btn-outline-secondary');
- }
-
- button.addEventListener('click', (e) => submitAction(e,field.key));
- formGroup.appendChild(button);
- } else {
- if (field.label && !field.labelHidden) {
- const label = document.createElement('label');
- label.textContent = field.label;
- label.setAttribute('for', field.key);
- formGroup.appendChild(label);
- }
-
- const input = createInputElement(field);
- formGroup.appendChild(input);
- }
- return formGroup;
-}
-
-function createInputElement(field) {
- let input;
-
- switch (field.type) {
- case "Console":
- input = document.createElement('pre');
- input.innerHTML = ansi_up.ansi_to_html(field.value || field.placeholder || '');
- input.style.maxHeight = field.lines * 20 + 'px';
- break;
- case "TextArea":
- input = document.createElement('textarea');
- input.rows = field.lines || 3;
- input.textContent = field.value || '';
- break;
-
- case "Checkbox":
- case "RadioButton":
- input = createCheckboxOrRadioGroup(field);
- break;
-
- case "Switch":
- input = createSwitchElement(field);
- break;
-
- case "Select":
- input = document.createElement('select');
- field.items.forEach(item => {
- const option = document.createElement('option');
- option.value = item.value;
- option.text = item.label;
- input.appendChild(option);
- });
- break;
-
- default:
- input = document.createElement('input');
- input.type = field.type.toLowerCase();
- input.value = field.value;
- break;
- }
-
- input.id = field.key;
- input.name = field.key;
- if (field.readOnly) input.readOnly = true;
- if (field.type == "Checkbox" || field.type == "RadioButton" || field.type == "Switch") {
-
- } else {
- if (field.required) input.required = true;
- input.classList.add('form-control');
- if (field.placeholder) input.placeholder = field.placeholder;
- }
- return input;
-}
-
-function createCheckboxOrRadioGroup(field) {
- const wrapper = document.createDocumentFragment();
-
- field.items.forEach(item => {
- const inputWrapper = document.createElement('div');
- inputWrapper.classList.add('form-check');
-
- const input = document.createElement('input');
- input.type = field.type === "Checkbox" ? 'checkbox' : 'radio';
- input.classList.add('form-check-input');
- input.id = `${field.key}_${item.value}`;
- input.name = field.key; // Grouping by name for radio buttons
- input.value = item.value;
- input.checked = field.value === item.value;
-
- const itemLabel = document.createElement('label');
- itemLabel.classList.add('form-check-label');
- itemLabel.setAttribute('for', input.id);
- itemLabel.textContent = item.label;
-
- inputWrapper.appendChild(input);
- inputWrapper.appendChild(itemLabel);
- wrapper.appendChild(inputWrapper);
- });
-
- return wrapper;
-}
-
-function createSwitchElement(field) {
- const switchWrapper = document.createElement('div');
- switchWrapper.classList.add('form-check', 'form-switch');
-
- const input = document.createElement('input');
- input.type = 'checkbox';
- input.classList.add('form-check-input');
- input.setAttribute('role', 'switch');
- input.id = field.key;
- input.checked = field.value === "true";
-
- const label = document.createElement('label');
- label.classList.add('form-check-label');
- label.setAttribute('for', field.key);
- label.textContent = field.label;
-
- switchWrapper.appendChild(input);
- switchWrapper.appendChild(label);
-
- return switchWrapper;
-}
-
-function createButtonGroup(json, submitAction, cancelAction) {
- const buttonGroup = document.createElement('div');
- buttonGroup.classList.add('btn-group');
- json.buttons.forEach(buttonText => {
- const btn = document.createElement('button');
- btn.classList.add('btn', "btn-default");
- buttonGroup.appendChild(btn);
- btn.textContent = buttonText
- if (buttonText == "Cancel") {
- btn.classList.add('btn-secondary');
- btn.addEventListener('click', cancelAction);
- } else {
- if (buttonText == "Submit" || buttonText == "Ok")
- btn.classList.add('btn-primary');
- btn.addEventListener('click', submitAction);
- }
-
- })
-
-
-
- return buttonGroup;
-}
-
-
-module.exports = { renderForm };
-},{}],10:[function(require,module,exports){
-/**
- * @fileoverview gRPC-Web generated client stub for hiddifyrpc
- * @enhanceable
- * @public
- */
-
-// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
-// versions:
-// protoc-gen-grpc-web v1.5.0
-// protoc v5.28.0
-// source: hiddify.proto
-
-
-/* eslint-disable */
-// @ts-nocheck
-
-
-
-const grpc = {};
-grpc.web = require('grpc-web');
-
-
-var base_pb = require('./base_pb.js')
-const proto = {};
-proto.hiddifyrpc = require('./hiddify_pb.js');
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.HelloClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.HelloPromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.HelloRequest,
- * !proto.hiddifyrpc.HelloResponse>}
- */
-const methodDescriptor_Hello_SayHello = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Hello/SayHello',
- grpc.web.MethodType.UNARY,
- base_pb.HelloRequest,
- base_pb.HelloResponse,
- /**
- * @param {!proto.hiddifyrpc.HelloRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- base_pb.HelloResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.HelloRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.HelloResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.HelloClient.prototype.sayHello =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Hello/SayHello',
- request,
- metadata || {},
- methodDescriptor_Hello_SayHello,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.HelloRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.HelloPromiseClient.prototype.sayHello =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Hello/SayHello',
- request,
- metadata || {},
- methodDescriptor_Hello_SayHello);
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.CoreClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.CorePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Start = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Start',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.start =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Start',
- request,
- metadata || {},
- methodDescriptor_Core_Start,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.start =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Start',
- request,
- metadata || {},
- methodDescriptor_Core_Start);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_CoreInfoListener = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/CoreInfoListener',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.coreInfoListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/CoreInfoListener',
- request,
- metadata || {},
- methodDescriptor_Core_CoreInfoListener);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.coreInfoListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/CoreInfoListener',
- request,
- metadata || {},
- methodDescriptor_Core_CoreInfoListener);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.OutboundGroupList>}
- */
-const methodDescriptor_Core_OutboundsInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/OutboundsInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.OutboundGroupList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.OutboundGroupList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.outboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/OutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_OutboundsInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.outboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/OutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_OutboundsInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.OutboundGroupList>}
- */
-const methodDescriptor_Core_MainOutboundsInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/MainOutboundsInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.OutboundGroupList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.OutboundGroupList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.mainOutboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/MainOutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_MainOutboundsInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.mainOutboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/MainOutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_MainOutboundsInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.SystemInfo>}
- */
-const methodDescriptor_Core_GetSystemInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GetSystemInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.SystemInfo,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.SystemInfo.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.getSystemInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemInfo',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.getSystemInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemInfo',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SetupRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_Setup = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Setup',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SetupRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SetupRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SetupRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.setup =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Setup',
- request,
- metadata || {},
- methodDescriptor_Core_Setup,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SetupRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.setup =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Setup',
- request,
- metadata || {},
- methodDescriptor_Core_Setup);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ParseRequest,
- * !proto.hiddifyrpc.ParseResponse>}
- */
-const methodDescriptor_Core_Parse = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Parse',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ParseRequest,
- proto.hiddifyrpc.ParseResponse,
- /**
- * @param {!proto.hiddifyrpc.ParseRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ParseResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ParseRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ParseResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.parse =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Parse',
- request,
- metadata || {},
- methodDescriptor_Core_Parse,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ParseRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.parse =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Parse',
- request,
- metadata || {},
- methodDescriptor_Core_Parse);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ChangeHiddifySettingsRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_ChangeHiddifySettings = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ChangeHiddifySettingsRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.changeHiddifySettings =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- request,
- metadata || {},
- methodDescriptor_Core_ChangeHiddifySettings,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.changeHiddifySettings =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- request,
- metadata || {},
- methodDescriptor_Core_ChangeHiddifySettings);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_StartService = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/StartService',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.startService =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/StartService',
- request,
- metadata || {},
- methodDescriptor_Core_StartService,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.startService =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/StartService',
- request,
- metadata || {},
- methodDescriptor_Core_StartService);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Stop = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Stop',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.stop =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Stop',
- request,
- metadata || {},
- methodDescriptor_Core_Stop,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.stop =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Stop',
- request,
- metadata || {},
- methodDescriptor_Core_Stop);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Restart = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Restart',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.restart =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Restart',
- request,
- metadata || {},
- methodDescriptor_Core_Restart,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.restart =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Restart',
- request,
- metadata || {},
- methodDescriptor_Core_Restart);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SelectOutboundRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_SelectOutbound = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/SelectOutbound',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SelectOutboundRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.selectOutbound =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/SelectOutbound',
- request,
- metadata || {},
- methodDescriptor_Core_SelectOutbound,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.selectOutbound =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/SelectOutbound',
- request,
- metadata || {},
- methodDescriptor_Core_SelectOutbound);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.UrlTestRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_UrlTest = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/UrlTest',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.UrlTestRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.urlTest =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/UrlTest',
- request,
- metadata || {},
- methodDescriptor_Core_UrlTest,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.urlTest =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/UrlTest',
- request,
- metadata || {},
- methodDescriptor_Core_UrlTest);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.GenerateWarpConfigRequest,
- * !proto.hiddifyrpc.WarpGenerationResponse>}
- */
-const methodDescriptor_Core_GenerateWarpConfig = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GenerateWarpConfig',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.GenerateWarpConfigRequest,
- proto.hiddifyrpc.WarpGenerationResponse,
- /**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.WarpGenerationResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.generateWarpConfig =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/GenerateWarpConfig',
- request,
- metadata || {},
- methodDescriptor_Core_GenerateWarpConfig,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.generateWarpConfig =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/GenerateWarpConfig',
- request,
- metadata || {},
- methodDescriptor_Core_GenerateWarpConfig);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.SystemProxyStatus>}
- */
-const methodDescriptor_Core_GetSystemProxyStatus = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.SystemProxyStatus,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.SystemProxyStatus.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.SystemProxyStatus)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.getSystemProxyStatus =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemProxyStatus,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.getSystemProxyStatus =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemProxyStatus);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SetSystemProxyEnabledRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_SetSystemProxyEnabled = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SetSystemProxyEnabledRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.setSystemProxyEnabled =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- request,
- metadata || {},
- methodDescriptor_Core_SetSystemProxyEnabled,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.setSystemProxyEnabled =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- request,
- metadata || {},
- methodDescriptor_Core_SetSystemProxyEnabled);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.LogMessage>}
- */
-const methodDescriptor_Core_LogListener = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/LogListener',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.LogMessage,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.LogMessage.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.logListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/LogListener',
- request,
- metadata || {},
- methodDescriptor_Core_LogListener);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.logListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/LogListener',
- request,
- metadata || {},
- methodDescriptor_Core_LogListener);
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.TunnelServiceClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.TunnelServicePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.TunnelStartRequest,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Start = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Start',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.TunnelStartRequest,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.start =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Start',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Start,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.start =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Start',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Start);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Stop = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Stop',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.stop =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Stop',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Stop,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.stop =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Stop',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Stop);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Status = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Status',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.status =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Status',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Status,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.status =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Status',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Status);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Exit = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Exit',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.exit =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Exit',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Exit,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.exit =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Exit',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Exit);
-};
-
-
-module.exports = proto.hiddifyrpc;
-
-
-},{"./base_pb.js":1,"./hiddify_pb.js":11,"grpc-web":13}],11:[function(require,module,exports){
-// source: hiddify.proto
-/**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
-// GENERATED CODE -- DO NOT EDIT!
-/* eslint-disable */
-// @ts-nocheck
-
-var jspb = require('google-protobuf');
-var goog = jspb;
-var global =
- (typeof globalThis !== 'undefined' && globalThis) ||
- (typeof window !== 'undefined' && window) ||
- (typeof global !== 'undefined' && global) ||
- (typeof self !== 'undefined' && self) ||
- (function () { return this; }).call(null) ||
- Function('return this')();
-
-var base_pb = require('./base_pb.js');
-goog.object.extend(proto, base_pb);
-goog.exportSymbol('proto.hiddifyrpc.ChangeHiddifySettingsRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.CoreInfoResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.CoreState', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateConfigRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateConfigResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateWarpConfigRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogLevel', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogMessage', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.MessageType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroup', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroupItem', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroupList', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ParseRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ParseResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.Response', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SelectOutboundRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SetSystemProxyEnabledRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SetupRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.StartRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.StopRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SystemInfo', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SystemProxyStatus', null, global);
-goog.exportSymbol('proto.hiddifyrpc.TunnelResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.TunnelStartRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.UrlTestRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpAccount', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpGenerationResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpWireguardConfig', null, global);
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.CoreInfoResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.CoreInfoResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.CoreInfoResponse.displayName = 'proto.hiddifyrpc.CoreInfoResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.StartRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.StartRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.StartRequest.displayName = 'proto.hiddifyrpc.StartRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SetupRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SetupRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SetupRequest.displayName = 'proto.hiddifyrpc.SetupRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.Response = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.Response, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.Response.displayName = 'proto.hiddifyrpc.Response';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SystemInfo = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SystemInfo, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SystemInfo.displayName = 'proto.hiddifyrpc.SystemInfo';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroupItem = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroupItem, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroupItem.displayName = 'proto.hiddifyrpc.OutboundGroupItem';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroup = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroup.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroup, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroup.displayName = 'proto.hiddifyrpc.OutboundGroup';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroupList = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroupList.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroupList, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroupList.displayName = 'proto.hiddifyrpc.OutboundGroupList';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpAccount = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpAccount, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpAccount.displayName = 'proto.hiddifyrpc.WarpAccount';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpWireguardConfig = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpWireguardConfig, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpWireguardConfig.displayName = 'proto.hiddifyrpc.WarpWireguardConfig';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpGenerationResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpGenerationResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpGenerationResponse.displayName = 'proto.hiddifyrpc.WarpGenerationResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SystemProxyStatus = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SystemProxyStatus, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SystemProxyStatus.displayName = 'proto.hiddifyrpc.SystemProxyStatus';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ParseRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ParseRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ParseRequest.displayName = 'proto.hiddifyrpc.ParseRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ParseResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ParseResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ParseResponse.displayName = 'proto.hiddifyrpc.ParseResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ChangeHiddifySettingsRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ChangeHiddifySettingsRequest.displayName = 'proto.hiddifyrpc.ChangeHiddifySettingsRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateConfigRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateConfigRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateConfigRequest.displayName = 'proto.hiddifyrpc.GenerateConfigRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateConfigResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateConfigResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateConfigResponse.displayName = 'proto.hiddifyrpc.GenerateConfigResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SelectOutboundRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SelectOutboundRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SelectOutboundRequest.displayName = 'proto.hiddifyrpc.SelectOutboundRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.UrlTestRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.UrlTestRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.UrlTestRequest.displayName = 'proto.hiddifyrpc.UrlTestRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateWarpConfigRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateWarpConfigRequest.displayName = 'proto.hiddifyrpc.GenerateWarpConfigRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SetSystemProxyEnabledRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SetSystemProxyEnabledRequest.displayName = 'proto.hiddifyrpc.SetSystemProxyEnabledRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.LogMessage = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.LogMessage, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.LogMessage.displayName = 'proto.hiddifyrpc.LogMessage';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.StopRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.StopRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.StopRequest.displayName = 'proto.hiddifyrpc.StopRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.TunnelStartRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.TunnelStartRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.TunnelStartRequest.displayName = 'proto.hiddifyrpc.TunnelStartRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.TunnelResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.TunnelResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.TunnelResponse.displayName = 'proto.hiddifyrpc.TunnelResponse';
-}
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.CoreInfoResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.CoreInfoResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-coreState: jspb.Message.getFieldWithDefault(msg, 1, 0),
-messageType: jspb.Message.getFieldWithDefault(msg, 2, 0),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.CoreInfoResponse}
- */
-proto.hiddifyrpc.CoreInfoResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.CoreInfoResponse;
- return proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.CoreInfoResponse}
- */
-proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.CoreState} */ (reader.readEnum());
- msg.setCoreState(value);
- break;
- case 2:
- var value = /** @type {!proto.hiddifyrpc.MessageType} */ (reader.readEnum());
- msg.setMessageType(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.CoreInfoResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getCoreState();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getMessageType();
- if (f !== 0.0) {
- writer.writeEnum(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional CoreState core_state = 1;
- * @return {!proto.hiddifyrpc.CoreState}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getCoreState = function() {
- return /** @type {!proto.hiddifyrpc.CoreState} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.CoreState} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setCoreState = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional MessageType message_type = 2;
- * @return {!proto.hiddifyrpc.MessageType}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getMessageType = function() {
- return /** @type {!proto.hiddifyrpc.MessageType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.MessageType} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setMessageType = function(value) {
- return jspb.Message.setProto3EnumField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.StartRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.StartRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.StartRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StartRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-configPath: jspb.Message.getFieldWithDefault(msg, 1, ""),
-configContent: jspb.Message.getFieldWithDefault(msg, 2, ""),
-disableMemoryLimit: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
-delayStart: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
-enableOldCommandServer: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
-enableRawConfig: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.StartRequest}
- */
-proto.hiddifyrpc.StartRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.StartRequest;
- return proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.StartRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.StartRequest}
- */
-proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigPath(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigContent(value);
- break;
- case 3:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDisableMemoryLimit(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDelayStart(value);
- break;
- case 5:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnableOldCommandServer(value);
- break;
- case 6:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnableRawConfig(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.StartRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.StartRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.StartRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StartRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getConfigPath();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getConfigContent();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDisableMemoryLimit();
- if (f) {
- writer.writeBool(
- 3,
- f
- );
- }
- f = message.getDelayStart();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
- f = message.getEnableOldCommandServer();
- if (f) {
- writer.writeBool(
- 5,
- f
- );
- }
- f = message.getEnableRawConfig();
- if (f) {
- writer.writeBool(
- 6,
- f
- );
- }
-};
-
-
-/**
- * optional string config_path = 1;
- * @return {string}
- */
-proto.hiddifyrpc.StartRequest.prototype.getConfigPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setConfigPath = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string config_content = 2;
- * @return {string}
- */
-proto.hiddifyrpc.StartRequest.prototype.getConfigContent = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setConfigContent = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional bool disable_memory_limit = 3;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getDisableMemoryLimit = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setDisableMemoryLimit = function(value) {
- return jspb.Message.setProto3BooleanField(this, 3, value);
-};
-
-
-/**
- * optional bool delay_start = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getDelayStart = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setDelayStart = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-/**
- * optional bool enable_old_command_server = 5;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getEnableOldCommandServer = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setEnableOldCommandServer = function(value) {
- return jspb.Message.setProto3BooleanField(this, 5, value);
-};
-
-
-/**
- * optional bool enable_raw_config = 6;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getEnableRawConfig = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setEnableRawConfig = function(value) {
- return jspb.Message.setProto3BooleanField(this, 6, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SetupRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SetupRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SetupRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetupRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-basePath: jspb.Message.getFieldWithDefault(msg, 1, ""),
-workingPath: jspb.Message.getFieldWithDefault(msg, 2, ""),
-tempPath: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SetupRequest}
- */
-proto.hiddifyrpc.SetupRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SetupRequest;
- return proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SetupRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SetupRequest}
- */
-proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setBasePath(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setWorkingPath(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setTempPath(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SetupRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SetupRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getBasePath();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getWorkingPath();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getTempPath();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string base_path = 1;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getBasePath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setBasePath = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string working_path = 2;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getWorkingPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setWorkingPath = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string temp_path = 3;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getTempPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setTempPath = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Response.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Response.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Response} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Response.toObject = function(includeInstance, msg) {
- var f, obj = {
-responseCode: jspb.Message.getFieldWithDefault(msg, 1, 0),
-message: jspb.Message.getFieldWithDefault(msg, 2, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Response}
- */
-proto.hiddifyrpc.Response.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Response;
- return proto.hiddifyrpc.Response.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Response} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Response}
- */
-proto.hiddifyrpc.Response.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum());
- msg.setResponseCode(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Response.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Response.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Response} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Response.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getResponseCode();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional ResponseCode response_code = 1;
- * @return {!proto.hiddifyrpc.ResponseCode}
- */
-proto.hiddifyrpc.Response.prototype.getResponseCode = function() {
- return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ResponseCode} value
- * @return {!proto.hiddifyrpc.Response} returns this
- */
-proto.hiddifyrpc.Response.prototype.setResponseCode = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional string message = 2;
- * @return {string}
- */
-proto.hiddifyrpc.Response.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Response} returns this
- */
-proto.hiddifyrpc.Response.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SystemInfo.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SystemInfo.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SystemInfo} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemInfo.toObject = function(includeInstance, msg) {
- var f, obj = {
-memory: jspb.Message.getFieldWithDefault(msg, 1, 0),
-goroutines: jspb.Message.getFieldWithDefault(msg, 2, 0),
-connectionsIn: jspb.Message.getFieldWithDefault(msg, 3, 0),
-connectionsOut: jspb.Message.getFieldWithDefault(msg, 4, 0),
-trafficAvailable: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
-uplink: jspb.Message.getFieldWithDefault(msg, 6, 0),
-downlink: jspb.Message.getFieldWithDefault(msg, 7, 0),
-uplinkTotal: jspb.Message.getFieldWithDefault(msg, 8, 0),
-downlinkTotal: jspb.Message.getFieldWithDefault(msg, 9, 0)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SystemInfo}
- */
-proto.hiddifyrpc.SystemInfo.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SystemInfo;
- return proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SystemInfo} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SystemInfo}
- */
-proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setMemory(value);
- break;
- case 2:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setGoroutines(value);
- break;
- case 3:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setConnectionsIn(value);
- break;
- case 4:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setConnectionsOut(value);
- break;
- case 5:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setTrafficAvailable(value);
- break;
- case 6:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUplink(value);
- break;
- case 7:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setDownlink(value);
- break;
- case 8:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUplinkTotal(value);
- break;
- case 9:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setDownlinkTotal(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SystemInfo.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SystemInfo} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getMemory();
- if (f !== 0) {
- writer.writeInt64(
- 1,
- f
- );
- }
- f = message.getGoroutines();
- if (f !== 0) {
- writer.writeInt32(
- 2,
- f
- );
- }
- f = message.getConnectionsIn();
- if (f !== 0) {
- writer.writeInt32(
- 3,
- f
- );
- }
- f = message.getConnectionsOut();
- if (f !== 0) {
- writer.writeInt32(
- 4,
- f
- );
- }
- f = message.getTrafficAvailable();
- if (f) {
- writer.writeBool(
- 5,
- f
- );
- }
- f = message.getUplink();
- if (f !== 0) {
- writer.writeInt64(
- 6,
- f
- );
- }
- f = message.getDownlink();
- if (f !== 0) {
- writer.writeInt64(
- 7,
- f
- );
- }
- f = message.getUplinkTotal();
- if (f !== 0) {
- writer.writeInt64(
- 8,
- f
- );
- }
- f = message.getDownlinkTotal();
- if (f !== 0) {
- writer.writeInt64(
- 9,
- f
- );
- }
-};
-
-
-/**
- * optional int64 memory = 1;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getMemory = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setMemory = function(value) {
- return jspb.Message.setProto3IntField(this, 1, value);
-};
-
-
-/**
- * optional int32 goroutines = 2;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getGoroutines = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setGoroutines = function(value) {
- return jspb.Message.setProto3IntField(this, 2, value);
-};
-
-
-/**
- * optional int32 connections_in = 3;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getConnectionsIn = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setConnectionsIn = function(value) {
- return jspb.Message.setProto3IntField(this, 3, value);
-};
-
-
-/**
- * optional int32 connections_out = 4;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getConnectionsOut = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setConnectionsOut = function(value) {
- return jspb.Message.setProto3IntField(this, 4, value);
-};
-
-
-/**
- * optional bool traffic_available = 5;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getTrafficAvailable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setTrafficAvailable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 5, value);
-};
-
-
-/**
- * optional int64 uplink = 6;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getUplink = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setUplink = function(value) {
- return jspb.Message.setProto3IntField(this, 6, value);
-};
-
-
-/**
- * optional int64 downlink = 7;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getDownlink = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setDownlink = function(value) {
- return jspb.Message.setProto3IntField(this, 7, value);
-};
-
-
-/**
- * optional int64 uplink_total = 8;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getUplinkTotal = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setUplinkTotal = function(value) {
- return jspb.Message.setProto3IntField(this, 8, value);
-};
-
-
-/**
- * optional int64 downlink_total = 9;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getDownlinkTotal = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setDownlinkTotal = function(value) {
- return jspb.Message.setProto3IntField(this, 9, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroupItem.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupItem.toObject = function(includeInstance, msg) {
- var f, obj = {
-tag: jspb.Message.getFieldWithDefault(msg, 1, ""),
-type: jspb.Message.getFieldWithDefault(msg, 2, ""),
-urlTestTime: jspb.Message.getFieldWithDefault(msg, 3, 0),
-urlTestDelay: jspb.Message.getFieldWithDefault(msg, 4, 0)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroupItem.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroupItem;
- return proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setTag(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setType(value);
- break;
- case 3:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUrlTestTime(value);
- break;
- case 4:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setUrlTestDelay(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroupItem} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getType();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getUrlTestTime();
- if (f !== 0) {
- writer.writeInt64(
- 3,
- f
- );
- }
- f = message.getUrlTestDelay();
- if (f !== 0) {
- writer.writeInt32(
- 4,
- f
- );
- }
-};
-
-
-/**
- * optional string tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string type = 2;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getType = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setType = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional int64 url_test_time = 3;
- * @return {number}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestTime = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestTime = function(value) {
- return jspb.Message.setProto3IntField(this, 3, value);
-};
-
-
-/**
- * optional int32 url_test_delay = 4;
- * @return {number}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestDelay = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestDelay = function(value) {
- return jspb.Message.setProto3IntField(this, 4, value);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.OutboundGroup.repeatedFields_ = [4];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroup.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroup} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroup.toObject = function(includeInstance, msg) {
- var f, obj = {
-tag: jspb.Message.getFieldWithDefault(msg, 1, ""),
-type: jspb.Message.getFieldWithDefault(msg, 2, ""),
-selected: jspb.Message.getFieldWithDefault(msg, 3, ""),
-itemsList: jspb.Message.toObjectList(msg.getItemsList(),
- proto.hiddifyrpc.OutboundGroupItem.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroup.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroup;
- return proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroup} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setTag(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setType(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setSelected(value);
- break;
- case 4:
- var value = new proto.hiddifyrpc.OutboundGroupItem;
- reader.readMessage(value,proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader);
- msg.addItems(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroup} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getType();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getSelected();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getItemsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 4,
- f,
- proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * optional string tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string type = 2;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getType = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setType = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string selected = 3;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getSelected = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setSelected = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * repeated OutboundGroupItem items = 4;
- * @return {!Array}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getItemsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroupItem, 4));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
-*/
-proto.hiddifyrpc.OutboundGroup.prototype.setItemsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 4, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.OutboundGroupItem=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.addItems = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.hiddifyrpc.OutboundGroupItem, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.clearItemsList = function() {
- return this.setItemsList([]);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.OutboundGroupList.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroupList.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroupList} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupList.toObject = function(includeInstance, msg) {
- var f, obj = {
-itemsList: jspb.Message.toObjectList(msg.getItemsList(),
- proto.hiddifyrpc.OutboundGroup.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroupList}
- */
-proto.hiddifyrpc.OutboundGroupList.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroupList;
- return proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroupList} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroupList}
- */
-proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.OutboundGroup;
- reader.readMessage(value,proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader);
- msg.addItems(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroupList} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getItemsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 1,
- f,
- proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * repeated OutboundGroup items = 1;
- * @return {!Array}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.getItemsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroup, 1));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.OutboundGroupList} returns this
-*/
-proto.hiddifyrpc.OutboundGroupList.prototype.setItemsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.OutboundGroup=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.addItems = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.hiddifyrpc.OutboundGroup, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.OutboundGroupList} returns this
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.clearItemsList = function() {
- return this.setItemsList([]);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpAccount.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpAccount.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpAccount} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpAccount.toObject = function(includeInstance, msg) {
- var f, obj = {
-accountId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-accessToken: jspb.Message.getFieldWithDefault(msg, 2, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpAccount.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpAccount;
- return proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpAccount} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccountId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccessToken(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpAccount.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpAccount} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAccountId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getAccessToken();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional string account_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.WarpAccount.prototype.getAccountId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpAccount} returns this
- */
-proto.hiddifyrpc.WarpAccount.prototype.setAccountId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string access_token = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpAccount.prototype.getAccessToken = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpAccount} returns this
- */
-proto.hiddifyrpc.WarpAccount.prototype.setAccessToken = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpWireguardConfig.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpWireguardConfig.toObject = function(includeInstance, msg) {
- var f, obj = {
-privateKey: jspb.Message.getFieldWithDefault(msg, 1, ""),
-localAddressIpv4: jspb.Message.getFieldWithDefault(msg, 2, ""),
-localAddressIpv6: jspb.Message.getFieldWithDefault(msg, 3, ""),
-peerPublicKey: jspb.Message.getFieldWithDefault(msg, 4, ""),
-clientId: jspb.Message.getFieldWithDefault(msg, 5, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpWireguardConfig.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpWireguardConfig;
- return proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setPrivateKey(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setLocalAddressIpv4(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setLocalAddressIpv6(value);
- break;
- case 4:
- var value = /** @type {string} */ (reader.readString());
- msg.setPeerPublicKey(value);
- break;
- case 5:
- var value = /** @type {string} */ (reader.readString());
- msg.setClientId(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getPrivateKey();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getLocalAddressIpv4();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getLocalAddressIpv6();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getPeerPublicKey();
- if (f.length > 0) {
- writer.writeString(
- 4,
- f
- );
- }
- f = message.getClientId();
- if (f.length > 0) {
- writer.writeString(
- 5,
- f
- );
- }
-};
-
-
-/**
- * optional string private_key = 1;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getPrivateKey = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setPrivateKey = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string local_address_ipv4 = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv4 = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv4 = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string local_address_ipv6 = 3;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv6 = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv6 = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * optional string peer_public_key = 4;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getPeerPublicKey = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setPeerPublicKey = function(value) {
- return jspb.Message.setProto3StringField(this, 4, value);
-};
-
-
-/**
- * optional string client_id = 5;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getClientId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setClientId = function(value) {
- return jspb.Message.setProto3StringField(this, 5, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpGenerationResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpGenerationResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-account: (f = msg.getAccount()) && proto.hiddifyrpc.WarpAccount.toObject(includeInstance, f),
-log: jspb.Message.getFieldWithDefault(msg, 2, ""),
-config: (f = msg.getConfig()) && proto.hiddifyrpc.WarpWireguardConfig.toObject(includeInstance, f)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse}
- */
-proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpGenerationResponse;
- return proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse}
- */
-proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.WarpAccount;
- reader.readMessage(value,proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader);
- msg.setAccount(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setLog(value);
- break;
- case 3:
- var value = new proto.hiddifyrpc.WarpWireguardConfig;
- reader.readMessage(value,proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader);
- msg.setConfig(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAccount();
- if (f != null) {
- writer.writeMessage(
- 1,
- f,
- proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter
- );
- }
- f = message.getLog();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getConfig();
- if (f != null) {
- writer.writeMessage(
- 3,
- f,
- proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * optional WarpAccount account = 1;
- * @return {?proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getAccount = function() {
- return /** @type{?proto.hiddifyrpc.WarpAccount} */ (
- jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpAccount, 1));
-};
-
-
-/**
- * @param {?proto.hiddifyrpc.WarpAccount|undefined} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
-*/
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setAccount = function(value) {
- return jspb.Message.setWrapperField(this, 1, value);
-};
-
-
-/**
- * Clears the message field making it undefined.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.clearAccount = function() {
- return this.setAccount(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {boolean}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.hasAccount = function() {
- return jspb.Message.getField(this, 1) != null;
-};
-
-
-/**
- * optional string log = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getLog = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setLog = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional WarpWireguardConfig config = 3;
- * @return {?proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getConfig = function() {
- return /** @type{?proto.hiddifyrpc.WarpWireguardConfig} */ (
- jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpWireguardConfig, 3));
-};
-
-
-/**
- * @param {?proto.hiddifyrpc.WarpWireguardConfig|undefined} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
-*/
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setConfig = function(value) {
- return jspb.Message.setWrapperField(this, 3, value);
-};
-
-
-/**
- * Clears the message field making it undefined.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.clearConfig = function() {
- return this.setConfig(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {boolean}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.hasConfig = function() {
- return jspb.Message.getField(this, 3) != null;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SystemProxyStatus.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemProxyStatus.toObject = function(includeInstance, msg) {
- var f, obj = {
-available: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
-enabled: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SystemProxyStatus}
- */
-proto.hiddifyrpc.SystemProxyStatus.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SystemProxyStatus;
- return proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SystemProxyStatus}
- */
-proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setAvailable(value);
- break;
- case 2:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnabled(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SystemProxyStatus} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAvailable();
- if (f) {
- writer.writeBool(
- 1,
- f
- );
- }
- f = message.getEnabled();
- if (f) {
- writer.writeBool(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional bool available = 1;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.getAvailable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.setAvailable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 1, value);
-};
-
-
-/**
- * optional bool enabled = 2;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.getEnabled = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.setEnabled = function(value) {
- return jspb.Message.setProto3BooleanField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ParseRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ParseRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ParseRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ParseRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-content: jspb.Message.getFieldWithDefault(msg, 1, ""),
-configPath: jspb.Message.getFieldWithDefault(msg, 2, ""),
-tempPath: jspb.Message.getFieldWithDefault(msg, 3, ""),
-debug: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ParseRequest}
- */
-proto.hiddifyrpc.ParseRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ParseRequest;
- return proto.hiddifyrpc.ParseRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ParseRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ParseRequest}
- */
-proto.hiddifyrpc.ParseRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setContent(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigPath(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setTempPath(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDebug(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ParseRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ParseRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ParseRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ParseRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getContent();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getConfigPath();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getTempPath();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getDebug();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
-};
-
-
-/**
- * optional string content = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ParseRequest.prototype.getContent = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ParseRequest} returns this
- */
-proto.hiddifyrpc.ParseRequest.prototype.setContent = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string config_path = 2;
- * @return {string}
- */
-proto.hiddifyrpc.ParseRequest.prototype.getConfigPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ParseRequest} returns this
- */
-proto.hiddifyrpc.ParseRequest.prototype.setConfigPath = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string temp_path = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ParseRequest.prototype.getTempPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ParseRequest} returns this
- */
-proto.hiddifyrpc.ParseRequest.prototype.setTempPath = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * optional bool debug = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.ParseRequest.prototype.getDebug = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.ParseRequest} returns this
- */
-proto.hiddifyrpc.ParseRequest.prototype.setDebug = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ParseResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ParseResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ParseResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ParseResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-responseCode: jspb.Message.getFieldWithDefault(msg, 1, 0),
-content: jspb.Message.getFieldWithDefault(msg, 2, ""),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ParseResponse}
- */
-proto.hiddifyrpc.ParseResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ParseResponse;
- return proto.hiddifyrpc.ParseResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ParseResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ParseResponse}
- */
-proto.hiddifyrpc.ParseResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum());
- msg.setResponseCode(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setContent(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ParseResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ParseResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ParseResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ParseResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getResponseCode();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getContent();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional ResponseCode response_code = 1;
- * @return {!proto.hiddifyrpc.ResponseCode}
- */
-proto.hiddifyrpc.ParseResponse.prototype.getResponseCode = function() {
- return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ResponseCode} value
- * @return {!proto.hiddifyrpc.ParseResponse} returns this
- */
-proto.hiddifyrpc.ParseResponse.prototype.setResponseCode = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional string content = 2;
- * @return {string}
- */
-proto.hiddifyrpc.ParseResponse.prototype.getContent = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ParseResponse} returns this
- */
-proto.hiddifyrpc.ParseResponse.prototype.setContent = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ParseResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ParseResponse} returns this
- */
-proto.hiddifyrpc.ParseResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-hiddifySettingsJson: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest}
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ChangeHiddifySettingsRequest;
- return proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest}
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setHiddifySettingsJson(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getHiddifySettingsJson();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string hiddify_settings_json = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.getHiddifySettingsJson = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} returns this
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest.prototype.setHiddifySettingsJson = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.GenerateConfigRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.GenerateConfigRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateConfigRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-path: jspb.Message.getFieldWithDefault(msg, 1, ""),
-tempPath: jspb.Message.getFieldWithDefault(msg, 2, ""),
-debug: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.GenerateConfigRequest}
- */
-proto.hiddifyrpc.GenerateConfigRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.GenerateConfigRequest;
- return proto.hiddifyrpc.GenerateConfigRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.GenerateConfigRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.GenerateConfigRequest}
- */
-proto.hiddifyrpc.GenerateConfigRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setPath(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setTempPath(value);
- break;
- case 3:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDebug(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.GenerateConfigRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.GenerateConfigRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateConfigRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getPath();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getTempPath();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDebug();
- if (f) {
- writer.writeBool(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string path = 1;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.getPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.setPath = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string temp_path = 2;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.getTempPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.setTempPath = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional bool debug = 3;
- * @return {boolean}
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.getDebug = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.GenerateConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateConfigRequest.prototype.setDebug = function(value) {
- return jspb.Message.setProto3BooleanField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.GenerateConfigResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.GenerateConfigResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.GenerateConfigResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateConfigResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-configContent: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.GenerateConfigResponse}
- */
-proto.hiddifyrpc.GenerateConfigResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.GenerateConfigResponse;
- return proto.hiddifyrpc.GenerateConfigResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.GenerateConfigResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.GenerateConfigResponse}
- */
-proto.hiddifyrpc.GenerateConfigResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigContent(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.GenerateConfigResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.GenerateConfigResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.GenerateConfigResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateConfigResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getConfigContent();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string config_content = 1;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateConfigResponse.prototype.getConfigContent = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateConfigResponse} returns this
- */
-proto.hiddifyrpc.GenerateConfigResponse.prototype.setConfigContent = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SelectOutboundRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SelectOutboundRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-groupTag: jspb.Message.getFieldWithDefault(msg, 1, ""),
-outboundTag: jspb.Message.getFieldWithDefault(msg, 2, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SelectOutboundRequest}
- */
-proto.hiddifyrpc.SelectOutboundRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SelectOutboundRequest;
- return proto.hiddifyrpc.SelectOutboundRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SelectOutboundRequest}
- */
-proto.hiddifyrpc.SelectOutboundRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setGroupTag(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setOutboundTag(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SelectOutboundRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SelectOutboundRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getGroupTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getOutboundTag();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional string group_tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.getGroupTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SelectOutboundRequest} returns this
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.setGroupTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string outbound_tag = 2;
- * @return {string}
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.getOutboundTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SelectOutboundRequest} returns this
- */
-proto.hiddifyrpc.SelectOutboundRequest.prototype.setOutboundTag = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.UrlTestRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.UrlTestRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.UrlTestRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.UrlTestRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-groupTag: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.UrlTestRequest}
- */
-proto.hiddifyrpc.UrlTestRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.UrlTestRequest;
- return proto.hiddifyrpc.UrlTestRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.UrlTestRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.UrlTestRequest}
- */
-proto.hiddifyrpc.UrlTestRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setGroupTag(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.UrlTestRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.UrlTestRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.UrlTestRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.UrlTestRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getGroupTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string group_tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.UrlTestRequest.prototype.getGroupTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.UrlTestRequest} returns this
- */
-proto.hiddifyrpc.UrlTestRequest.prototype.setGroupTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.GenerateWarpConfigRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-licenseKey: jspb.Message.getFieldWithDefault(msg, 1, ""),
-accountId: jspb.Message.getFieldWithDefault(msg, 2, ""),
-accessToken: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.GenerateWarpConfigRequest;
- return proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setLicenseKey(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccountId(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccessToken(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.GenerateWarpConfigRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getLicenseKey();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getAccountId();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getAccessToken();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string license_key = 1;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getLicenseKey = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setLicenseKey = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string account_id = 2;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getAccountId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setAccountId = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string access_token = 3;
- * @return {string}
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.getAccessToken = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.GenerateWarpConfigRequest} returns this
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest.prototype.setAccessToken = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SetSystemProxyEnabledRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-isEnabled: jspb.Message.getBooleanFieldWithDefault(msg, 1, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest}
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SetSystemProxyEnabledRequest;
- return proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest}
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setIsEnabled(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SetSystemProxyEnabledRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getIsEnabled();
- if (f) {
- writer.writeBool(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional bool is_enabled = 1;
- * @return {boolean}
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.getIsEnabled = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} returns this
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest.prototype.setIsEnabled = function(value) {
- return jspb.Message.setProto3BooleanField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.LogMessage.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.LogMessage.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.LogMessage} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.LogMessage.toObject = function(includeInstance, msg) {
- var f, obj = {
-level: jspb.Message.getFieldWithDefault(msg, 1, 0),
-type: jspb.Message.getFieldWithDefault(msg, 2, 0),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.LogMessage}
- */
-proto.hiddifyrpc.LogMessage.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.LogMessage;
- return proto.hiddifyrpc.LogMessage.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.LogMessage} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.LogMessage}
- */
-proto.hiddifyrpc.LogMessage.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.LogLevel} */ (reader.readEnum());
- msg.setLevel(value);
- break;
- case 2:
- var value = /** @type {!proto.hiddifyrpc.LogType} */ (reader.readEnum());
- msg.setType(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.LogMessage.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.LogMessage.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.LogMessage} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.LogMessage.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getLevel();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getType();
- if (f !== 0.0) {
- writer.writeEnum(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional LogLevel level = 1;
- * @return {!proto.hiddifyrpc.LogLevel}
- */
-proto.hiddifyrpc.LogMessage.prototype.getLevel = function() {
- return /** @type {!proto.hiddifyrpc.LogLevel} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.LogLevel} value
- * @return {!proto.hiddifyrpc.LogMessage} returns this
- */
-proto.hiddifyrpc.LogMessage.prototype.setLevel = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional LogType type = 2;
- * @return {!proto.hiddifyrpc.LogType}
- */
-proto.hiddifyrpc.LogMessage.prototype.getType = function() {
- return /** @type {!proto.hiddifyrpc.LogType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.LogType} value
- * @return {!proto.hiddifyrpc.LogMessage} returns this
- */
-proto.hiddifyrpc.LogMessage.prototype.setType = function(value) {
- return jspb.Message.setProto3EnumField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.LogMessage.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.LogMessage} returns this
- */
-proto.hiddifyrpc.LogMessage.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.StopRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.StopRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.StopRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StopRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.StopRequest}
- */
-proto.hiddifyrpc.StopRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.StopRequest;
- return proto.hiddifyrpc.StopRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.StopRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.StopRequest}
- */
-proto.hiddifyrpc.StopRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.StopRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.StopRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.StopRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StopRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.TunnelStartRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.TunnelStartRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.TunnelStartRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-ipv6: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
-serverPort: jspb.Message.getFieldWithDefault(msg, 2, 0),
-strictRoute: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
-endpointIndependentNat: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
-stack: jspb.Message.getFieldWithDefault(msg, 5, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.TunnelStartRequest}
- */
-proto.hiddifyrpc.TunnelStartRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.TunnelStartRequest;
- return proto.hiddifyrpc.TunnelStartRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.TunnelStartRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.TunnelStartRequest}
- */
-proto.hiddifyrpc.TunnelStartRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setIpv6(value);
- break;
- case 2:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setServerPort(value);
- break;
- case 3:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setStrictRoute(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEndpointIndependentNat(value);
- break;
- case 5:
- var value = /** @type {string} */ (reader.readString());
- msg.setStack(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.TunnelStartRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.TunnelStartRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.TunnelStartRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getIpv6();
- if (f) {
- writer.writeBool(
- 1,
- f
- );
- }
- f = message.getServerPort();
- if (f !== 0) {
- writer.writeInt32(
- 2,
- f
- );
- }
- f = message.getStrictRoute();
- if (f) {
- writer.writeBool(
- 3,
- f
- );
- }
- f = message.getEndpointIndependentNat();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
- f = message.getStack();
- if (f.length > 0) {
- writer.writeString(
- 5,
- f
- );
- }
-};
-
-
-/**
- * optional bool ipv6 = 1;
- * @return {boolean}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.getIpv6 = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.setIpv6 = function(value) {
- return jspb.Message.setProto3BooleanField(this, 1, value);
-};
-
-
-/**
- * optional int32 server_port = 2;
- * @return {number}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.getServerPort = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.setServerPort = function(value) {
- return jspb.Message.setProto3IntField(this, 2, value);
-};
-
-
-/**
- * optional bool strict_route = 3;
- * @return {boolean}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.getStrictRoute = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.setStrictRoute = function(value) {
- return jspb.Message.setProto3BooleanField(this, 3, value);
-};
-
-
-/**
- * optional bool endpoint_independent_nat = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.getEndpointIndependentNat = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.setEndpointIndependentNat = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-/**
- * optional string stack = 5;
- * @return {string}
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.getStack = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.TunnelStartRequest} returns this
- */
-proto.hiddifyrpc.TunnelStartRequest.prototype.setStack = function(value) {
- return jspb.Message.setProto3StringField(this, 5, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.TunnelResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.TunnelResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.TunnelResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.TunnelResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-message: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.TunnelResponse}
- */
-proto.hiddifyrpc.TunnelResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.TunnelResponse;
- return proto.hiddifyrpc.TunnelResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.TunnelResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.TunnelResponse}
- */
-proto.hiddifyrpc.TunnelResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.TunnelResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.TunnelResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.TunnelResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.TunnelResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string message = 1;
- * @return {string}
- */
-proto.hiddifyrpc.TunnelResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.TunnelResponse} returns this
- */
-proto.hiddifyrpc.TunnelResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.CoreState = {
- STOPPED: 0,
- STARTING: 1,
- STARTED: 2,
- STOPPING: 3
-};
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.MessageType = {
- EMPTY: 0,
- EMPTY_CONFIGURATION: 1,
- START_COMMAND_SERVER: 2,
- CREATE_SERVICE: 3,
- START_SERVICE: 4,
- UNEXPECTED_ERROR: 5,
- ALREADY_STARTED: 6,
- ALREADY_STOPPED: 7,
- INSTANCE_NOT_FOUND: 8,
- INSTANCE_NOT_STOPPED: 9,
- INSTANCE_NOT_STARTED: 10,
- ERROR_BUILDING_CONFIG: 11,
- ERROR_PARSING_CONFIG: 12,
- ERROR_READING_CONFIG: 13
-};
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.LogLevel = {
- DEBUG: 0,
- INFO: 1,
- WARNING: 2,
- ERROR: 3,
- FATAL: 4
-};
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.LogType = {
- CORE: 0,
- SERVICE: 1,
- CONFIG: 2
-};
-
-goog.object.extend(exports, proto.hiddifyrpc);
-
-},{"./base_pb.js":1,"google-protobuf":12}],12:[function(require,module,exports){
-(function (global){(function (){
-/*
-
- Copyright The Closure Library Authors.
- SPDX-License-Identifier: Apache-2.0
-*/
-var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},e="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function ba(a,b){if(b){var c=e;a=a.split(".");for(var d=0;d=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};function sa(a,b,c,d){var f="Assertion failed";if(c){f+=": "+c;var h=d}else a&&(f+=": "+a,h=b);throw Error(f,h||[]);}function n(a,b,c){for(var d=[],f=2;f=a.length)return String.fromCharCode.apply(null,a);for(var b="",c=0;c>2;f=(f&3)<<4|m>>4;m=(m&15)<<2|B>>6;B&=63;t||(B=64,h||(m=64));c.push(b[M],b[f],b[m]||"",b[B]||"")}return c.join("")}function Da(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),f=0;Ea(a,function(h){d[f++]=h});return d.subarray(0,f)}
-function Ea(a,b){function c(B){for(;d>4);64!=m&&(b(h<<4&240|m>>2),64!=t&&b(m<<6&192|t))}}
-function Ca(){if(!x){x={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Aa[c]=d;for(var f=0;f>>0;a=Math.floor((a-b)/4294967296)>>>0;y=b;z=a}g("jspb.utils.splitUint64",Fa,void 0);function A(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295a;a=2*Math.abs(a);Fa(a);a=y;var c=z;b&&(0==a?0==c?c=a=4294967295:(c--,a=4294967295):a--);y=a;z=c}g("jspb.utils.splitZigzag64",Ga,void 0);
-function Ha(a){var b=0>a?1:0;a=b?-a:a;if(0===a)0<1/a?y=z=0:(z=0,y=2147483648);else if(isNaN(a))z=0,y=2147483647;else if(3.4028234663852886E38>>0;else if(1.1754943508222875E-38>a)a=Math.round(a/Math.pow(2,-149)),z=0,y=(b<<31|a)>>>0;else{var c=Math.floor(Math.log(a)/Math.LN2);a*=Math.pow(2,-c);a=Math.round(8388608*a);16777216<=a&&++c;z=0;y=(b<<31|c+127<<23|a&8388607)>>>0}}g("jspb.utils.splitFloat32",Ha,void 0);
-function Ia(a){var b=0>a?1:0;a=b?-a:a;if(0===a)z=0<1/a?0:2147483648,y=0;else if(isNaN(a))z=2147483647,y=4294967295;else if(1.7976931348623157E308>>0,y=0;else if(2.2250738585072014E-308>a)a/=Math.pow(2,-1074),z=(b<<31|a/4294967296)>>>0,y=a>>>0;else{var c=a,d=0;if(2<=c)for(;2<=c&&1023>d;)d++,c/=2;else for(;1>c&&-1022>>0;y=4503599627370496*a>>>0}}g("jspb.utils.splitFloat64",Ia,void 0);
-function C(a){var b=a.charCodeAt(4),c=a.charCodeAt(5),d=a.charCodeAt(6),f=a.charCodeAt(7);y=a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)>>>0;z=b+(c<<8)+(d<<16)+(f<<24)>>>0}g("jspb.utils.splitHash64",C,void 0);function D(a,b){return 4294967296*b+(a>>>0)}g("jspb.utils.joinUint64",D,void 0);function E(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0));a=D(a,b);return c?-a:a}g("jspb.utils.joinInt64",E,void 0);
-function Ja(a,b,c){var d=b>>31;return c(a<<1^d,(b<<1|a>>>31)^d)}g("jspb.utils.toZigzag64",Ja,void 0);function Ka(a,b){return Ma(a,b,E)}g("jspb.utils.joinZigzag64",Ka,void 0);function Ma(a,b,c){var d=-(a&1);return c((a>>>1|b<<31)^d,b>>>1^d)}g("jspb.utils.fromZigzag64",Ma,void 0);function Na(a){var b=2*(a>>31)+1,c=a>>>23&255;a&=8388607;return 255==c?a?NaN:Infinity*b:0==c?b*Math.pow(2,-149)*a:b*Math.pow(2,c-150)*(a+Math.pow(2,23))}g("jspb.utils.joinFloat32",Na,void 0);
-function Oa(a,b){var c=2*(b>>31)+1,d=b>>>20&2047;a=4294967296*(b&1048575)+a;return 2047==d?a?NaN:Infinity*c:0==d?c*Math.pow(2,-1074)*a:c*Math.pow(2,d-1075)*(a+4503599627370496)}g("jspb.utils.joinFloat64",Oa,void 0);function Pa(a,b){return String.fromCharCode(a>>>0&255,a>>>8&255,a>>>16&255,a>>>24&255,b>>>0&255,b>>>8&255,b>>>16&255,b>>>24&255)}g("jspb.utils.joinHash64",Pa,void 0);g("jspb.utils.DIGITS","0123456789abcdef".split(""),void 0);
-function F(a,b){function c(f,h){f=f?String(f):"";return h?"0000000".slice(f.length)+f:f}if(2097151>=b)return""+D(a,b);var d=(a>>>24|b<<8)>>>0&16777215;b=b>>16&65535;a=(a&16777215)+6777216*d+6710656*b;d+=8147497*b;b*=2;1E7<=a&&(d+=Math.floor(a/1E7),a%=1E7);1E7<=d&&(b+=Math.floor(d/1E7),d%=1E7);return c(b,0)+c(d,b)+c(a,1)}g("jspb.utils.joinUnsignedDecimalString",F,void 0);function G(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b+(0==a?1:0)>>>0);a=F(a,b);return c?"-"+a:a}
-g("jspb.utils.joinSignedDecimalString",G,void 0);function Qa(a,b){C(a);a=y;var c=z;return b?G(a,c):F(a,c)}g("jspb.utils.hash64ToDecimalString",Qa,void 0);g("jspb.utils.hash64ArrayToDecimalStrings",function(a,b){for(var c=Array(a.length),d=0;dB&&(1!==m||0>>=8}function c(){for(var m=0;8>m;m++)f[m]=~f[m]&255}n(0a?48+a:87+a)}
-function Sa(a){return 97<=a?a-97+10:a-48}g("jspb.utils.hash64ToHexString",function(a){var b=Array(18);b[0]="0";b[1]="x";for(var c=0;8>c;c++){var d=a.charCodeAt(7-c);b[2*c+2]=Ra(d>>4);b[2*c+3]=Ra(d&15)}return b.join("")},void 0);g("jspb.utils.hexStringToHash64",function(a){a=a.toLowerCase();n(18==a.length);n("0"==a[0]);n("x"==a[1]);for(var b="",c=0;8>c;c++)b=String.fromCharCode(16*Sa(a.charCodeAt(2*c+2))+Sa(a.charCodeAt(2*c+3)))+b;return b},void 0);
-g("jspb.utils.hash64ToNumber",function(a,b){C(a);a=y;var c=z;return b?E(a,c):D(a,c)},void 0);g("jspb.utils.numberToHash64",function(a){A(a);return Pa(y,z)},void 0);g("jspb.utils.countVarints",function(a,b,c){for(var d=0,f=b;f>7;return c-b-d},void 0);
-g("jspb.utils.countVarintFields",function(a,b,c,d){var f=0;d*=8;if(128>d)for(;b>=7}if(a[b++]!=h)break;for(f++;h=a[b++],0!=(h&128););}return f},void 0);function Ta(a,b,c,d,f){var h=0;if(128>d)for(;b>=7}if(a[b++]!=m)break;h++;b+=f}return h}
-g("jspb.utils.countFixed32Fields",function(a,b,c,d){return Ta(a,b,c,8*d+5,4)},void 0);g("jspb.utils.countFixed64Fields",function(a,b,c,d){return Ta(a,b,c,8*d+1,8)},void 0);g("jspb.utils.countDelimitedFields",function(a,b,c,d){var f=0;for(d=8*d+2;b>=7}if(a[b++]!=h)break;f++;for(var m=0,t=1;h=a[b++],m+=(h&127)*t,t*=128,0!=(h&128););b+=m}return f},void 0);
-g("jspb.utils.debugBytesToTextFormat",function(a){var b='"';if(a){a=Ua(a);for(var c=0;ca[c]&&(b+="0"),b+=a[c].toString(16)}return b+'"'},void 0);
-g("jspb.utils.debugScalarToTextFormat",function(a){if("string"===typeof a){a=String(a);for(var b=['"'],c=0;cf))if(f=d,f in za)d=za[f];else if(f in ya)d=za[f]=ya[f];else{m=f.charCodeAt(0);if(31m)d=f;else{if(256>m){if(d="\\x",16>m||256m&&(d+="0");d+=m.toString(16).toUpperCase()}d=za[f]=d}m=d}b[h]=m}b.push('"');a=b.join("")}else a=a.toString();return a},void 0);
-g("jspb.utils.stringToByteArray",function(a){for(var b=new Uint8Array(a.length),c=0;cVa.length&&Va.push(this)};I.prototype.free=I.prototype.Ca;I.prototype.clone=function(){return Wa(this.b,this.h,this.c-this.h)};I.prototype.clone=I.prototype.clone;
-I.prototype.clear=function(){this.b=null;this.a=this.c=this.h=0;this.v=!1};I.prototype.clear=I.prototype.clear;I.prototype.Y=function(){return this.b};I.prototype.getBuffer=I.prototype.Y;I.prototype.H=function(a,b,c){this.b=Ua(a);this.h=void 0!==b?b:0;this.c=void 0!==c?this.h+c:this.b.length;this.a=this.h};I.prototype.setBlock=I.prototype.H;I.prototype.Db=function(){return this.c};I.prototype.getEnd=I.prototype.Db;I.prototype.setEnd=function(a){this.c=a};I.prototype.setEnd=I.prototype.setEnd;
-I.prototype.reset=function(){this.a=this.h};I.prototype.reset=I.prototype.reset;I.prototype.B=function(){return this.a};I.prototype.getCursor=I.prototype.B;I.prototype.Ma=function(a){this.a=a};I.prototype.setCursor=I.prototype.Ma;I.prototype.advance=function(a){this.a+=a;n(this.a<=this.c)};I.prototype.advance=I.prototype.advance;I.prototype.ya=function(){return this.a==this.c};I.prototype.atEnd=I.prototype.ya;I.prototype.Qb=function(){return this.a>this.c};I.prototype.pastEnd=I.prototype.Qb;
-I.prototype.getError=function(){return this.v||0>this.a||this.a>this.c};I.prototype.getError=I.prototype.getError;I.prototype.w=function(a){for(var b=128,c=0,d=0,f=0;4>f&&128<=b;f++)b=this.b[this.a++],c|=(b&127)<<7*f;128<=b&&(b=this.b[this.a++],c|=(b&127)<<28,d|=(b&127)>>4);if(128<=b)for(f=0;5>f&&128<=b;f++)b=this.b[this.a++],d|=(b&127)<<7*f+3;if(128>b)return a(c>>>0,d>>>0);p("Failed to read varint, encoding is invalid.");this.v=!0};I.prototype.readSplitVarint64=I.prototype.w;
-I.prototype.ea=function(a){return this.w(function(b,c){return Ma(b,c,a)})};I.prototype.readSplitZigzagVarint64=I.prototype.ea;I.prototype.ta=function(a){var b=this.b,c=this.a;this.a+=8;for(var d=0,f=0,h=c+7;h>=c;h--)d=d<<8|b[h],f=f<<8|b[h+4];return a(d,f)};I.prototype.readSplitFixed64=I.prototype.ta;I.prototype.kb=function(){for(;this.b[this.a]&128;)this.a++;this.a++};I.prototype.skipVarint=I.prototype.kb;I.prototype.mb=function(a){for(;128>>=7;this.a--};I.prototype.unskipVarint=I.prototype.mb;
-I.prototype.o=function(){var a=this.b;var b=a[this.a];var c=b&127;if(128>b)return this.a+=1,n(this.a<=this.c),c;b=a[this.a+1];c|=(b&127)<<7;if(128>b)return this.a+=2,n(this.a<=this.c),c;b=a[this.a+2];c|=(b&127)<<14;if(128>b)return this.a+=3,n(this.a<=this.c),c;b=a[this.a+3];c|=(b&127)<<21;if(128>b)return this.a+=4,n(this.a<=this.c),c;b=a[this.a+4];c|=(b&15)<<28;if(128>b)return this.a+=5,n(this.a<=this.c),c>>>0;this.a+=5;128<=a[this.a++]&&128<=a[this.a++]&&128<=a[this.a++]&&128<=a[this.a++]&&128<=
-a[this.a++]&&n(!1);n(this.a<=this.c);return c};I.prototype.readUnsignedVarint32=I.prototype.o;I.prototype.da=function(){return~~this.o()};I.prototype.readSignedVarint32=I.prototype.da;I.prototype.O=function(){return this.o().toString()};I.prototype.Ea=function(){return this.da().toString()};I.prototype.readSignedVarint32String=I.prototype.Ea;I.prototype.Ia=function(){var a=this.o();return a>>>1^-(a&1)};I.prototype.readZigzagVarint32=I.prototype.Ia;I.prototype.Ga=function(){return this.w(D)};
-I.prototype.readUnsignedVarint64=I.prototype.Ga;I.prototype.Ha=function(){return this.w(F)};I.prototype.readUnsignedVarint64String=I.prototype.Ha;I.prototype.sa=function(){return this.w(E)};I.prototype.readSignedVarint64=I.prototype.sa;I.prototype.Fa=function(){return this.w(G)};I.prototype.readSignedVarint64String=I.prototype.Fa;I.prototype.Ja=function(){return this.w(Ka)};I.prototype.readZigzagVarint64=I.prototype.Ja;I.prototype.fb=function(){return this.ea(Pa)};
-I.prototype.readZigzagVarintHash64=I.prototype.fb;I.prototype.Ka=function(){return this.ea(G)};I.prototype.readZigzagVarint64String=I.prototype.Ka;I.prototype.Gc=function(){var a=this.b[this.a];this.a+=1;n(this.a<=this.c);return a};I.prototype.readUint8=I.prototype.Gc;I.prototype.Ec=function(){var a=this.b[this.a],b=this.b[this.a+1];this.a+=2;n(this.a<=this.c);return a<<0|b<<8};I.prototype.readUint16=I.prototype.Ec;
-I.prototype.m=function(){var a=this.b[this.a],b=this.b[this.a+1],c=this.b[this.a+2],d=this.b[this.a+3];this.a+=4;n(this.a<=this.c);return(a<<0|b<<8|c<<16|d<<24)>>>0};I.prototype.readUint32=I.prototype.m;I.prototype.ga=function(){var a=this.m(),b=this.m();return D(a,b)};I.prototype.readUint64=I.prototype.ga;I.prototype.ha=function(){var a=this.m(),b=this.m();return F(a,b)};I.prototype.readUint64String=I.prototype.ha;
-I.prototype.Xb=function(){var a=this.b[this.a];this.a+=1;n(this.a<=this.c);return a<<24>>24};I.prototype.readInt8=I.prototype.Xb;I.prototype.Vb=function(){var a=this.b[this.a],b=this.b[this.a+1];this.a+=2;n(this.a<=this.c);return(a<<0|b<<8)<<16>>16};I.prototype.readInt16=I.prototype.Vb;I.prototype.P=function(){var a=this.b[this.a],b=this.b[this.a+1],c=this.b[this.a+2],d=this.b[this.a+3];this.a+=4;n(this.a<=this.c);return a<<0|b<<8|c<<16|d<<24};I.prototype.readInt32=I.prototype.P;
-I.prototype.ba=function(){var a=this.m(),b=this.m();return E(a,b)};I.prototype.readInt64=I.prototype.ba;I.prototype.ca=function(){var a=this.m(),b=this.m();return G(a,b)};I.prototype.readInt64String=I.prototype.ca;I.prototype.aa=function(){var a=this.m();return Na(a,0)};I.prototype.readFloat=I.prototype.aa;I.prototype.Z=function(){var a=this.m(),b=this.m();return Oa(a,b)};I.prototype.readDouble=I.prototype.Z;I.prototype.pa=function(){return!!this.b[this.a++]};I.prototype.readBool=I.prototype.pa;
-I.prototype.ra=function(){return this.da()};I.prototype.readEnum=I.prototype.ra;
-I.prototype.fa=function(a){var b=this.b,c=this.a;a=c+a;for(var d=[],f="";ch)d.push(h);else if(192>h)continue;else if(224>h){var m=b[c++];d.push((h&31)<<6|m&63)}else if(240>h){m=b[c++];var t=b[c++];d.push((h&15)<<12|(m&63)<<6|t&63)}else if(248>h){m=b[c++];t=b[c++];var B=b[c++];h=(h&7)<<18|(m&63)<<12|(t&63)<<6|B&63;h-=65536;d.push((h>>10&1023)+55296,(h&1023)+56320)}8192<=d.length&&(f+=String.fromCharCode.apply(null,d),d.length=0)}f+=xa(d);this.a=c;return f};
-I.prototype.readString=I.prototype.fa;I.prototype.Dc=function(){var a=this.o();return this.fa(a)};I.prototype.readStringWithLength=I.prototype.Dc;I.prototype.qa=function(a){if(0>a||this.a+a>this.b.length)return this.v=!0,p("Invalid byte length!"),new Uint8Array(0);var b=this.b.subarray(this.a,this.a+a);this.a+=a;n(this.a<=this.c);return b};I.prototype.readBytes=I.prototype.qa;I.prototype.ia=function(){return this.w(Pa)};I.prototype.readVarintHash64=I.prototype.ia;
-I.prototype.$=function(){var a=this.b,b=this.a,c=a[b],d=a[b+1],f=a[b+2],h=a[b+3],m=a[b+4],t=a[b+5],B=a[b+6];a=a[b+7];this.a+=8;return String.fromCharCode(c,d,f,h,m,t,B,a)};I.prototype.readFixedHash64=I.prototype.$;function J(a,b,c){this.a=Wa(a,b,c);this.O=this.a.B();this.b=this.c=-1;this.h=!1;this.v=null}g("jspb.BinaryReader",J,void 0);var K=[];J.clearInstanceCache=function(){K=[]};J.getInstanceCacheLength=function(){return K.length};function Xa(a,b,c){if(K.length){var d=K.pop();a&&d.a.H(a,b,c);return d}return new J(a,b,c)}J.alloc=Xa;J.prototype.zb=Xa;J.prototype.alloc=J.prototype.zb;J.prototype.Ca=function(){this.a.clear();this.b=this.c=-1;this.h=!1;this.v=null;100>K.length&&K.push(this)};
-J.prototype.free=J.prototype.Ca;J.prototype.Fb=function(){return this.O};J.prototype.getFieldCursor=J.prototype.Fb;J.prototype.B=function(){return this.a.B()};J.prototype.getCursor=J.prototype.B;J.prototype.Y=function(){return this.a.Y()};J.prototype.getBuffer=J.prototype.Y;J.prototype.Hb=function(){return this.c};J.prototype.getFieldNumber=J.prototype.Hb;J.prototype.Lb=function(){return this.b};J.prototype.getWireType=J.prototype.Lb;J.prototype.Mb=function(){return 2==this.b};
-J.prototype.isDelimited=J.prototype.Mb;J.prototype.bb=function(){return 4==this.b};J.prototype.isEndGroup=J.prototype.bb;J.prototype.getError=function(){return this.h||this.a.getError()};J.prototype.getError=J.prototype.getError;J.prototype.H=function(a,b,c){this.a.H(a,b,c);this.b=this.c=-1};J.prototype.setBlock=J.prototype.H;J.prototype.reset=function(){this.a.reset();this.b=this.c=-1};J.prototype.reset=J.prototype.reset;J.prototype.advance=function(a){this.a.advance(a)};J.prototype.advance=J.prototype.advance;
-J.prototype.oa=function(){if(this.a.ya())return!1;if(this.getError())return p("Decoder hit an error"),!1;this.O=this.a.B();var a=this.a.o(),b=a>>>3;a&=7;if(0!=a&&5!=a&&1!=a&&2!=a&&3!=a&&4!=a)return p("Invalid wire type: %s (at position %s)",a,this.O),this.h=!0,!1;this.c=b;this.b=a;return!0};J.prototype.nextField=J.prototype.oa;J.prototype.Oa=function(){this.a.mb(this.c<<3|this.b)};J.prototype.unskipHeader=J.prototype.Oa;
-J.prototype.Lc=function(){var a=this.c;for(this.Oa();this.oa()&&this.c==a;)this.C();this.a.ya()||this.Oa()};J.prototype.skipMatchingFields=J.prototype.Lc;J.prototype.lb=function(){0!=this.b?(p("Invalid wire type for skipVarintField"),this.C()):this.a.kb()};J.prototype.skipVarintField=J.prototype.lb;J.prototype.gb=function(){if(2!=this.b)p("Invalid wire type for skipDelimitedField"),this.C();else{var a=this.a.o();this.a.advance(a)}};J.prototype.skipDelimitedField=J.prototype.gb;
-J.prototype.hb=function(){5!=this.b?(p("Invalid wire type for skipFixed32Field"),this.C()):this.a.advance(4)};J.prototype.skipFixed32Field=J.prototype.hb;J.prototype.ib=function(){1!=this.b?(p("Invalid wire type for skipFixed64Field"),this.C()):this.a.advance(8)};J.prototype.skipFixed64Field=J.prototype.ib;J.prototype.jb=function(){var a=this.c;do{if(!this.oa()){p("Unmatched start-group tag: stream EOF");this.h=!0;break}if(4==this.b){this.c!=a&&(p("Unmatched end-group tag"),this.h=!0);break}this.C()}while(1)};
-J.prototype.skipGroup=J.prototype.jb;J.prototype.C=function(){switch(this.b){case 0:this.lb();break;case 1:this.ib();break;case 2:this.gb();break;case 5:this.hb();break;case 3:this.jb();break;default:p("Invalid wire encoding for field.")}};J.prototype.skipField=J.prototype.C;J.prototype.Hc=function(a,b){null===this.v&&(this.v={});n(!this.v[a]);this.v[a]=b};J.prototype.registerReadCallback=J.prototype.Hc;J.prototype.Ic=function(a){n(null!==this.v);a=this.v[a];n(a);return a(this)};
-J.prototype.runReadCallback=J.prototype.Ic;J.prototype.Yb=function(a,b){n(2==this.b);var c=this.a.c,d=this.a.o();d=this.a.B()+d;this.a.setEnd(d);b(a,this);this.a.Ma(d);this.a.setEnd(c)};J.prototype.readMessage=J.prototype.Yb;J.prototype.Ub=function(a,b,c){n(3==this.b);n(this.c==a);c(b,this);this.h||4==this.b||(p("Group submessage did not end with an END_GROUP tag"),this.h=!0)};J.prototype.readGroup=J.prototype.Ub;
-J.prototype.Gb=function(){n(2==this.b);var a=this.a.o(),b=this.a.B(),c=b+a;a=Wa(this.a.Y(),b,a);this.a.Ma(c);return a};J.prototype.getFieldDecoder=J.prototype.Gb;J.prototype.P=function(){n(0==this.b);return this.a.da()};J.prototype.readInt32=J.prototype.P;J.prototype.Wb=function(){n(0==this.b);return this.a.Ea()};J.prototype.readInt32String=J.prototype.Wb;J.prototype.ba=function(){n(0==this.b);return this.a.sa()};J.prototype.readInt64=J.prototype.ba;J.prototype.ca=function(){n(0==this.b);return this.a.Fa()};
-J.prototype.readInt64String=J.prototype.ca;J.prototype.m=function(){n(0==this.b);return this.a.o()};J.prototype.readUint32=J.prototype.m;J.prototype.Fc=function(){n(0==this.b);return this.a.O()};J.prototype.readUint32String=J.prototype.Fc;J.prototype.ga=function(){n(0==this.b);return this.a.Ga()};J.prototype.readUint64=J.prototype.ga;J.prototype.ha=function(){n(0==this.b);return this.a.Ha()};J.prototype.readUint64String=J.prototype.ha;J.prototype.zc=function(){n(0==this.b);return this.a.Ia()};
-J.prototype.readSint32=J.prototype.zc;J.prototype.Ac=function(){n(0==this.b);return this.a.Ja()};J.prototype.readSint64=J.prototype.Ac;J.prototype.Bc=function(){n(0==this.b);return this.a.Ka()};J.prototype.readSint64String=J.prototype.Bc;J.prototype.Rb=function(){n(5==this.b);return this.a.m()};J.prototype.readFixed32=J.prototype.Rb;J.prototype.Sb=function(){n(1==this.b);return this.a.ga()};J.prototype.readFixed64=J.prototype.Sb;J.prototype.Tb=function(){n(1==this.b);return this.a.ha()};
-J.prototype.readFixed64String=J.prototype.Tb;J.prototype.vc=function(){n(5==this.b);return this.a.P()};J.prototype.readSfixed32=J.prototype.vc;J.prototype.wc=function(){n(5==this.b);return this.a.P().toString()};J.prototype.readSfixed32String=J.prototype.wc;J.prototype.xc=function(){n(1==this.b);return this.a.ba()};J.prototype.readSfixed64=J.prototype.xc;J.prototype.yc=function(){n(1==this.b);return this.a.ca()};J.prototype.readSfixed64String=J.prototype.yc;
-J.prototype.aa=function(){n(5==this.b);return this.a.aa()};J.prototype.readFloat=J.prototype.aa;J.prototype.Z=function(){n(1==this.b);return this.a.Z()};J.prototype.readDouble=J.prototype.Z;J.prototype.pa=function(){n(0==this.b);return!!this.a.o()};J.prototype.readBool=J.prototype.pa;J.prototype.ra=function(){n(0==this.b);return this.a.sa()};J.prototype.readEnum=J.prototype.ra;J.prototype.fa=function(){n(2==this.b);var a=this.a.o();return this.a.fa(a)};J.prototype.readString=J.prototype.fa;
-J.prototype.qa=function(){n(2==this.b);var a=this.a.o();return this.a.qa(a)};J.prototype.readBytes=J.prototype.qa;J.prototype.ia=function(){n(0==this.b);return this.a.ia()};J.prototype.readVarintHash64=J.prototype.ia;J.prototype.Cc=function(){n(0==this.b);return this.a.fb()};J.prototype.readSintHash64=J.prototype.Cc;J.prototype.w=function(a){n(0==this.b);return this.a.w(a)};J.prototype.readSplitVarint64=J.prototype.w;
-J.prototype.ea=function(a){n(0==this.b);return this.a.w(function(b,c){return Ma(b,c,a)})};J.prototype.readSplitZigzagVarint64=J.prototype.ea;J.prototype.$=function(){n(1==this.b);return this.a.$()};J.prototype.readFixedHash64=J.prototype.$;J.prototype.ta=function(a){n(1==this.b);return this.a.ta(a)};J.prototype.readSplitFixed64=J.prototype.ta;function L(a,b){n(2==a.b);var c=a.a.o();c=a.a.B()+c;for(var d=[];a.a.B()b.length?c.length:b.length;a.b&&(d[0]=a.b,f=1);for(;fa);for(n(0<=b&&4294967296>b);0>>7|b<<25)>>>0,b>>>=7;this.a.push(a)};S.prototype.writeSplitVarint64=S.prototype.l;
-S.prototype.A=function(a,b){n(a==Math.floor(a));n(b==Math.floor(b));n(0<=a&&4294967296>a);n(0<=b&&4294967296>b);this.s(a);this.s(b)};S.prototype.writeSplitFixed64=S.prototype.A;S.prototype.j=function(a){n(a==Math.floor(a));for(n(0<=a&&4294967296>a);127>>=7;this.a.push(a)};S.prototype.writeUnsignedVarint32=S.prototype.j;S.prototype.M=function(a){n(a==Math.floor(a));n(-2147483648<=a&&2147483648>a);if(0<=a)this.j(a);else{for(var b=0;9>b;b++)this.a.push(a&127|128),a>>=7;this.a.push(1)}};
-S.prototype.writeSignedVarint32=S.prototype.M;S.prototype.va=function(a){n(a==Math.floor(a));n(0<=a&&1.8446744073709552E19>a);A(a);this.l(y,z)};S.prototype.writeUnsignedVarint64=S.prototype.va;S.prototype.ua=function(a){n(a==Math.floor(a));n(-9223372036854775808<=a&&0x7fffffffffffffff>a);A(a);this.l(y,z)};S.prototype.writeSignedVarint64=S.prototype.ua;S.prototype.wa=function(a){n(a==Math.floor(a));n(-2147483648<=a&&2147483648>a);this.j((a<<1^a>>31)>>>0)};S.prototype.writeZigzagVarint32=S.prototype.wa;
-S.prototype.xa=function(a){n(a==Math.floor(a));n(-9223372036854775808<=a&&0x7fffffffffffffff>a);Ga(a);this.l(y,z)};S.prototype.writeZigzagVarint64=S.prototype.xa;S.prototype.Ta=function(a){this.W(H(a))};S.prototype.writeZigzagVarint64String=S.prototype.Ta;S.prototype.W=function(a){var b=this;C(a);Ja(y,z,function(c,d){b.l(c>>>0,d>>>0)})};S.prototype.writeZigzagVarintHash64=S.prototype.W;S.prototype.be=function(a){n(a==Math.floor(a));n(0<=a&&256>a);this.a.push(a>>>0&255)};S.prototype.writeUint8=S.prototype.be;
-S.prototype.ae=function(a){n(a==Math.floor(a));n(0<=a&&65536>a);this.a.push(a>>>0&255);this.a.push(a>>>8&255)};S.prototype.writeUint16=S.prototype.ae;S.prototype.s=function(a){n(a==Math.floor(a));n(0<=a&&4294967296>a);this.a.push(a>>>0&255);this.a.push(a>>>8&255);this.a.push(a>>>16&255);this.a.push(a>>>24&255)};S.prototype.writeUint32=S.prototype.s;S.prototype.V=function(a){n(a==Math.floor(a));n(0<=a&&1.8446744073709552E19>a);Fa(a);this.s(y);this.s(z)};S.prototype.writeUint64=S.prototype.V;
-S.prototype.Qc=function(a){n(a==Math.floor(a));n(-128<=a&&128>a);this.a.push(a>>>0&255)};S.prototype.writeInt8=S.prototype.Qc;S.prototype.Pc=function(a){n(a==Math.floor(a));n(-32768<=a&&32768>a);this.a.push(a>>>0&255);this.a.push(a>>>8&255)};S.prototype.writeInt16=S.prototype.Pc;S.prototype.S=function(a){n(a==Math.floor(a));n(-2147483648<=a&&2147483648>a);this.a.push(a>>>0&255);this.a.push(a>>>8&255);this.a.push(a>>>16&255);this.a.push(a>>>24&255)};S.prototype.writeInt32=S.prototype.S;
-S.prototype.T=function(a){n(a==Math.floor(a));n(-9223372036854775808<=a&&0x7fffffffffffffff>a);A(a);this.A(y,z)};S.prototype.writeInt64=S.prototype.T;S.prototype.ka=function(a){n(a==Math.floor(a));n(-9223372036854775808<=+a&&0x7fffffffffffffff>+a);C(H(a));this.A(y,z)};S.prototype.writeInt64String=S.prototype.ka;S.prototype.L=function(a){n(Infinity===a||-Infinity===a||isNaN(a)||-3.4028234663852886E38<=a&&3.4028234663852886E38>=a);Ha(a);this.s(y)};S.prototype.writeFloat=S.prototype.L;
-S.prototype.J=function(a){n(Infinity===a||-Infinity===a||isNaN(a)||-1.7976931348623157E308<=a&&1.7976931348623157E308>=a);Ia(a);this.s(y);this.s(z)};S.prototype.writeDouble=S.prototype.J;S.prototype.I=function(a){n("boolean"===typeof a||"number"===typeof a);this.a.push(a?1:0)};S.prototype.writeBool=S.prototype.I;S.prototype.R=function(a){n(a==Math.floor(a));n(-2147483648<=a&&2147483648>a);this.M(a)};S.prototype.writeEnum=S.prototype.R;S.prototype.ja=function(a){this.a.push.apply(this.a,a)};
-S.prototype.writeBytes=S.prototype.ja;S.prototype.N=function(a){C(a);this.l(y,z)};S.prototype.writeVarintHash64=S.prototype.N;S.prototype.K=function(a){C(a);this.s(y);this.s(z)};S.prototype.writeFixedHash64=S.prototype.K;
-S.prototype.U=function(a){var b=this.a.length;ta(a);for(var c=0;cd)this.a.push(d);else if(2048>d)this.a.push(d>>6|192),this.a.push(d&63|128);else if(65536>d)if(55296<=d&&56319>=d&&c+1=f&&(d=1024*(d-55296)+f-56320+65536,this.a.push(d>>18|240),this.a.push(d>>12&63|128),this.a.push(d>>6&63|128),this.a.push(d&63|128),c++)}else this.a.push(d>>12|224),this.a.push(d>>6&63|128),this.a.push(d&63|128)}return this.a.length-
-b};S.prototype.writeString=S.prototype.U;function T(a,b){this.lo=a;this.hi=b}g("jspb.arith.UInt64",T,void 0);T.prototype.cmp=function(a){return this.hi>>1|(this.hi&1)<<31)>>>0,this.hi>>>1>>>0)};T.prototype.rightShift=T.prototype.La;T.prototype.Da=function(){return new T(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)};T.prototype.leftShift=T.prototype.Da;
-T.prototype.cb=function(){return!!(this.hi&2147483648)};T.prototype.msb=T.prototype.cb;T.prototype.Ob=function(){return!!(this.lo&1)};T.prototype.lsb=T.prototype.Ob;T.prototype.Ua=function(){return 0==this.lo&&0==this.hi};T.prototype.zero=T.prototype.Ua;T.prototype.add=function(a){return new T((this.lo+a.lo&4294967295)>>>0>>>0,((this.hi+a.hi&4294967295)>>>0)+(4294967296<=this.lo+a.lo?1:0)>>>0)};T.prototype.add=T.prototype.add;
-T.prototype.sub=function(a){return new T((this.lo-a.lo&4294967295)>>>0>>>0,((this.hi-a.hi&4294967295)>>>0)-(0>this.lo-a.lo?1:0)>>>0)};T.prototype.sub=T.prototype.sub;function rb(a,b){var c=a&65535;a>>>=16;var d=b&65535,f=b>>>16;b=c*d+65536*(c*f&65535)+65536*(a*d&65535);for(c=a*f+(c*f>>>16)+(a*d>>>16);4294967296<=b;)b-=4294967296,c+=1;return new T(b>>>0,c>>>0)}T.mul32x32=rb;T.prototype.eb=function(a){var b=rb(this.lo,a);a=rb(this.hi,a);a.hi=a.lo;a.lo=0;return b.add(a)};T.prototype.mul=T.prototype.eb;
-T.prototype.Xa=function(a){if(0==a)return[];var b=new T(0,0),c=new T(this.lo,this.hi);a=new T(a,0);for(var d=new T(1,0);!a.cb();)a=a.Da(),d=d.Da();for(;!d.Ua();)0>=a.cmp(c)&&(b=b.add(d),c=c.sub(a)),a=a.La(),d=d.La();return[b,c]};T.prototype.div=T.prototype.Xa;T.prototype.toString=function(){for(var a="",b=this;!b.Ua();){b=b.Xa(10);var c=b[0];a=b[1].lo+a;b=c}""==a&&(a="0");return a};T.prototype.toString=T.prototype.toString;
-function U(a){for(var b=new T(0,0),c=new T(0,0),d=0;da[d]||"9">>0>>>0,((this.hi+a.hi&4294967295)>>>0)+(4294967296<=this.lo+a.lo?1:0)>>>0)};V.prototype.add=V.prototype.add;
-V.prototype.sub=function(a){return new V((this.lo-a.lo&4294967295)>>>0>>>0,((this.hi-a.hi&4294967295)>>>0)-(0>this.lo-a.lo?1:0)>>>0)};V.prototype.sub=V.prototype.sub;V.prototype.clone=function(){return new V(this.lo,this.hi)};V.prototype.clone=V.prototype.clone;V.prototype.toString=function(){var a=0!=(this.hi&2147483648),b=new T(this.lo,this.hi);a&&(b=(new T(0,0)).sub(b));return(a?"-":"")+b.toString()};V.prototype.toString=V.prototype.toString;
-function sb(a){var b=0>>=7,a.b++;b.push(c);a.b++}W.prototype.pb=function(a,b,c){tb(this,a.subarray(b,c))};W.prototype.writeSerializedMessage=W.prototype.pb;
-W.prototype.Pb=function(a,b,c){null!=a&&null!=b&&null!=c&&this.pb(a,b,c)};W.prototype.maybeWriteSerializedMessage=W.prototype.Pb;W.prototype.reset=function(){this.c=[];this.a.end();this.b=0;this.h=[]};W.prototype.reset=W.prototype.reset;W.prototype.ab=function(){n(0==this.h.length);for(var a=new Uint8Array(this.b+this.a.length()),b=this.c,c=b.length,d=0,f=0;fb),vb(this,a,b))};W.prototype.writeInt32=W.prototype.S;
-W.prototype.ob=function(a,b){null!=b&&(b=parseInt(b,10),n(-2147483648<=b&&2147483648>b),vb(this,a,b))};W.prototype.writeInt32String=W.prototype.ob;W.prototype.T=function(a,b){null!=b&&(n(-9223372036854775808<=b&&0x7fffffffffffffff>b),null!=b&&(Y(this,a,0),this.a.ua(b)))};W.prototype.writeInt64=W.prototype.T;W.prototype.ka=function(a,b){null!=b&&(b=sb(b),Y(this,a,0),this.a.l(b.lo,b.hi))};W.prototype.writeInt64String=W.prototype.ka;
-W.prototype.s=function(a,b){null!=b&&(n(0<=b&&4294967296>b),ub(this,a,b))};W.prototype.writeUint32=W.prototype.s;W.prototype.ub=function(a,b){null!=b&&(b=parseInt(b,10),n(0<=b&&4294967296>b),ub(this,a,b))};W.prototype.writeUint32String=W.prototype.ub;W.prototype.V=function(a,b){null!=b&&(n(0<=b&&1.8446744073709552E19>b),null!=b&&(Y(this,a,0),this.a.va(b)))};W.prototype.writeUint64=W.prototype.V;W.prototype.vb=function(a,b){null!=b&&(b=U(b),Y(this,a,0),this.a.l(b.lo,b.hi))};
-W.prototype.writeUint64String=W.prototype.vb;W.prototype.rb=function(a,b){null!=b&&(n(-2147483648<=b&&2147483648>b),null!=b&&(Y(this,a,0),this.a.wa(b)))};W.prototype.writeSint32=W.prototype.rb;W.prototype.sb=function(a,b){null!=b&&(n(-9223372036854775808<=b&&0x7fffffffffffffff>b),null!=b&&(Y(this,a,0),this.a.xa(b)))};W.prototype.writeSint64=W.prototype.sb;W.prototype.$d=function(a,b){null!=b&&null!=b&&(Y(this,a,0),this.a.W(b))};W.prototype.writeSintHash64=W.prototype.$d;
-W.prototype.Zd=function(a,b){null!=b&&null!=b&&(Y(this,a,0),this.a.Ta(b))};W.prototype.writeSint64String=W.prototype.Zd;W.prototype.Pa=function(a,b){null!=b&&(n(0<=b&&4294967296>b),Y(this,a,5),this.a.s(b))};W.prototype.writeFixed32=W.prototype.Pa;W.prototype.Qa=function(a,b){null!=b&&(n(0<=b&&1.8446744073709552E19>b),Y(this,a,1),this.a.V(b))};W.prototype.writeFixed64=W.prototype.Qa;W.prototype.nb=function(a,b){null!=b&&(b=U(b),Y(this,a,1),this.a.A(b.lo,b.hi))};W.prototype.writeFixed64String=W.prototype.nb;
-W.prototype.Ra=function(a,b){null!=b&&(n(-2147483648<=b&&2147483648>b),Y(this,a,5),this.a.S(b))};W.prototype.writeSfixed32=W.prototype.Ra;W.prototype.Sa=function(a,b){null!=b&&(n(-9223372036854775808<=b&&0x7fffffffffffffff>b),Y(this,a,1),this.a.T(b))};W.prototype.writeSfixed64=W.prototype.Sa;W.prototype.qb=function(a,b){null!=b&&(b=sb(b),Y(this,a,1),this.a.A(b.lo,b.hi))};W.prototype.writeSfixed64String=W.prototype.qb;W.prototype.L=function(a,b){null!=b&&(Y(this,a,5),this.a.L(b))};
-W.prototype.writeFloat=W.prototype.L;W.prototype.J=function(a,b){null!=b&&(Y(this,a,1),this.a.J(b))};W.prototype.writeDouble=W.prototype.J;W.prototype.I=function(a,b){null!=b&&(n("boolean"===typeof b||"number"===typeof b),Y(this,a,0),this.a.I(b))};W.prototype.writeBool=W.prototype.I;W.prototype.R=function(a,b){null!=b&&(n(-2147483648<=b&&2147483648>b),Y(this,a,0),this.a.M(b))};W.prototype.writeEnum=W.prototype.R;W.prototype.U=function(a,b){null!=b&&(a=X(this,a),this.a.U(b),Z(this,a))};
-W.prototype.writeString=W.prototype.U;W.prototype.ja=function(a,b){null!=b&&(b=Ua(b),Y(this,a,2),this.a.j(b.length),tb(this,b))};W.prototype.writeBytes=W.prototype.ja;W.prototype.Rc=function(a,b,c){null!=b&&(a=X(this,a),c(b,this),Z(this,a))};W.prototype.writeMessage=W.prototype.Rc;W.prototype.Sc=function(a,b,c){null!=b&&(Y(this,1,3),Y(this,2,0),this.a.M(a),a=X(this,3),c(b,this),Z(this,a),Y(this,1,4))};W.prototype.writeMessageSet=W.prototype.Sc;
-W.prototype.Oc=function(a,b,c){null!=b&&(Y(this,a,3),c(b,this),Y(this,a,4))};W.prototype.writeGroup=W.prototype.Oc;W.prototype.K=function(a,b){null!=b&&(n(8==b.length),Y(this,a,1),this.a.K(b))};W.prototype.writeFixedHash64=W.prototype.K;W.prototype.N=function(a,b){null!=b&&(n(8==b.length),Y(this,a,0),this.a.N(b))};W.prototype.writeVarintHash64=W.prototype.N;W.prototype.A=function(a,b,c){Y(this,a,1);this.a.A(b,c)};W.prototype.writeSplitFixed64=W.prototype.A;
-W.prototype.l=function(a,b,c){Y(this,a,0);this.a.l(b,c)};W.prototype.writeSplitVarint64=W.prototype.l;W.prototype.tb=function(a,b,c){Y(this,a,0);var d=this.a;Ja(b,c,function(f,h){d.l(f>>>0,h>>>0)})};W.prototype.writeSplitZigzagVarint64=W.prototype.tb;W.prototype.Ed=function(a,b){if(null!=b)for(var c=0;c>>0,t>>>0)});Z(this,a)}};
-W.prototype.writePackedSplitZigzagVarint64=W.prototype.od;W.prototype.dd=function(a,b){if(null!=b&&b.length){a=X(this,a);for(var c=0;cc&&(c=Math.max(c+f,0));c>>0),ua=0;function va(a,b,c){return a.call.apply(a.bind,arguments)}
-function wa(a,b,c){if(!a)throw Error();if(2b?1:0};var I;a:{var Ra=x.navigator;if(Ra){var Sa=Ra.userAgent;if(Sa){I=Sa;break a}}I=""};function Ta(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function Ua(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}var Va="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Wa(a,b){for(var c,d,f=1;fparseFloat(gb)){fb=String(ib);break a}}fb=gb}var $a={};
-function kb(){return Za(function(){for(var a=0,b=Pa(String(fb)).split("."),c=Pa("9").split("."),d=Math.max(b.length,c.length),f=0;0==a&&f>>0);function Bb(a){if("function"===typeof a)return a;a[Jb]||(a[Jb]=function(b){return a.handleEvent(b)});return a[Jb]};function N(){lb.call(this);this.f=new tb(this);this.U=this}B(N,lb);N.prototype[M]=!0;N.prototype.addEventListener=function(a,b,c,d){zb(this,a,b,c,d)};N.prototype.removeEventListener=function(a,b,c,d){Hb(this,a,b,c,d)};function O(a,b){a=a.U;var c=b.type||b;if("string"===typeof b)b=new J(b,a);else if(b instanceof J)b.target=b.target||a;else{var d=b;b=new J(c,a);Wa(b,d)}a=b.a=a;Kb(a,c,!0,b);Kb(a,c,!1,b)}
-function Kb(a,b,c,d){if(b=a.f.a[String(b)]){b=b.concat();for(var f=!0,g=0;g=f.value}d&&(b=b||Ob,d=ac(bc(),a.getName()),"function"===typeof c&&(c=c()),Ub||(Ub=new Tb),a=a.getName(),a=new Vb(b,c,a),Yb(d,a))}function P(a,b){a&&cc(a,Rb,b)};function dc(){}dc.prototype.a=null;function ec(a){var b;(b=a.a)||(b={},fc(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var gc;function hc(){}B(hc,dc);function ic(a){return(a=fc(a))?new ActiveXObject(a):new XMLHttpRequest}function fc(a){if(!a.b&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c2*this.size&&pc(this),!0):!1};function pc(a){if(a.size!=a.j.length){for(var b=0,c=0;b=d.j.length)throw lc;var g=d.j[b++];return a?g:d.o[g]};f.next=f.a.bind(f);return f};function U(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var qc=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function rc(a){N.call(this);this.headers=new oc;this.C=a||null;this.c=!1;this.J=this.a=null;this.P=this.v="";this.g=0;this.l="";this.i=this.N=this.s=this.L=!1;this.h=0;this.w=null;this.m=sc;this.I=this.M=!1}B(rc,N);var sc="";rc.prototype.b=ac(bc(),"goog.net.XhrIo",void 0).g;var tc=/^https?$/i,uc=["POST","PUT"];
-function vc(a,b,c){if(a.a)throw Error("[goog.net.XhrIo] Object is active with another request="+a.v+"; newUri="+b);a.v=b;a.l="";a.g=0;a.P="POST";a.L=!1;a.c=!0;a.a=a.C?ic(a.C):ic(gc);a.J=a.C?ec(a.C):ec(gc);a.a.onreadystatechange=z(a.R,a);try{P(a.b,V(a,"Opening Xhr")),a.N=!0,a.a.open("POST",String(b),!0),a.N=!1}catch(g){P(a.b,V(a,"Error opening Xhr: "+g.message));wc(a,g);return}b=c||"";c=a.headers.clone();var d=c.G().find(function(g){return"content-type"==g.toLowerCase()}),f=x.FormData&&b instanceof
-x.FormData;!(0<=Oa(uc,"POST"))||d||f||c.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");c.forEach(function(g,e){this.a.setRequestHeader(e,g)},a);a.m&&(a.a.responseType=a.m);"withCredentials"in a.a&&a.a.withCredentials!==a.M&&(a.a.withCredentials=a.M);try{xc(a),0>4);64!=e&&(b(g<<4&240|e>>2),64!=h&&b(e<<6&192|h))}}
-function Ic(){if(!Fc){Fc={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Ec[c]=d;for(var f=0;fh&&(h=f.length),e=f.indexOf("?"),
-0>e||e>h?(e=h,k=""):k=f.substring(e+1,h),f=[f.substr(0,e),k,f.substr(h)],h=f[1],f[1]=m?h?h+"&"+m:m:h,f=f[0]+(f[1]?"?"+f[1]:"")+f[2]}else f.a("$httpHeaders",h)}b=(0,d.a)(b.getRequestMessage());d=b.length;m=[0,0,0,0];h=new Uint8Array(5+d);for(e=3;0<=e;e--)m[e]=d%256,d>>>=8;h.set(new Uint8Array(m),1);h.set(b,5);b=h;if("text"==a.a){a=b;var p;void 0===p&&(p=0);Ic();p=Ec[p];b=Array(Math.floor(a.length/3));d=p[64]||"";for(m=h=0;h>2];l=p[(l&3)<<4|q>>4];
-q=p[(q&15)<<2|k>>6];k=p[k&63];b[m++]=e+l+q+k}e=0;k=d;switch(a.length-h){case 2:e=a[h+1],k=p[(e&15)<<2]||d;case 1:a=a[h],b[m]=p[a>>2]+p[(a&3)<<4|e>>4]+k+d}b=b.join("")}else"binary"==a.a&&(c.m="arraybuffer");vc(c,f,b);return g}
-function Qc(a,b,c){var d=!1,f=null,g=!1;a.on("data",function(e){d=!0;f=e});a.on("error",function(e){0==e.code||g||(g=!0,b(e,null))});a.on("status",function(e){0==e.code||g?c&&b(null,null,e):(g=!0,b({code:e.code,message:e.details,metadata:e.metadata},null))});if(c)a.on("metadata",function(e){b(null,null,null,e)});a.on("end",function(){g||(d?c?b(null,f,null,null,!0):b(null,f):b({code:2,message:"Incomplete response"}));c&&b(null,null)})}
-function Oc(a,b){var c=a;b.forEach(function(d){var f=c;c=function(g){return d.intercept(g,f)}});return c}Z.prototype.serverStreaming=Z.prototype.Y;Z.prototype.unaryCall=Z.prototype.unaryCall;Z.prototype.thenableCall=Z.prototype.S;Z.prototype.rpcCall=Z.prototype.X;module.exports.CallOptions=xa;module.exports.MethodDescriptor=ya;module.exports.GrpcWebClientBase=Z;module.exports.RpcError=E;module.exports.StatusCode={OK:0,CANCELLED:1,UNKNOWN:2,INVALID_ARGUMENT:3,DEADLINE_EXCEEDED:4,NOT_FOUND:5,ALREADY_EXISTS:6,PERMISSION_DENIED:7,UNAUTHENTICATED:16,RESOURCE_EXHAUSTED:8,FAILED_PRECONDITION:9,ABORTED:10,OUT_OF_RANGE:11,UNIMPLEMENTED:12,INTERNAL:13,UNAVAILABLE:14,DATA_LOSS:15};module.exports.MethodType={UNARY:"unary",SERVER_STREAMING:"server_streaming",BIDI_STREAMING:"bidi_streaming"};
-Lb="undefined"!==typeof globalThis&&globalThis||self;
-
-}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}]},{},[4]);
diff --git a/libcore/extension/html/rpc/base_pb.js b/libcore/extension/html/rpc/base_pb.js
deleted file mode 100644
index a4a8f12..0000000
--- a/libcore/extension/html/rpc/base_pb.js
+++ /dev/null
@@ -1,460 +0,0 @@
-// source: base.proto
-/**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
-// GENERATED CODE -- DO NOT EDIT!
-/* eslint-disable */
-// @ts-nocheck
-
-var jspb = require('google-protobuf');
-var goog = jspb;
-var global =
- (typeof globalThis !== 'undefined' && globalThis) ||
- (typeof window !== 'undefined' && window) ||
- (typeof global !== 'undefined' && global) ||
- (typeof self !== 'undefined' && self) ||
- (function () { return this; }).call(null) ||
- Function('return this')();
-
-goog.exportSymbol('proto.hiddifyrpc.Empty', null, global);
-goog.exportSymbol('proto.hiddifyrpc.HelloRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.HelloResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ResponseCode', null, global);
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.HelloRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.HelloRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.HelloRequest.displayName = 'proto.hiddifyrpc.HelloRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.HelloResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.HelloResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.HelloResponse.displayName = 'proto.hiddifyrpc.HelloResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.Empty = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.Empty, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.Empty.displayName = 'proto.hiddifyrpc.Empty';
-}
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.HelloRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.HelloRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.HelloRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-name: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.HelloRequest}
- */
-proto.hiddifyrpc.HelloRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.HelloRequest;
- return proto.hiddifyrpc.HelloRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.HelloRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.HelloRequest}
- */
-proto.hiddifyrpc.HelloRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setName(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.HelloRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.HelloRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.HelloRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getName();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string name = 1;
- * @return {string}
- */
-proto.hiddifyrpc.HelloRequest.prototype.getName = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.HelloRequest} returns this
- */
-proto.hiddifyrpc.HelloRequest.prototype.setName = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.HelloResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.HelloResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.HelloResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-message: jspb.Message.getFieldWithDefault(msg, 1, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.HelloResponse}
- */
-proto.hiddifyrpc.HelloResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.HelloResponse;
- return proto.hiddifyrpc.HelloResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.HelloResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.HelloResponse}
- */
-proto.hiddifyrpc.HelloResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.HelloResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.HelloResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.HelloResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.HelloResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
-};
-
-
-/**
- * optional string message = 1;
- * @return {string}
- */
-proto.hiddifyrpc.HelloResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.HelloResponse} returns this
- */
-proto.hiddifyrpc.HelloResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Empty.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Empty.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Empty} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Empty.toObject = function(includeInstance, msg) {
- var f, obj = {
-
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Empty}
- */
-proto.hiddifyrpc.Empty.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Empty;
- return proto.hiddifyrpc.Empty.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Empty} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Empty}
- */
-proto.hiddifyrpc.Empty.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Empty.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Empty.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Empty} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Empty.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
-};
-
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.ResponseCode = {
- OK: 0,
- FAILED: 1
-};
-
-goog.object.extend(exports, proto.hiddifyrpc);
diff --git a/libcore/extension/html/rpc/client.js b/libcore/extension/html/rpc/client.js
deleted file mode 100644
index f81c0ba..0000000
--- a/libcore/extension/html/rpc/client.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const hiddify = require("./hiddify_grpc_web_pb.js");
-const extension = require("./extension_grpc_web_pb.js");
-
-const grpcServerAddress = '/';
-const extensionClient = new extension.ExtensionHostServicePromiseClient(grpcServerAddress, null, null);
-const hiddifyClient = new hiddify.CorePromiseClient(grpcServerAddress, null, null);
-
-module.exports = { extensionClient ,hiddifyClient};
\ No newline at end of file
diff --git a/libcore/extension/html/rpc/connectionPage.js b/libcore/extension/html/rpc/connectionPage.js
deleted file mode 100644
index 0452a88..0000000
--- a/libcore/extension/html/rpc/connectionPage.js
+++ /dev/null
@@ -1,109 +0,0 @@
-const { hiddifyClient } = require('./client.js');
-const hiddify = require("./hiddify_grpc_web_pb.js");
-
-function openConnectionPage() {
-
- $("#extension-list-container").show();
- $("#extension-page-container").hide();
- $("#connection-page").show();
- connect();
- $("#connect-button").click(async () => {
- const hsetting_request = new hiddify.ChangeHiddifySettingsRequest();
- hsetting_request.setHiddifySettingsJson($("#hiddify-settings").val());
- try{
- const hres=await hiddifyClient.changeHiddifySettings(hsetting_request, {});
- }catch(err){
- $("#hiddify-settings").val("")
- console.log(err)
- }
-
- const parse_request = new hiddify.ParseRequest();
- parse_request.setContent($("#config-content").val());
- try{
- const pres=await hiddifyClient.parse(parse_request, {});
- if (pres.getResponseCode() !== hiddify.ResponseCode.OK){
- alert(pres.getMessage());
- return
- }
- $("#config-content").val(pres.getContent());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
-
- const request = new hiddify.StartRequest();
-
- request.setConfigContent($("#config-content").val());
- request.setEnableRawConfig(false);
- try{
- const res=await hiddifyClient.start(request, {});
- console.log(res.getCoreState(),res.getMessage())
- handleCoreStatus(res.getCoreState());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
-
-
- })
-
- $("#disconnect-button").click(async () => {
- const request = new hiddify.Empty();
- try{
- const res=await hiddifyClient.stop(request, {});
- console.log(res.getCoreState(),res.getMessage())
- handleCoreStatus(res.getCoreState());
- }catch(err){
- console.log(err)
- alert(JSON.stringify(err))
- return
- }
- })
-}
-
-
-function connect(){
- const request = new hiddify.Empty();
- const stream = hiddifyClient.coreInfoListener(request, {});
- stream.on('data', (response) => {
- console.log('Receving ',response);
- handleCoreStatus(response);
- });
-
- stream.on('error', (err) => {
- console.error('Error opening extension page:', err);
- // openExtensionPage(extensionId);
- });
-
- stream.on('end', () => {
- console.log('Stream ended');
- setTimeout(connect, 1000);
-
- });
-}
-
-
-function handleCoreStatus(status){
- if (status == hiddify.CoreState.STOPPED){
- $("#connection-before-connect").show();
- $("#connection-connecting").hide();
- }else{
- $("#connection-before-connect").hide();
- $("#connection-connecting").show();
- if (status == hiddify.CoreState.STARTING){
- $("#connection-status").text("Starting");
- $("#connection-status").css("color", "yellow");
- }else if (status == hiddify.CoreState.STOPPING){
- $("#connection-status").text("Stopping");
- $("#connection-status").css("color", "red");
- }else if (status == hiddify.CoreState.STARTED){
- $("#connection-status").text("Connected");
- $("#connection-status").css("color", "green");
- }
- }
-}
-
-
-module.exports = { openConnectionPage };
\ No newline at end of file
diff --git a/libcore/extension/html/rpc/extension.js b/libcore/extension/html/rpc/extension.js
deleted file mode 100644
index fe8ca02..0000000
--- a/libcore/extension/html/rpc/extension.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const { listExtensions } = require('./extensionList.js');
-const { openConnectionPage } = require('./connectionPage.js');
-window.onload = () => {
- listExtensions();
- openConnectionPage();
-};
-
-
diff --git a/libcore/extension/html/rpc/extensionList.js b/libcore/extension/html/rpc/extensionList.js
deleted file mode 100644
index f5978ba..0000000
--- a/libcore/extension/html/rpc/extensionList.js
+++ /dev/null
@@ -1,90 +0,0 @@
-
-const { extensionClient } = require('./client.js');
-const extension = require("./extension_grpc_web_pb.js");
-async function listExtensions() {
- $("#extension-list-container").show();
- $("#extension-page-container").hide();
- $("#connection-page").show();
-
- try {
- const extensionListContainer = document.getElementById('extension-list');
- extensionListContainer.innerHTML = ''; // Clear previous entries
- const response = await extensionClient.listExtensions(new extension.Empty(), {});
-
- const extensionList = response.getExtensionsList();
- extensionList.forEach(ext => {
- const listItem = createExtensionListItem(ext);
- extensionListContainer.appendChild(listItem);
- });
- } catch (err) {
- console.error('Error listing extensions:', err);
- }
-}
-
-function createExtensionListItem(ext) {
- const listItem = document.createElement('li');
- listItem.className = 'list-group-item d-flex justify-content-between align-items-center';
- listItem.setAttribute('data-extension-id', ext.getId());
-
- const contentDiv = document.createElement('div');
-
- const titleElement = document.createElement('span');
- titleElement.innerHTML = `${ext.getTitle()}`;
- contentDiv.appendChild(titleElement);
-
- const descriptionElement = document.createElement('p');
- descriptionElement.className = 'mb-0';
- descriptionElement.textContent = ext.getDescription();
- contentDiv.appendChild(descriptionElement);
- contentDiv.style.width="100%";
- listItem.appendChild(contentDiv);
-
- const switchDiv = createSwitchElement(ext);
- listItem.appendChild(switchDiv);
- const {openExtensionPage} = require('./extensionPage.js');
-
- contentDiv.addEventListener('click', () =>{
- if (!ext.getEnable() ){
- alert("Extension is not enabled")
- return
- }
- openExtensionPage(ext.getId())
- });
-
- return listItem;
-}
-
-function createSwitchElement(ext) {
- const switchDiv = document.createElement('div');
- switchDiv.className = 'form-check form-switch';
-
- const switchButton = document.createElement('input');
- switchButton.type = 'checkbox';
- switchButton.className = 'form-check-input';
- switchButton.checked = ext.getEnable();
- switchButton.addEventListener('change', (e) => {
-
- toggleExtension(ext.getId(), switchButton.checked)
- });
-
- switchDiv.appendChild(switchButton);
- return switchDiv;
-}
-
-async function toggleExtension(extensionId, enable) {
- const request = new extension.EditExtensionRequest();
- request.setExtensionId(extensionId);
- request.setEnable(enable);
-
- try {
- await extensionClient.editExtension(request, {});
- console.log(`Extension ${extensionId} updated to ${enable ? 'enabled' : 'disabled'}`);
- } catch (err) {
- console.error('Error updating extension status:', err);
- }
- listExtensions();
-}
-
-
-
-module.exports = { listExtensions };
\ No newline at end of file
diff --git a/libcore/extension/html/rpc/extensionPage.js b/libcore/extension/html/rpc/extensionPage.js
deleted file mode 100644
index 7140b76..0000000
--- a/libcore/extension/html/rpc/extensionPage.js
+++ /dev/null
@@ -1,87 +0,0 @@
-const { extensionClient } = require('./client.js');
-const extension = require("./extension_grpc_web_pb.js");
-
-const { renderForm } = require('./formRenderer.js');
-const { listExtensions } = require('./extensionList.js');
-var currentExtensionId = undefined;
-function openExtensionPage(extensionId) {
- currentExtensionId = extensionId;
- $("#extension-list-container").hide();
- $("#extension-page-container").show();
- $("#connection-page").hide();
- connect()
-}
-
-function connect() {
- const request = new extension.ExtensionRequest();
- request.setExtensionId(currentExtensionId);
-
- const stream = extensionClient.connect(request, {});
-
- stream.on('data', (response) => {
- console.log('Receiving ', response);
- if (response.getExtensionId() === currentExtensionId) {
- ui = JSON.parse(response.getJsonUi())
- if (response.getType() == proto.hiddifyrpc.ExtensionResponseType.SHOW_DIALOG) {
- renderForm(ui, "dialog", handleSubmitButtonClick, undefined);
- } else {
- renderForm(ui, "", handleSubmitButtonClick, handleStopButtonClick);
- }
-
-
- }
- });
-
- stream.on('error', (err) => {
- console.error('Error opening extension page:', err);
- // openExtensionPage(extensionId);
- });
-
- stream.on('end', () => {
- console.log('Stream ended');
- setTimeout(connect, 1000);
-
- });
-}
-
-async function handleSubmitButtonClick(event, button) {
- event.preventDefault();
- bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
- const request = new extension.SendExtensionDataRequest();
- request.setButton(button);
- if (event.type != 'hidden.bs.modal') {
- const formData = new FormData(event.target.closest('form'));
- const datamap = request.getDataMap()
- formData.forEach((value, key) => {
- datamap.set(key, value);
- });
- }
- request.setExtensionId(currentExtensionId);
-
- try {
- await extensionClient.submitForm(request, {});
- console.log('Form submitted successfully.');
- } catch (err) {
- console.error('Error submitting form:', err);
- }
-}
-
-
-async function handleStopButtonClick(event) {
- event.preventDefault();
- const request = new extension.ExtensionRequest();
- request.setExtensionId(currentExtensionId);
- bootstrap.Modal.getOrCreateInstance("#extension-dialog").hide();
- try {
- await extensionClient.close(request, {});
- console.log('Extension stopped successfully.');
- currentExtensionId = undefined;
- listExtensions(); // Return to the extension list
- } catch (err) {
- console.error('Error stopping extension:', err);
- }
-}
-
-
-
-module.exports = { openExtensionPage };
\ No newline at end of file
diff --git a/libcore/extension/html/rpc/extension_grpc_web_pb.js b/libcore/extension/html/rpc/extension_grpc_web_pb.js
deleted file mode 100644
index 16d808c..0000000
--- a/libcore/extension/html/rpc/extension_grpc_web_pb.js
+++ /dev/null
@@ -1,441 +0,0 @@
-/**
- * @fileoverview gRPC-Web generated client stub for hiddifyrpc
- * @enhanceable
- * @public
- */
-
-// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
-// versions:
-// protoc-gen-grpc-web v1.5.0
-// protoc v5.28.0
-// source: extension.proto
-
-
-/* eslint-disable */
-// @ts-nocheck
-
-
-
-const grpc = {};
-grpc.web = require('grpc-web');
-
-
-var base_pb = require('./base_pb.js')
-const proto = {};
-proto.hiddifyrpc = require('./extension_pb.js');
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.ExtensionHostServiceClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.ExtensionList>}
- */
-const methodDescriptor_ExtensionHostService_ListExtensions = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.ExtensionList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionList)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.listExtensions =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_ListExtensions,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.listExtensions =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/ListExtensions',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_ListExtensions);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionResponse>}
- */
-const methodDescriptor_ExtensionHostService_Connect = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/Connect',
- grpc.web.MethodType.SERVER_STREAMING,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionResponse,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.connect =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Connect',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Connect);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.connect =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Connect',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Connect);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.EditExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_EditExtension = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.EditExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.editExtension =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_EditExtension,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.EditExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.editExtension =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/EditExtension',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_EditExtension);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SendExtensionDataRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_SubmitForm = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SendExtensionDataRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.submitForm =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_SubmitForm,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.submitForm =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/SubmitForm',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_SubmitForm);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_Close = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/Close',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.close =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Close',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Close,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.close =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/Close',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_Close);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ExtensionRequest,
- * !proto.hiddifyrpc.ExtensionActionResult>}
- */
-const methodDescriptor_ExtensionHostService_GetUI = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.ExtensionHostService/GetUI',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ExtensionRequest,
- proto.hiddifyrpc.ExtensionActionResult,
- /**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ExtensionActionResult.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ExtensionActionResult)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.ExtensionHostServiceClient.prototype.getUI =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/GetUI',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_GetUI,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.ExtensionHostServicePromiseClient.prototype.getUI =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.ExtensionHostService/GetUI',
- request,
- metadata || {},
- methodDescriptor_ExtensionHostService_GetUI);
-};
-
-
-module.exports = proto.hiddifyrpc;
-
diff --git a/libcore/extension/html/rpc/extension_pb.js b/libcore/extension/html/rpc/extension_pb.js
deleted file mode 100644
index a0ea9f7..0000000
--- a/libcore/extension/html/rpc/extension_pb.js
+++ /dev/null
@@ -1,1469 +0,0 @@
-// source: extension.proto
-/**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
-// GENERATED CODE -- DO NOT EDIT!
-/* eslint-disable */
-// @ts-nocheck
-
-var jspb = require('google-protobuf');
-var goog = jspb;
-var global =
- (typeof globalThis !== 'undefined' && globalThis) ||
- (typeof window !== 'undefined' && window) ||
- (typeof global !== 'undefined' && global) ||
- (typeof self !== 'undefined' && self) ||
- (function () { return this; }).call(null) ||
- Function('return this')();
-
-var base_pb = require('./base_pb.js');
-goog.object.extend(proto, base_pb);
-goog.exportSymbol('proto.hiddifyrpc.EditExtensionRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.Extension', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionActionResult', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionList', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ExtensionResponseType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SendExtensionDataRequest', null, global);
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionActionResult = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionActionResult, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionActionResult.displayName = 'proto.hiddifyrpc.ExtensionActionResult';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionList = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.ExtensionList.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionList, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionList.displayName = 'proto.hiddifyrpc.ExtensionList';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.EditExtensionRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.EditExtensionRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.EditExtensionRequest.displayName = 'proto.hiddifyrpc.EditExtensionRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.Extension = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.Extension, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.Extension.displayName = 'proto.hiddifyrpc.Extension';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionRequest.displayName = 'proto.hiddifyrpc.ExtensionRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SendExtensionDataRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SendExtensionDataRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SendExtensionDataRequest.displayName = 'proto.hiddifyrpc.SendExtensionDataRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ExtensionResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ExtensionResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ExtensionResponse.displayName = 'proto.hiddifyrpc.ExtensionResponse';
-}
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionActionResult.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionActionResult} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionActionResult.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-code: jspb.Message.getFieldWithDefault(msg, 2, 0),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionActionResult}
- */
-proto.hiddifyrpc.ExtensionActionResult.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionActionResult;
- return proto.hiddifyrpc.ExtensionActionResult.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionActionResult} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionActionResult}
- */
-proto.hiddifyrpc.ExtensionActionResult.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum());
- msg.setCode(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionActionResult.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionActionResult} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionActionResult.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getCode();
- if (f !== 0.0) {
- writer.writeEnum(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional ResponseCode code = 2;
- * @return {!proto.hiddifyrpc.ResponseCode}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getCode = function() {
- return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ResponseCode} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setCode = function(value) {
- return jspb.Message.setProto3EnumField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionActionResult} returns this
- */
-proto.hiddifyrpc.ExtensionActionResult.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.ExtensionList.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionList.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionList.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionList} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionList.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionsList: jspb.Message.toObjectList(msg.getExtensionsList(),
- proto.hiddifyrpc.Extension.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionList}
- */
-proto.hiddifyrpc.ExtensionList.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionList;
- return proto.hiddifyrpc.ExtensionList.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionList} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionList}
- */
-proto.hiddifyrpc.ExtensionList.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.Extension;
- reader.readMessage(value,proto.hiddifyrpc.Extension.deserializeBinaryFromReader);
- msg.addExtensions(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionList.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionList.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionList} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionList.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 1,
- f,
- proto.hiddifyrpc.Extension.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * repeated Extension extensions = 1;
- * @return {!Array}
- */
-proto.hiddifyrpc.ExtensionList.prototype.getExtensionsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.Extension, 1));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.ExtensionList} returns this
-*/
-proto.hiddifyrpc.ExtensionList.prototype.setExtensionsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Extension=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.ExtensionList.prototype.addExtensions = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.hiddifyrpc.Extension, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.ExtensionList} returns this
- */
-proto.hiddifyrpc.ExtensionList.prototype.clearExtensionsList = function() {
- return this.setExtensionsList([]);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.EditExtensionRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.EditExtensionRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.EditExtensionRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-enable: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.EditExtensionRequest}
- */
-proto.hiddifyrpc.EditExtensionRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.EditExtensionRequest;
- return proto.hiddifyrpc.EditExtensionRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.EditExtensionRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.EditExtensionRequest}
- */
-proto.hiddifyrpc.EditExtensionRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnable(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.EditExtensionRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.EditExtensionRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.EditExtensionRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getEnable();
- if (f) {
- writer.writeBool(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.EditExtensionRequest} returns this
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional bool enable = 2;
- * @return {boolean}
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.getEnable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.EditExtensionRequest} returns this
- */
-proto.hiddifyrpc.EditExtensionRequest.prototype.setEnable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Extension.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Extension.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Extension} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Extension.toObject = function(includeInstance, msg) {
- var f, obj = {
-id: jspb.Message.getFieldWithDefault(msg, 1, ""),
-title: jspb.Message.getFieldWithDefault(msg, 2, ""),
-description: jspb.Message.getFieldWithDefault(msg, 3, ""),
-enable: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.Extension.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Extension;
- return proto.hiddifyrpc.Extension.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Extension} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Extension}
- */
-proto.hiddifyrpc.Extension.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setTitle(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setDescription(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnable(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Extension.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Extension.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Extension} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Extension.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getTitle();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDescription();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getEnable();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
-};
-
-
-/**
- * optional string id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string title = 2;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getTitle = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setTitle = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string description = 3;
- * @return {string}
- */
-proto.hiddifyrpc.Extension.prototype.getDescription = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setDescription = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * optional bool enable = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.Extension.prototype.getEnable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.Extension} returns this
- */
-proto.hiddifyrpc.Extension.prototype.setEnable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, undefined) : []
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionRequest}
- */
-proto.hiddifyrpc.ExtensionRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionRequest;
- return proto.hiddifyrpc.ExtensionRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionRequest}
- */
-proto.hiddifyrpc.ExtensionRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = msg.getDataMap();
- reader.readMessage(value, function(message, reader) {
- jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
- });
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getDataMap(true);
- if (f && f.getLength() > 0) {
- f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionRequest} returns this
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * map data = 2;
- * @param {boolean=} opt_noLazyCreate Do not create the map if
- * empty, instead returning `undefined`
- * @return {!jspb.Map}
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.getDataMap = function(opt_noLazyCreate) {
- return /** @type {!jspb.Map} */ (
- jspb.Message.getMapField(this, 2, opt_noLazyCreate,
- null));
-};
-
-
-/**
- * Clears values from the map. The map will be non-null.
- * @return {!proto.hiddifyrpc.ExtensionRequest} returns this
- */
-proto.hiddifyrpc.ExtensionRequest.prototype.clearDataMap = function() {
- this.getDataMap().clear();
- return this;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SendExtensionDataRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SendExtensionDataRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-extensionId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-button: jspb.Message.getFieldWithDefault(msg, 2, ""),
-dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, undefined) : []
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SendExtensionDataRequest;
- return proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setButton(value);
- break;
- case 3:
- var value = msg.getDataMap();
- reader.readMessage(value, function(message, reader) {
- jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
- });
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SendExtensionDataRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SendExtensionDataRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SendExtensionDataRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getButton();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDataMap(true);
- if (f && f.getLength() > 0) {
- f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
- }
-};
-
-
-/**
- * optional string extension_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string button = 2;
- * @return {string}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getButton = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.setButton = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * map data = 3;
- * @param {boolean=} opt_noLazyCreate Do not create the map if
- * empty, instead returning `undefined`
- * @return {!jspb.Map}
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.getDataMap = function(opt_noLazyCreate) {
- return /** @type {!jspb.Map} */ (
- jspb.Message.getMapField(this, 3, opt_noLazyCreate,
- null));
-};
-
-
-/**
- * Clears values from the map. The map will be non-null.
- * @return {!proto.hiddifyrpc.SendExtensionDataRequest} returns this
- */
-proto.hiddifyrpc.SendExtensionDataRequest.prototype.clearDataMap = function() {
- this.getDataMap().clear();
- return this;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.ExtensionResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.ExtensionResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-type: jspb.Message.getFieldWithDefault(msg, 1, 0),
-extensionId: jspb.Message.getFieldWithDefault(msg, 2, ""),
-jsonUi: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.ExtensionResponse}
- */
-proto.hiddifyrpc.ExtensionResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.ExtensionResponse;
- return proto.hiddifyrpc.ExtensionResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.ExtensionResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.ExtensionResponse}
- */
-proto.hiddifyrpc.ExtensionResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.ExtensionResponseType} */ (reader.readEnum());
- msg.setType(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setExtensionId(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setJsonUi(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.ExtensionResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.ExtensionResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.ExtensionResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getType();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getExtensionId();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getJsonUi();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional ExtensionResponseType type = 1;
- * @return {!proto.hiddifyrpc.ExtensionResponseType}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getType = function() {
- return /** @type {!proto.hiddifyrpc.ExtensionResponseType} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ExtensionResponseType} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setType = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional string extension_id = 2;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getExtensionId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setExtensionId = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string json_ui = 3;
- * @return {string}
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.getJsonUi = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.ExtensionResponse} returns this
- */
-proto.hiddifyrpc.ExtensionResponse.prototype.setJsonUi = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * @enum {number}
- */
-proto.hiddifyrpc.ExtensionResponseType = {
- NOTHING: 0,
- UPDATE_UI: 1,
- SHOW_DIALOG: 2,
- END: 3
-};
-
-goog.object.extend(exports, proto.hiddifyrpc);
diff --git a/libcore/extension/html/rpc/formRenderer.js b/libcore/extension/html/rpc/formRenderer.js
deleted file mode 100644
index 3f7128d..0000000
--- a/libcore/extension/html/rpc/formRenderer.js
+++ /dev/null
@@ -1,239 +0,0 @@
-
-const ansi_up = new AnsiUp({
- escape_html: false,
-
-});
-
-
-function renderForm(json, dialog, submitAction, stopAction) {
- const container = document.getElementById(`extension-page-container${dialog}`);
- const formId = `dynamicForm${json.id}${dialog}`;
-
- const existingForm = document.getElementById(formId);
- if (existingForm) {
- existingForm.remove();
- }
- const form = document.createElement('form');
- container.appendChild(form);
- form.id = formId;
-
- if (dialog === "dialog") {
- document.getElementById("modalLabel").textContent = json.title;
- } else {
- const titleElement = createTitleElement(json);
- const stopBtn = document.createElement('button');
- stopBtn.type = 'button';
- stopBtn.className = 'btn btn-danger';
- stopBtn.textContent = 'Close';
- stopBtn.addEventListener('click', stopAction);
- form.appendChild(stopBtn);
- form.appendChild(titleElement);
- }
- addElementsToForm(form, json,submitAction);
-
- if (dialog === "dialog") {
- document.getElementById("modal-footer").innerHTML = '';
- // if ($(form.lastChild).find("button").length > 0) {
-
- // document.getElementById("modal-footer").appendChild(form.lastChild);
-
- // }
- const extensionDialog = document.getElementById("extension-dialog");
- const dialog = bootstrap.Modal.getOrCreateInstance(extensionDialog);
- dialog.show();
- extensionDialog.addEventListener("hidden.bs.modal", (e)=>submitAction(e,"CloseDialog"));
- }
-
-}
-
-function addElementsToForm(form, json,submitAction) {
-
-
-
- const description = document.createElement('p');
- description.textContent = json.description;
- form.appendChild(description);
- if (json.fields) {
- json.fields.forEach(field => {
- div=document.createElement("div")
- div.classList.add("row")
- form.appendChild(div)
- for (let i = 0; i < field.length; i++) {
- const formGroup = createFormGroup(field[i], submitAction);
- formGroup.classList.add("col")
- div.appendChild(formGroup);
- }
- });
- }
-
- return form;
-}
-
-function createTitleElement(json) {
- const title = document.createElement('h1');
- title.textContent = json.title;
- return title;
-}
-
-function createFormGroup(field, submitAction) {
- const formGroup = document.createElement('div');
- formGroup.classList.add('mb-3');
- if (field.type == "Button") {
- const button = document.createElement('button');
- button.textContent = field.label;
- button.name=field.key
- button.classList.add('btn');
- if (field.key == "Submit") {
- button.classList.add('btn-primary');
- } else if (field.key == "Cancel") {
- button.classList.add('btn-secondary');
- }else{
- button.classList.add('btn', 'btn-outline-secondary');
- }
-
- button.addEventListener('click', (e) => submitAction(e,field.key));
- formGroup.appendChild(button);
- } else {
- if (field.label && !field.labelHidden) {
- const label = document.createElement('label');
- label.textContent = field.label;
- label.setAttribute('for', field.key);
- formGroup.appendChild(label);
- }
-
- const input = createInputElement(field);
- formGroup.appendChild(input);
- }
- return formGroup;
-}
-
-function createInputElement(field) {
- let input;
-
- switch (field.type) {
- case "Console":
- input = document.createElement('pre');
- input.innerHTML = ansi_up.ansi_to_html(field.value || field.placeholder || '');
- input.style.maxHeight = field.lines * 20 + 'px';
- break;
- case "TextArea":
- input = document.createElement('textarea');
- input.rows = field.lines || 3;
- input.textContent = field.value || '';
- break;
-
- case "Checkbox":
- case "RadioButton":
- input = createCheckboxOrRadioGroup(field);
- break;
-
- case "Switch":
- input = createSwitchElement(field);
- break;
-
- case "Select":
- input = document.createElement('select');
- field.items.forEach(item => {
- const option = document.createElement('option');
- option.value = item.value;
- option.text = item.label;
- input.appendChild(option);
- });
- break;
-
- default:
- input = document.createElement('input');
- input.type = field.type.toLowerCase();
- input.value = field.value;
- break;
- }
-
- input.id = field.key;
- input.name = field.key;
- if (field.readOnly) input.readOnly = true;
- if (field.type == "Checkbox" || field.type == "RadioButton" || field.type == "Switch") {
-
- } else {
- if (field.required) input.required = true;
- input.classList.add('form-control');
- if (field.placeholder) input.placeholder = field.placeholder;
- }
- return input;
-}
-
-function createCheckboxOrRadioGroup(field) {
- const wrapper = document.createDocumentFragment();
-
- field.items.forEach(item => {
- const inputWrapper = document.createElement('div');
- inputWrapper.classList.add('form-check');
-
- const input = document.createElement('input');
- input.type = field.type === "Checkbox" ? 'checkbox' : 'radio';
- input.classList.add('form-check-input');
- input.id = `${field.key}_${item.value}`;
- input.name = field.key; // Grouping by name for radio buttons
- input.value = item.value;
- input.checked = field.value === item.value;
-
- const itemLabel = document.createElement('label');
- itemLabel.classList.add('form-check-label');
- itemLabel.setAttribute('for', input.id);
- itemLabel.textContent = item.label;
-
- inputWrapper.appendChild(input);
- inputWrapper.appendChild(itemLabel);
- wrapper.appendChild(inputWrapper);
- });
-
- return wrapper;
-}
-
-function createSwitchElement(field) {
- const switchWrapper = document.createElement('div');
- switchWrapper.classList.add('form-check', 'form-switch');
-
- const input = document.createElement('input');
- input.type = 'checkbox';
- input.classList.add('form-check-input');
- input.setAttribute('role', 'switch');
- input.id = field.key;
- input.checked = field.value === "true";
-
- const label = document.createElement('label');
- label.classList.add('form-check-label');
- label.setAttribute('for', field.key);
- label.textContent = field.label;
-
- switchWrapper.appendChild(input);
- switchWrapper.appendChild(label);
-
- return switchWrapper;
-}
-
-function createButtonGroup(json, submitAction, cancelAction) {
- const buttonGroup = document.createElement('div');
- buttonGroup.classList.add('btn-group');
- json.buttons.forEach(buttonText => {
- const btn = document.createElement('button');
- btn.classList.add('btn', "btn-default");
- buttonGroup.appendChild(btn);
- btn.textContent = buttonText
- if (buttonText == "Cancel") {
- btn.classList.add('btn-secondary');
- btn.addEventListener('click', cancelAction);
- } else {
- if (buttonText == "Submit" || buttonText == "Ok")
- btn.classList.add('btn-primary');
- btn.addEventListener('click', submitAction);
- }
-
- })
-
-
-
- return buttonGroup;
-}
-
-
-module.exports = { renderForm };
\ No newline at end of file
diff --git a/libcore/extension/html/rpc/hiddify_grpc_web_pb.js b/libcore/extension/html/rpc/hiddify_grpc_web_pb.js
deleted file mode 100644
index 0b44622..0000000
--- a/libcore/extension/html/rpc/hiddify_grpc_web_pb.js
+++ /dev/null
@@ -1,1501 +0,0 @@
-/**
- * @fileoverview gRPC-Web generated client stub for hiddifyrpc
- * @enhanceable
- * @public
- */
-
-// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
-// versions:
-// protoc-gen-grpc-web v1.5.0
-// protoc v5.28.0
-// source: hiddify.proto
-
-
-/* eslint-disable */
-// @ts-nocheck
-
-
-
-const grpc = {};
-grpc.web = require('grpc-web');
-
-
-var base_pb = require('./base_pb.js')
-const proto = {};
-proto.hiddifyrpc = require('./hiddify_pb.js');
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.HelloClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.HelloPromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.HelloRequest,
- * !proto.hiddifyrpc.HelloResponse>}
- */
-const methodDescriptor_Hello_SayHello = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Hello/SayHello',
- grpc.web.MethodType.UNARY,
- base_pb.HelloRequest,
- base_pb.HelloResponse,
- /**
- * @param {!proto.hiddifyrpc.HelloRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- base_pb.HelloResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.HelloRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.HelloResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.HelloClient.prototype.sayHello =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Hello/SayHello',
- request,
- metadata || {},
- methodDescriptor_Hello_SayHello,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.HelloRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.HelloPromiseClient.prototype.sayHello =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Hello/SayHello',
- request,
- metadata || {},
- methodDescriptor_Hello_SayHello);
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.CoreClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.CorePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Start = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Start',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.start =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Start',
- request,
- metadata || {},
- methodDescriptor_Core_Start,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.start =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Start',
- request,
- metadata || {},
- methodDescriptor_Core_Start);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_CoreInfoListener = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/CoreInfoListener',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.coreInfoListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/CoreInfoListener',
- request,
- metadata || {},
- methodDescriptor_Core_CoreInfoListener);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.coreInfoListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/CoreInfoListener',
- request,
- metadata || {},
- methodDescriptor_Core_CoreInfoListener);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.OutboundGroupList>}
- */
-const methodDescriptor_Core_OutboundsInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/OutboundsInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.OutboundGroupList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.OutboundGroupList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.outboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/OutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_OutboundsInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.outboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/OutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_OutboundsInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.OutboundGroupList>}
- */
-const methodDescriptor_Core_MainOutboundsInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/MainOutboundsInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.OutboundGroupList,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.OutboundGroupList.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.mainOutboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/MainOutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_MainOutboundsInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.mainOutboundsInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/MainOutboundsInfo',
- request,
- metadata || {},
- methodDescriptor_Core_MainOutboundsInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.SystemInfo>}
- */
-const methodDescriptor_Core_GetSystemInfo = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GetSystemInfo',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.SystemInfo,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.SystemInfo.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.getSystemInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemInfo',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemInfo);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.getSystemInfo =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemInfo',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemInfo);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SetupRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_Setup = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Setup',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SetupRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SetupRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SetupRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.setup =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Setup',
- request,
- metadata || {},
- methodDescriptor_Core_Setup,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SetupRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.setup =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Setup',
- request,
- metadata || {},
- methodDescriptor_Core_Setup);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ParseRequest,
- * !proto.hiddifyrpc.ParseResponse>}
- */
-const methodDescriptor_Core_Parse = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Parse',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ParseRequest,
- proto.hiddifyrpc.ParseResponse,
- /**
- * @param {!proto.hiddifyrpc.ParseRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.ParseResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ParseRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.ParseResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.parse =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Parse',
- request,
- metadata || {},
- methodDescriptor_Core_Parse,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ParseRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.parse =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Parse',
- request,
- metadata || {},
- methodDescriptor_Core_Parse);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.ChangeHiddifySettingsRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_ChangeHiddifySettings = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.ChangeHiddifySettingsRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.changeHiddifySettings =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- request,
- metadata || {},
- methodDescriptor_Core_ChangeHiddifySettings,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ChangeHiddifySettingsRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.changeHiddifySettings =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/ChangeHiddifySettings',
- request,
- metadata || {},
- methodDescriptor_Core_ChangeHiddifySettings);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_StartService = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/StartService',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.startService =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/StartService',
- request,
- metadata || {},
- methodDescriptor_Core_StartService,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.startService =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/StartService',
- request,
- metadata || {},
- methodDescriptor_Core_StartService);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Stop = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Stop',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.stop =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Stop',
- request,
- metadata || {},
- methodDescriptor_Core_Stop,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.stop =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Stop',
- request,
- metadata || {},
- methodDescriptor_Core_Stop);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.StartRequest,
- * !proto.hiddifyrpc.CoreInfoResponse>}
- */
-const methodDescriptor_Core_Restart = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/Restart',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.StartRequest,
- proto.hiddifyrpc.CoreInfoResponse,
- /**
- * @param {!proto.hiddifyrpc.StartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.CoreInfoResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.CoreInfoResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.restart =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/Restart',
- request,
- metadata || {},
- methodDescriptor_Core_Restart,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.StartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.restart =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/Restart',
- request,
- metadata || {},
- methodDescriptor_Core_Restart);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SelectOutboundRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_SelectOutbound = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/SelectOutbound',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SelectOutboundRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.selectOutbound =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/SelectOutbound',
- request,
- metadata || {},
- methodDescriptor_Core_SelectOutbound,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SelectOutboundRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.selectOutbound =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/SelectOutbound',
- request,
- metadata || {},
- methodDescriptor_Core_SelectOutbound);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.UrlTestRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_UrlTest = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/UrlTest',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.UrlTestRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.urlTest =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/UrlTest',
- request,
- metadata || {},
- methodDescriptor_Core_UrlTest,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.UrlTestRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.urlTest =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/UrlTest',
- request,
- metadata || {},
- methodDescriptor_Core_UrlTest);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.GenerateWarpConfigRequest,
- * !proto.hiddifyrpc.WarpGenerationResponse>}
- */
-const methodDescriptor_Core_GenerateWarpConfig = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GenerateWarpConfig',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.GenerateWarpConfigRequest,
- proto.hiddifyrpc.WarpGenerationResponse,
- /**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.WarpGenerationResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.generateWarpConfig =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/GenerateWarpConfig',
- request,
- metadata || {},
- methodDescriptor_Core_GenerateWarpConfig,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.GenerateWarpConfigRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.generateWarpConfig =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/GenerateWarpConfig',
- request,
- metadata || {},
- methodDescriptor_Core_GenerateWarpConfig);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.SystemProxyStatus>}
- */
-const methodDescriptor_Core_GetSystemProxyStatus = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.SystemProxyStatus,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.SystemProxyStatus.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.SystemProxyStatus)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.getSystemProxyStatus =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemProxyStatus,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.getSystemProxyStatus =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/GetSystemProxyStatus',
- request,
- metadata || {},
- methodDescriptor_Core_GetSystemProxyStatus);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.SetSystemProxyEnabledRequest,
- * !proto.hiddifyrpc.Response>}
- */
-const methodDescriptor_Core_SetSystemProxyEnabled = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.SetSystemProxyEnabledRequest,
- proto.hiddifyrpc.Response,
- /**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.Response.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.Response)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.setSystemProxyEnabled =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- request,
- metadata || {},
- methodDescriptor_Core_SetSystemProxyEnabled,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.SetSystemProxyEnabledRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.setSystemProxyEnabled =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.Core/SetSystemProxyEnabled',
- request,
- metadata || {},
- methodDescriptor_Core_SetSystemProxyEnabled);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.LogMessage>}
- */
-const methodDescriptor_Core_LogListener = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.Core/LogListener',
- grpc.web.MethodType.SERVER_STREAMING,
- base_pb.Empty,
- proto.hiddifyrpc.LogMessage,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.LogMessage.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CoreClient.prototype.logListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/LogListener',
- request,
- metadata || {},
- methodDescriptor_Core_LogListener);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!grpc.web.ClientReadableStream}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.CorePromiseClient.prototype.logListener =
- function(request, metadata) {
- return this.client_.serverStreaming(this.hostname_ +
- '/hiddifyrpc.Core/LogListener',
- request,
- metadata || {},
- methodDescriptor_Core_LogListener);
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.TunnelServiceClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @param {string} hostname
- * @param {?Object} credentials
- * @param {?grpc.web.ClientOptions} options
- * @constructor
- * @struct
- * @final
- */
-proto.hiddifyrpc.TunnelServicePromiseClient =
- function(hostname, credentials, options) {
- if (!options) options = {};
- options.format = 'text';
-
- /**
- * @private @const {!grpc.web.GrpcWebClientBase} The client
- */
- this.client_ = new grpc.web.GrpcWebClientBase(options);
-
- /**
- * @private @const {string} The hostname
- */
- this.hostname_ = hostname.replace(/\/+$/, '');
-
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.TunnelStartRequest,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Start = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Start',
- grpc.web.MethodType.UNARY,
- proto.hiddifyrpc.TunnelStartRequest,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.start =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Start',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Start,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.TunnelStartRequest} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.start =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Start',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Start);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Stop = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Stop',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.stop =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Stop',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Stop,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.stop =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Stop',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Stop);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Status = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Status',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.status =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Status',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Status,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.status =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Status',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Status);
-};
-
-
-/**
- * @const
- * @type {!grpc.web.MethodDescriptor<
- * !proto.hiddifyrpc.Empty,
- * !proto.hiddifyrpc.TunnelResponse>}
- */
-const methodDescriptor_TunnelService_Exit = new grpc.web.MethodDescriptor(
- '/hiddifyrpc.TunnelService/Exit',
- grpc.web.MethodType.UNARY,
- base_pb.Empty,
- proto.hiddifyrpc.TunnelResponse,
- /**
- * @param {!proto.hiddifyrpc.Empty} request
- * @return {!Uint8Array}
- */
- function(request) {
- return request.serializeBinary();
- },
- proto.hiddifyrpc.TunnelResponse.deserializeBinary
-);
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object} metadata User defined
- * call metadata
- * @param {function(?grpc.web.RpcError, ?proto.hiddifyrpc.TunnelResponse)}
- * callback The callback function(error, response)
- * @return {!grpc.web.ClientReadableStream|undefined}
- * The XHR Node Readable Stream
- */
-proto.hiddifyrpc.TunnelServiceClient.prototype.exit =
- function(request, metadata, callback) {
- return this.client_.rpcCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Exit',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Exit,
- callback);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.Empty} request The
- * request proto
- * @param {?Object=} metadata User defined
- * call metadata
- * @return {!Promise}
- * Promise that resolves to the response
- */
-proto.hiddifyrpc.TunnelServicePromiseClient.prototype.exit =
- function(request, metadata) {
- return this.client_.unaryCall(this.hostname_ +
- '/hiddifyrpc.TunnelService/Exit',
- request,
- metadata || {},
- methodDescriptor_TunnelService_Exit);
-};
-
-
-module.exports = proto.hiddifyrpc;
-
diff --git a/libcore/extension/html/rpc/hiddify_pb.js b/libcore/extension/html/rpc/hiddify_pb.js
deleted file mode 100644
index 5532c9b..0000000
--- a/libcore/extension/html/rpc/hiddify_pb.js
+++ /dev/null
@@ -1,5393 +0,0 @@
-// source: hiddify.proto
-/**
- * @fileoverview
- * @enhanceable
- * @suppress {missingRequire} reports error on implicit type usages.
- * @suppress {messageConventions} JS Compiler reports an error if a variable or
- * field starts with 'MSG_' and isn't a translatable message.
- * @public
- */
-// GENERATED CODE -- DO NOT EDIT!
-/* eslint-disable */
-// @ts-nocheck
-
-var jspb = require('google-protobuf');
-var goog = jspb;
-var global =
- (typeof globalThis !== 'undefined' && globalThis) ||
- (typeof window !== 'undefined' && window) ||
- (typeof global !== 'undefined' && global) ||
- (typeof self !== 'undefined' && self) ||
- (function () { return this; }).call(null) ||
- Function('return this')();
-
-var base_pb = require('./base_pb.js');
-goog.object.extend(proto, base_pb);
-goog.exportSymbol('proto.hiddifyrpc.ChangeHiddifySettingsRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.CoreInfoResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.CoreState', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateConfigRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateConfigResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.GenerateWarpConfigRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogLevel', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogMessage', null, global);
-goog.exportSymbol('proto.hiddifyrpc.LogType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.MessageType', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroup', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroupItem', null, global);
-goog.exportSymbol('proto.hiddifyrpc.OutboundGroupList', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ParseRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.ParseResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.Response', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SelectOutboundRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SetSystemProxyEnabledRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SetupRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.StartRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.StopRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SystemInfo', null, global);
-goog.exportSymbol('proto.hiddifyrpc.SystemProxyStatus', null, global);
-goog.exportSymbol('proto.hiddifyrpc.TunnelResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.TunnelStartRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.UrlTestRequest', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpAccount', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpGenerationResponse', null, global);
-goog.exportSymbol('proto.hiddifyrpc.WarpWireguardConfig', null, global);
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.CoreInfoResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.CoreInfoResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.CoreInfoResponse.displayName = 'proto.hiddifyrpc.CoreInfoResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.StartRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.StartRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.StartRequest.displayName = 'proto.hiddifyrpc.StartRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SetupRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SetupRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SetupRequest.displayName = 'proto.hiddifyrpc.SetupRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.Response = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.Response, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.Response.displayName = 'proto.hiddifyrpc.Response';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SystemInfo = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SystemInfo, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SystemInfo.displayName = 'proto.hiddifyrpc.SystemInfo';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroupItem = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroupItem, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroupItem.displayName = 'proto.hiddifyrpc.OutboundGroupItem';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroup = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroup.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroup, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroup.displayName = 'proto.hiddifyrpc.OutboundGroup';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.OutboundGroupList = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, proto.hiddifyrpc.OutboundGroupList.repeatedFields_, null);
-};
-goog.inherits(proto.hiddifyrpc.OutboundGroupList, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.OutboundGroupList.displayName = 'proto.hiddifyrpc.OutboundGroupList';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpAccount = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpAccount, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpAccount.displayName = 'proto.hiddifyrpc.WarpAccount';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpWireguardConfig = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpWireguardConfig, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpWireguardConfig.displayName = 'proto.hiddifyrpc.WarpWireguardConfig';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.WarpGenerationResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.WarpGenerationResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.WarpGenerationResponse.displayName = 'proto.hiddifyrpc.WarpGenerationResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SystemProxyStatus = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SystemProxyStatus, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SystemProxyStatus.displayName = 'proto.hiddifyrpc.SystemProxyStatus';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ParseRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ParseRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ParseRequest.displayName = 'proto.hiddifyrpc.ParseRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ParseResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ParseResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ParseResponse.displayName = 'proto.hiddifyrpc.ParseResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.ChangeHiddifySettingsRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.ChangeHiddifySettingsRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.ChangeHiddifySettingsRequest.displayName = 'proto.hiddifyrpc.ChangeHiddifySettingsRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateConfigRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateConfigRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateConfigRequest.displayName = 'proto.hiddifyrpc.GenerateConfigRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateConfigResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateConfigResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateConfigResponse.displayName = 'proto.hiddifyrpc.GenerateConfigResponse';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SelectOutboundRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SelectOutboundRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SelectOutboundRequest.displayName = 'proto.hiddifyrpc.SelectOutboundRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.UrlTestRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.UrlTestRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.UrlTestRequest.displayName = 'proto.hiddifyrpc.UrlTestRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.GenerateWarpConfigRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.GenerateWarpConfigRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.GenerateWarpConfigRequest.displayName = 'proto.hiddifyrpc.GenerateWarpConfigRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.SetSystemProxyEnabledRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.SetSystemProxyEnabledRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.SetSystemProxyEnabledRequest.displayName = 'proto.hiddifyrpc.SetSystemProxyEnabledRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.LogMessage = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.LogMessage, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.LogMessage.displayName = 'proto.hiddifyrpc.LogMessage';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.StopRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.StopRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.StopRequest.displayName = 'proto.hiddifyrpc.StopRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.TunnelStartRequest = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.TunnelStartRequest, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.TunnelStartRequest.displayName = 'proto.hiddifyrpc.TunnelStartRequest';
-}
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.hiddifyrpc.TunnelResponse = function(opt_data) {
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.hiddifyrpc.TunnelResponse, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
- /**
- * @public
- * @override
- */
- proto.hiddifyrpc.TunnelResponse.displayName = 'proto.hiddifyrpc.TunnelResponse';
-}
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.CoreInfoResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.CoreInfoResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-coreState: jspb.Message.getFieldWithDefault(msg, 1, 0),
-messageType: jspb.Message.getFieldWithDefault(msg, 2, 0),
-message: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.CoreInfoResponse}
- */
-proto.hiddifyrpc.CoreInfoResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.CoreInfoResponse;
- return proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.CoreInfoResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.CoreInfoResponse}
- */
-proto.hiddifyrpc.CoreInfoResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.CoreState} */ (reader.readEnum());
- msg.setCoreState(value);
- break;
- case 2:
- var value = /** @type {!proto.hiddifyrpc.MessageType} */ (reader.readEnum());
- msg.setMessageType(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.CoreInfoResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.CoreInfoResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getCoreState();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getMessageType();
- if (f !== 0.0) {
- writer.writeEnum(
- 2,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional CoreState core_state = 1;
- * @return {!proto.hiddifyrpc.CoreState}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getCoreState = function() {
- return /** @type {!proto.hiddifyrpc.CoreState} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.CoreState} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setCoreState = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional MessageType message_type = 2;
- * @return {!proto.hiddifyrpc.MessageType}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getMessageType = function() {
- return /** @type {!proto.hiddifyrpc.MessageType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.MessageType} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setMessageType = function(value) {
- return jspb.Message.setProto3EnumField(this, 2, value);
-};
-
-
-/**
- * optional string message = 3;
- * @return {string}
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.CoreInfoResponse} returns this
- */
-proto.hiddifyrpc.CoreInfoResponse.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.StartRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.StartRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.StartRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StartRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-configPath: jspb.Message.getFieldWithDefault(msg, 1, ""),
-configContent: jspb.Message.getFieldWithDefault(msg, 2, ""),
-disableMemoryLimit: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
-delayStart: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
-enableOldCommandServer: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
-enableRawConfig: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.StartRequest}
- */
-proto.hiddifyrpc.StartRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.StartRequest;
- return proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.StartRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.StartRequest}
- */
-proto.hiddifyrpc.StartRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigPath(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setConfigContent(value);
- break;
- case 3:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDisableMemoryLimit(value);
- break;
- case 4:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setDelayStart(value);
- break;
- case 5:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnableOldCommandServer(value);
- break;
- case 6:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnableRawConfig(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.StartRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.StartRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.StartRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.StartRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getConfigPath();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getConfigContent();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getDisableMemoryLimit();
- if (f) {
- writer.writeBool(
- 3,
- f
- );
- }
- f = message.getDelayStart();
- if (f) {
- writer.writeBool(
- 4,
- f
- );
- }
- f = message.getEnableOldCommandServer();
- if (f) {
- writer.writeBool(
- 5,
- f
- );
- }
- f = message.getEnableRawConfig();
- if (f) {
- writer.writeBool(
- 6,
- f
- );
- }
-};
-
-
-/**
- * optional string config_path = 1;
- * @return {string}
- */
-proto.hiddifyrpc.StartRequest.prototype.getConfigPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setConfigPath = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string config_content = 2;
- * @return {string}
- */
-proto.hiddifyrpc.StartRequest.prototype.getConfigContent = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setConfigContent = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional bool disable_memory_limit = 3;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getDisableMemoryLimit = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setDisableMemoryLimit = function(value) {
- return jspb.Message.setProto3BooleanField(this, 3, value);
-};
-
-
-/**
- * optional bool delay_start = 4;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getDelayStart = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setDelayStart = function(value) {
- return jspb.Message.setProto3BooleanField(this, 4, value);
-};
-
-
-/**
- * optional bool enable_old_command_server = 5;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getEnableOldCommandServer = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setEnableOldCommandServer = function(value) {
- return jspb.Message.setProto3BooleanField(this, 5, value);
-};
-
-
-/**
- * optional bool enable_raw_config = 6;
- * @return {boolean}
- */
-proto.hiddifyrpc.StartRequest.prototype.getEnableRawConfig = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.StartRequest} returns this
- */
-proto.hiddifyrpc.StartRequest.prototype.setEnableRawConfig = function(value) {
- return jspb.Message.setProto3BooleanField(this, 6, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SetupRequest.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SetupRequest.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SetupRequest} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetupRequest.toObject = function(includeInstance, msg) {
- var f, obj = {
-basePath: jspb.Message.getFieldWithDefault(msg, 1, ""),
-workingPath: jspb.Message.getFieldWithDefault(msg, 2, ""),
-tempPath: jspb.Message.getFieldWithDefault(msg, 3, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SetupRequest}
- */
-proto.hiddifyrpc.SetupRequest.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SetupRequest;
- return proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SetupRequest} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SetupRequest}
- */
-proto.hiddifyrpc.SetupRequest.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setBasePath(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setWorkingPath(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setTempPath(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SetupRequest.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SetupRequest} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SetupRequest.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getBasePath();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getWorkingPath();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getTempPath();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
-};
-
-
-/**
- * optional string base_path = 1;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getBasePath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setBasePath = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string working_path = 2;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getWorkingPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setWorkingPath = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string temp_path = 3;
- * @return {string}
- */
-proto.hiddifyrpc.SetupRequest.prototype.getTempPath = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.SetupRequest} returns this
- */
-proto.hiddifyrpc.SetupRequest.prototype.setTempPath = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.Response.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.Response.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.Response} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Response.toObject = function(includeInstance, msg) {
- var f, obj = {
-responseCode: jspb.Message.getFieldWithDefault(msg, 1, 0),
-message: jspb.Message.getFieldWithDefault(msg, 2, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.Response}
- */
-proto.hiddifyrpc.Response.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.Response;
- return proto.hiddifyrpc.Response.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.Response} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.Response}
- */
-proto.hiddifyrpc.Response.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {!proto.hiddifyrpc.ResponseCode} */ (reader.readEnum());
- msg.setResponseCode(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setMessage(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.Response.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.Response.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.Response} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.Response.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getResponseCode();
- if (f !== 0.0) {
- writer.writeEnum(
- 1,
- f
- );
- }
- f = message.getMessage();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional ResponseCode response_code = 1;
- * @return {!proto.hiddifyrpc.ResponseCode}
- */
-proto.hiddifyrpc.Response.prototype.getResponseCode = function() {
- return /** @type {!proto.hiddifyrpc.ResponseCode} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.ResponseCode} value
- * @return {!proto.hiddifyrpc.Response} returns this
- */
-proto.hiddifyrpc.Response.prototype.setResponseCode = function(value) {
- return jspb.Message.setProto3EnumField(this, 1, value);
-};
-
-
-/**
- * optional string message = 2;
- * @return {string}
- */
-proto.hiddifyrpc.Response.prototype.getMessage = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.Response} returns this
- */
-proto.hiddifyrpc.Response.prototype.setMessage = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SystemInfo.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SystemInfo.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SystemInfo} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemInfo.toObject = function(includeInstance, msg) {
- var f, obj = {
-memory: jspb.Message.getFieldWithDefault(msg, 1, 0),
-goroutines: jspb.Message.getFieldWithDefault(msg, 2, 0),
-connectionsIn: jspb.Message.getFieldWithDefault(msg, 3, 0),
-connectionsOut: jspb.Message.getFieldWithDefault(msg, 4, 0),
-trafficAvailable: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
-uplink: jspb.Message.getFieldWithDefault(msg, 6, 0),
-downlink: jspb.Message.getFieldWithDefault(msg, 7, 0),
-uplinkTotal: jspb.Message.getFieldWithDefault(msg, 8, 0),
-downlinkTotal: jspb.Message.getFieldWithDefault(msg, 9, 0)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SystemInfo}
- */
-proto.hiddifyrpc.SystemInfo.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SystemInfo;
- return proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SystemInfo} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SystemInfo}
- */
-proto.hiddifyrpc.SystemInfo.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setMemory(value);
- break;
- case 2:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setGoroutines(value);
- break;
- case 3:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setConnectionsIn(value);
- break;
- case 4:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setConnectionsOut(value);
- break;
- case 5:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setTrafficAvailable(value);
- break;
- case 6:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUplink(value);
- break;
- case 7:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setDownlink(value);
- break;
- case 8:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUplinkTotal(value);
- break;
- case 9:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setDownlinkTotal(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SystemInfo.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SystemInfo} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemInfo.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getMemory();
- if (f !== 0) {
- writer.writeInt64(
- 1,
- f
- );
- }
- f = message.getGoroutines();
- if (f !== 0) {
- writer.writeInt32(
- 2,
- f
- );
- }
- f = message.getConnectionsIn();
- if (f !== 0) {
- writer.writeInt32(
- 3,
- f
- );
- }
- f = message.getConnectionsOut();
- if (f !== 0) {
- writer.writeInt32(
- 4,
- f
- );
- }
- f = message.getTrafficAvailable();
- if (f) {
- writer.writeBool(
- 5,
- f
- );
- }
- f = message.getUplink();
- if (f !== 0) {
- writer.writeInt64(
- 6,
- f
- );
- }
- f = message.getDownlink();
- if (f !== 0) {
- writer.writeInt64(
- 7,
- f
- );
- }
- f = message.getUplinkTotal();
- if (f !== 0) {
- writer.writeInt64(
- 8,
- f
- );
- }
- f = message.getDownlinkTotal();
- if (f !== 0) {
- writer.writeInt64(
- 9,
- f
- );
- }
-};
-
-
-/**
- * optional int64 memory = 1;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getMemory = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setMemory = function(value) {
- return jspb.Message.setProto3IntField(this, 1, value);
-};
-
-
-/**
- * optional int32 goroutines = 2;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getGoroutines = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setGoroutines = function(value) {
- return jspb.Message.setProto3IntField(this, 2, value);
-};
-
-
-/**
- * optional int32 connections_in = 3;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getConnectionsIn = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setConnectionsIn = function(value) {
- return jspb.Message.setProto3IntField(this, 3, value);
-};
-
-
-/**
- * optional int32 connections_out = 4;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getConnectionsOut = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setConnectionsOut = function(value) {
- return jspb.Message.setProto3IntField(this, 4, value);
-};
-
-
-/**
- * optional bool traffic_available = 5;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getTrafficAvailable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setTrafficAvailable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 5, value);
-};
-
-
-/**
- * optional int64 uplink = 6;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getUplink = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setUplink = function(value) {
- return jspb.Message.setProto3IntField(this, 6, value);
-};
-
-
-/**
- * optional int64 downlink = 7;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getDownlink = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setDownlink = function(value) {
- return jspb.Message.setProto3IntField(this, 7, value);
-};
-
-
-/**
- * optional int64 uplink_total = 8;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getUplinkTotal = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setUplinkTotal = function(value) {
- return jspb.Message.setProto3IntField(this, 8, value);
-};
-
-
-/**
- * optional int64 downlink_total = 9;
- * @return {number}
- */
-proto.hiddifyrpc.SystemInfo.prototype.getDownlinkTotal = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.SystemInfo} returns this
- */
-proto.hiddifyrpc.SystemInfo.prototype.setDownlinkTotal = function(value) {
- return jspb.Message.setProto3IntField(this, 9, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroupItem.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupItem.toObject = function(includeInstance, msg) {
- var f, obj = {
-tag: jspb.Message.getFieldWithDefault(msg, 1, ""),
-type: jspb.Message.getFieldWithDefault(msg, 2, ""),
-urlTestTime: jspb.Message.getFieldWithDefault(msg, 3, 0),
-urlTestDelay: jspb.Message.getFieldWithDefault(msg, 4, 0)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroupItem.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroupItem;
- return proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroupItem} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setTag(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setType(value);
- break;
- case 3:
- var value = /** @type {number} */ (reader.readInt64());
- msg.setUrlTestTime(value);
- break;
- case 4:
- var value = /** @type {number} */ (reader.readInt32());
- msg.setUrlTestDelay(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroupItem} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getType();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getUrlTestTime();
- if (f !== 0) {
- writer.writeInt64(
- 3,
- f
- );
- }
- f = message.getUrlTestDelay();
- if (f !== 0) {
- writer.writeInt32(
- 4,
- f
- );
- }
-};
-
-
-/**
- * optional string tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string type = 2;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getType = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setType = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional int64 url_test_time = 3;
- * @return {number}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestTime = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestTime = function(value) {
- return jspb.Message.setProto3IntField(this, 3, value);
-};
-
-
-/**
- * optional int32 url_test_delay = 4;
- * @return {number}
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.getUrlTestDelay = function() {
- return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
-};
-
-
-/**
- * @param {number} value
- * @return {!proto.hiddifyrpc.OutboundGroupItem} returns this
- */
-proto.hiddifyrpc.OutboundGroupItem.prototype.setUrlTestDelay = function(value) {
- return jspb.Message.setProto3IntField(this, 4, value);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.OutboundGroup.repeatedFields_ = [4];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroup.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroup} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroup.toObject = function(includeInstance, msg) {
- var f, obj = {
-tag: jspb.Message.getFieldWithDefault(msg, 1, ""),
-type: jspb.Message.getFieldWithDefault(msg, 2, ""),
-selected: jspb.Message.getFieldWithDefault(msg, 3, ""),
-itemsList: jspb.Message.toObjectList(msg.getItemsList(),
- proto.hiddifyrpc.OutboundGroupItem.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroup.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroup;
- return proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroup} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setTag(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setType(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setSelected(value);
- break;
- case 4:
- var value = new proto.hiddifyrpc.OutboundGroupItem;
- reader.readMessage(value,proto.hiddifyrpc.OutboundGroupItem.deserializeBinaryFromReader);
- msg.addItems(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroup} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getTag();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getType();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getSelected();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getItemsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 4,
- f,
- proto.hiddifyrpc.OutboundGroupItem.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * optional string tag = 1;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getTag = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setTag = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string type = 2;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getType = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setType = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string selected = 3;
- * @return {string}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getSelected = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.setSelected = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * repeated OutboundGroupItem items = 4;
- * @return {!Array}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.getItemsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroupItem, 4));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
-*/
-proto.hiddifyrpc.OutboundGroup.prototype.setItemsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 4, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.OutboundGroupItem=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.OutboundGroupItem}
- */
-proto.hiddifyrpc.OutboundGroup.prototype.addItems = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.hiddifyrpc.OutboundGroupItem, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.OutboundGroup} returns this
- */
-proto.hiddifyrpc.OutboundGroup.prototype.clearItemsList = function() {
- return this.setItemsList([]);
-};
-
-
-
-/**
- * List of repeated fields within this message type.
- * @private {!Array}
- * @const
- */
-proto.hiddifyrpc.OutboundGroupList.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.OutboundGroupList.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.OutboundGroupList} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupList.toObject = function(includeInstance, msg) {
- var f, obj = {
-itemsList: jspb.Message.toObjectList(msg.getItemsList(),
- proto.hiddifyrpc.OutboundGroup.toObject, includeInstance)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.OutboundGroupList}
- */
-proto.hiddifyrpc.OutboundGroupList.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.OutboundGroupList;
- return proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.OutboundGroupList} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.OutboundGroupList}
- */
-proto.hiddifyrpc.OutboundGroupList.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.OutboundGroup;
- reader.readMessage(value,proto.hiddifyrpc.OutboundGroup.deserializeBinaryFromReader);
- msg.addItems(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.OutboundGroupList} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.OutboundGroupList.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getItemsList();
- if (f.length > 0) {
- writer.writeRepeatedMessage(
- 1,
- f,
- proto.hiddifyrpc.OutboundGroup.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * repeated OutboundGroup items = 1;
- * @return {!Array}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.getItemsList = function() {
- return /** @type{!Array} */ (
- jspb.Message.getRepeatedWrapperField(this, proto.hiddifyrpc.OutboundGroup, 1));
-};
-
-
-/**
- * @param {!Array} value
- * @return {!proto.hiddifyrpc.OutboundGroupList} returns this
-*/
-proto.hiddifyrpc.OutboundGroupList.prototype.setItemsList = function(value) {
- return jspb.Message.setRepeatedWrapperField(this, 1, value);
-};
-
-
-/**
- * @param {!proto.hiddifyrpc.OutboundGroup=} opt_value
- * @param {number=} opt_index
- * @return {!proto.hiddifyrpc.OutboundGroup}
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.addItems = function(opt_value, opt_index) {
- return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.hiddifyrpc.OutboundGroup, opt_index);
-};
-
-
-/**
- * Clears the list making it empty but non-null.
- * @return {!proto.hiddifyrpc.OutboundGroupList} returns this
- */
-proto.hiddifyrpc.OutboundGroupList.prototype.clearItemsList = function() {
- return this.setItemsList([]);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpAccount.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpAccount.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpAccount} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpAccount.toObject = function(includeInstance, msg) {
- var f, obj = {
-accountId: jspb.Message.getFieldWithDefault(msg, 1, ""),
-accessToken: jspb.Message.getFieldWithDefault(msg, 2, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpAccount.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpAccount;
- return proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpAccount} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccountId(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setAccessToken(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpAccount.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpAccount} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAccountId();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getAccessToken();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional string account_id = 1;
- * @return {string}
- */
-proto.hiddifyrpc.WarpAccount.prototype.getAccountId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpAccount} returns this
- */
-proto.hiddifyrpc.WarpAccount.prototype.setAccountId = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string access_token = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpAccount.prototype.getAccessToken = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpAccount} returns this
- */
-proto.hiddifyrpc.WarpAccount.prototype.setAccessToken = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpWireguardConfig.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpWireguardConfig.toObject = function(includeInstance, msg) {
- var f, obj = {
-privateKey: jspb.Message.getFieldWithDefault(msg, 1, ""),
-localAddressIpv4: jspb.Message.getFieldWithDefault(msg, 2, ""),
-localAddressIpv6: jspb.Message.getFieldWithDefault(msg, 3, ""),
-peerPublicKey: jspb.Message.getFieldWithDefault(msg, 4, ""),
-clientId: jspb.Message.getFieldWithDefault(msg, 5, "")
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpWireguardConfig.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpWireguardConfig;
- return proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {string} */ (reader.readString());
- msg.setPrivateKey(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setLocalAddressIpv4(value);
- break;
- case 3:
- var value = /** @type {string} */ (reader.readString());
- msg.setLocalAddressIpv6(value);
- break;
- case 4:
- var value = /** @type {string} */ (reader.readString());
- msg.setPeerPublicKey(value);
- break;
- case 5:
- var value = /** @type {string} */ (reader.readString());
- msg.setClientId(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpWireguardConfig} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getPrivateKey();
- if (f.length > 0) {
- writer.writeString(
- 1,
- f
- );
- }
- f = message.getLocalAddressIpv4();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getLocalAddressIpv6();
- if (f.length > 0) {
- writer.writeString(
- 3,
- f
- );
- }
- f = message.getPeerPublicKey();
- if (f.length > 0) {
- writer.writeString(
- 4,
- f
- );
- }
- f = message.getClientId();
- if (f.length > 0) {
- writer.writeString(
- 5,
- f
- );
- }
-};
-
-
-/**
- * optional string private_key = 1;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getPrivateKey = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setPrivateKey = function(value) {
- return jspb.Message.setProto3StringField(this, 1, value);
-};
-
-
-/**
- * optional string local_address_ipv4 = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv4 = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv4 = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional string local_address_ipv6 = 3;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getLocalAddressIpv6 = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setLocalAddressIpv6 = function(value) {
- return jspb.Message.setProto3StringField(this, 3, value);
-};
-
-
-/**
- * optional string peer_public_key = 4;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getPeerPublicKey = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setPeerPublicKey = function(value) {
- return jspb.Message.setProto3StringField(this, 4, value);
-};
-
-
-/**
- * optional string client_id = 5;
- * @return {string}
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.getClientId = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpWireguardConfig} returns this
- */
-proto.hiddifyrpc.WarpWireguardConfig.prototype.setClientId = function(value) {
- return jspb.Message.setProto3StringField(this, 5, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.WarpGenerationResponse.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpGenerationResponse.toObject = function(includeInstance, msg) {
- var f, obj = {
-account: (f = msg.getAccount()) && proto.hiddifyrpc.WarpAccount.toObject(includeInstance, f),
-log: jspb.Message.getFieldWithDefault(msg, 2, ""),
-config: (f = msg.getConfig()) && proto.hiddifyrpc.WarpWireguardConfig.toObject(includeInstance, f)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse}
- */
-proto.hiddifyrpc.WarpGenerationResponse.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.WarpGenerationResponse;
- return proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse}
- */
-proto.hiddifyrpc.WarpGenerationResponse.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = new proto.hiddifyrpc.WarpAccount;
- reader.readMessage(value,proto.hiddifyrpc.WarpAccount.deserializeBinaryFromReader);
- msg.setAccount(value);
- break;
- case 2:
- var value = /** @type {string} */ (reader.readString());
- msg.setLog(value);
- break;
- case 3:
- var value = new proto.hiddifyrpc.WarpWireguardConfig;
- reader.readMessage(value,proto.hiddifyrpc.WarpWireguardConfig.deserializeBinaryFromReader);
- msg.setConfig(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.WarpGenerationResponse} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.WarpGenerationResponse.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAccount();
- if (f != null) {
- writer.writeMessage(
- 1,
- f,
- proto.hiddifyrpc.WarpAccount.serializeBinaryToWriter
- );
- }
- f = message.getLog();
- if (f.length > 0) {
- writer.writeString(
- 2,
- f
- );
- }
- f = message.getConfig();
- if (f != null) {
- writer.writeMessage(
- 3,
- f,
- proto.hiddifyrpc.WarpWireguardConfig.serializeBinaryToWriter
- );
- }
-};
-
-
-/**
- * optional WarpAccount account = 1;
- * @return {?proto.hiddifyrpc.WarpAccount}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getAccount = function() {
- return /** @type{?proto.hiddifyrpc.WarpAccount} */ (
- jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpAccount, 1));
-};
-
-
-/**
- * @param {?proto.hiddifyrpc.WarpAccount|undefined} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
-*/
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setAccount = function(value) {
- return jspb.Message.setWrapperField(this, 1, value);
-};
-
-
-/**
- * Clears the message field making it undefined.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.clearAccount = function() {
- return this.setAccount(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {boolean}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.hasAccount = function() {
- return jspb.Message.getField(this, 1) != null;
-};
-
-
-/**
- * optional string log = 2;
- * @return {string}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getLog = function() {
- return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
-};
-
-
-/**
- * @param {string} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setLog = function(value) {
- return jspb.Message.setProto3StringField(this, 2, value);
-};
-
-
-/**
- * optional WarpWireguardConfig config = 3;
- * @return {?proto.hiddifyrpc.WarpWireguardConfig}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.getConfig = function() {
- return /** @type{?proto.hiddifyrpc.WarpWireguardConfig} */ (
- jspb.Message.getWrapperField(this, proto.hiddifyrpc.WarpWireguardConfig, 3));
-};
-
-
-/**
- * @param {?proto.hiddifyrpc.WarpWireguardConfig|undefined} value
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
-*/
-proto.hiddifyrpc.WarpGenerationResponse.prototype.setConfig = function(value) {
- return jspb.Message.setWrapperField(this, 3, value);
-};
-
-
-/**
- * Clears the message field making it undefined.
- * @return {!proto.hiddifyrpc.WarpGenerationResponse} returns this
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.clearConfig = function() {
- return this.setConfig(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {boolean}
- */
-proto.hiddifyrpc.WarpGenerationResponse.prototype.hasConfig = function() {
- return jspb.Message.getField(this, 3) != null;
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_, eg, foo.pb_default.
- * For the list of reserved names please see:
- * net/proto2/compiler/js/internal/generator.cc#kKeyword.
- * @param {boolean=} opt_includeInstance Deprecated. whether to include the
- * JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.toObject = function(opt_includeInstance) {
- return proto.hiddifyrpc.SystemProxyStatus.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Deprecated. Whether to include
- * the JSPB instance for transitional soy proto support:
- * http://goto/soy-param-migration
- * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemProxyStatus.toObject = function(includeInstance, msg) {
- var f, obj = {
-available: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
-enabled: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
- };
-
- if (includeInstance) {
- obj.$jspbMessageInstance = msg;
- }
- return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.hiddifyrpc.SystemProxyStatus}
- */
-proto.hiddifyrpc.SystemProxyStatus.deserializeBinary = function(bytes) {
- var reader = new jspb.BinaryReader(bytes);
- var msg = new proto.hiddifyrpc.SystemProxyStatus;
- return proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.hiddifyrpc.SystemProxyStatus} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.hiddifyrpc.SystemProxyStatus}
- */
-proto.hiddifyrpc.SystemProxyStatus.deserializeBinaryFromReader = function(msg, reader) {
- while (reader.nextField()) {
- if (reader.isEndGroup()) {
- break;
- }
- var field = reader.getFieldNumber();
- switch (field) {
- case 1:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setAvailable(value);
- break;
- case 2:
- var value = /** @type {boolean} */ (reader.readBool());
- msg.setEnabled(value);
- break;
- default:
- reader.skipField();
- break;
- }
- }
- return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.serializeBinary = function() {
- var writer = new jspb.BinaryWriter();
- proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter(this, writer);
- return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.hiddifyrpc.SystemProxyStatus} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.hiddifyrpc.SystemProxyStatus.serializeBinaryToWriter = function(message, writer) {
- var f = undefined;
- f = message.getAvailable();
- if (f) {
- writer.writeBool(
- 1,
- f
- );
- }
- f = message.getEnabled();
- if (f) {
- writer.writeBool(
- 2,
- f
- );
- }
-};
-
-
-/**
- * optional bool available = 1;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.getAvailable = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.setAvailable = function(value) {
- return jspb.Message.setProto3BooleanField(this, 1, value);
-};
-
-
-/**
- * optional bool enabled = 2;
- * @return {boolean}
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.getEnabled = function() {
- return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
-};
-
-
-/**
- * @param {boolean} value
- * @return {!proto.hiddifyrpc.SystemProxyStatus} returns this
- */
-proto.hiddifyrpc.SystemProxyStatus.prototype.setEnabled = function(value) {
- return jspb.Message.setProto3BooleanField(this, 2, value);
-};
-
-
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * Optional fields that are not set will be set to undefined.
- * To access a reserved field use, foo.pb_