diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..16e3645c87e --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @AdGuardSoftwareLimited/go diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 36b0f74a614..894f3c29e5a 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,156 +1,151 @@ 'body': - 'attributes': - 'description': > - Please make sure that the issue is not a duplicate or a question. - If it's a duplicate, please react to the original issue with a - thumbs up. If it's a question, please post it to the GitHub - Discussions page. - 'label': 'Prerequisites' - 'options': - - 'label': > - I have checked the - [Wiki](https://github.com/AdguardTeam/AdGuardHome/wiki) and - [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) - and found no answer - 'required': true - - 'label': > - I have searched other issues and found no duplicates - 'required': true - - 'label': > - I want to report a bug and not [ask a question or ask for - help](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) - 'required': true - - 'label': > - I have set up AdGuard Home correctly and [configured clients to - use it](https://github.com/AdguardTeam/AdGuardHome/wiki/Clients). - (Use the - [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) - for help with installing and configuring clients.) - 'required': true + 'description': > + Please make sure that the issue is not a duplicate or a question. If it's a duplicate, please react to the original issue with a thumbs up. If it's a question, please post it to the GitHub Discussions page. + + 'label': 'Prerequisites' + 'options': + - 'label': > + I have checked the [Wiki](https://github.com/AdguardTeam/AdGuardHome/wiki) and [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) and found no answer + + 'required': true + - 'label': > + I have searched other issues and found no duplicates + + 'required': true + - 'label': > + I want to report a bug and not [ask a question or ask for help](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) + + 'required': true + - 'label': > + I have set up AdGuard Home correctly and [configured clients to use it](https://github.com/AdguardTeam/AdGuardHome/wiki/Clients). (Use the [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions/categories/q-a) for help with installing and configuring clients.) + + 'required': true 'id': 'prerequisites' 'type': 'checkboxes' - 'attributes': - 'description': 'On which Platform does the issue occur?' - 'label': 'Platform (OS and CPU architecture)' - # NOTE: Keep the 386 at the bottom for each OS, because a lot of people - # Seem to confuse them with AMD64, which is what they actually need. - 'options': - - 'Darwin (aka macOS), AMD64 (aka x86_64)' - - 'Darwin (aka macOS), ARM64' - - 'FreeBSD, AMD64 (aka x86_64)' - - 'FreeBSD, ARM64' - - 'FreeBSD, ARMv5' - - 'FreeBSD, ARMv6' - - 'FreeBSD, ARMv7' - - 'FreeBSD, 32-bit Intel (aka 386)' - - 'Linux, AMD64 (aka x86_64)' - - 'Linux, ARM64' - - 'Linux, ARMv5' - - 'Linux, ARMv6' - - 'Linux, ARMv7' - - 'Linux, MIPS LE' - - 'Linux, MIPS' - - 'Linux, MIPS64 LE' - - 'Linux, MIPS64' - - 'Linux, PPC64 LE' - - 'Linux, 32-bit Intel (aka 386)' - - 'OpenBSD, AMD64 (aka x86_64)' - - 'OpenBSD, ARM64' - - 'Windows, AMD64 (aka x86_64)' - - 'Windows, ARM64' - - 'Windows, 32-bit Intel (aka 386)' - - 'Custom (please mention in the description)' + 'description': 'On which Platform does the issue occur?' + 'label': 'Platform (OS and CPU architecture)' + # NOTE: Keep the 386 at the bottom for each OS, because a lot of people + # Seem to confuse them with AMD64, which is what they actually need. + 'options': + - 'Darwin (aka macOS), AMD64 (aka x86_64)' + - 'Darwin (aka macOS), ARM64' + - 'FreeBSD, AMD64 (aka x86_64)' + - 'FreeBSD, ARM64' + - 'FreeBSD, ARMv5' + - 'FreeBSD, ARMv6' + - 'FreeBSD, ARMv7' + - 'FreeBSD, 32-bit Intel (aka 386)' + - 'Linux, AMD64 (aka x86_64)' + - 'Linux, ARM64' + - 'Linux, ARMv5' + - 'Linux, ARMv6' + - 'Linux, ARMv7' + - 'Linux, MIPS LE' + - 'Linux, MIPS' + - 'Linux, MIPS64 LE' + - 'Linux, MIPS64' + - 'Linux, PPC64 LE' + - 'Linux, 32-bit Intel (aka 386)' + - 'OpenBSD, AMD64 (aka x86_64)' + - 'OpenBSD, ARM64' + - 'Windows, AMD64 (aka x86_64)' + - 'Windows, ARM64' + - 'Windows, 32-bit Intel (aka 386)' + - 'Custom (please mention in the description)' 'id': 'os' 'type': 'dropdown' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': 'How did you install AdGuard Home?' - 'label': 'Installation' - 'options': - - 'GitHub releases or script from README' - - 'Docker' - - 'Snapcraft' - - 'Custom package (OpenWrt, HomeAssistant, etc; please mention in the description)' - - 'Other (please mention in the description)' + 'description': 'How did you install AdGuard Home?' + 'label': 'Installation' + 'options': + - 'GitHub releases or script from README' + - 'Docker' + - 'Snapcraft' + - 'Custom package (OpenWrt, HomeAssistant, etc; please mention in the description)' + - 'Other (please mention in the description)' 'id': 'install' 'type': 'dropdown' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': 'How did you setup AdGuard Home?' - 'label': 'Setup' - 'options': - - 'On one machine' - - 'On a router, DHCP is handled by the router' - - 'On a router, DHCP is handled by AdGuard Home' - - 'Other (please mention in the description)' + 'description': 'How did you setup AdGuard Home?' + 'label': 'Setup' + 'options': + - 'On one machine' + - 'On a router, DHCP is handled by the router' + - 'On a router, DHCP is handled by AdGuard Home' + - 'Other (please mention in the description)' 'id': 'setup' 'type': 'dropdown' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': 'What version of AdGuard Home are you using?' - 'label': 'AdGuard Home version' + 'description': 'What version of AdGuard Home are you using?' + 'label': 'AdGuard Home version' 'id': 'version' 'type': 'input' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': > - Please describe what you did. An `nslookup` or a `dig` command is - the best way. For crashes, please provide a full failure log. - 'label': 'Action' - 'value': | - Replace the following command with the one you're calling or a - description of the failing action: + 'description': > + Please describe what you did. An `nslookup` or a `dig` command is the best way. For crashes, please provide a full failure log. + + 'label': 'Action' + 'value': | + Replace the following command with the one you're calling or a + description of the failing action: - ```sh - nslookup -debug -type=a 'www.example.com' '$YOUR_AGH_ADDRESS' - ``` + ```sh + nslookup -debug -type=a 'www.example.com' '$YOUR_AGH_ADDRESS' + ``` 'id': 'failing_action' 'type': 'textarea' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': > - What did you expect to see? Please add a description and/or - screenshots, if applicable. - 'label': 'Expected result' - 'placeholder': > - What did you expect to see? + 'description': > + What did you expect to see? Please add a description and/or screenshots, if applicable. + + 'label': 'Expected result' + 'placeholder': > + What did you expect to see? + 'id': 'expected' 'type': 'textarea' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': > - What happened instead? Please add a description and/or screenshots, - if applicable. - 'label': 'Actual result' - 'placeholder': > - What did you see instead? + 'description': > + What happened instead? Please add a description and/or screenshots, if applicable. + + 'label': 'Actual result' + 'placeholder': > + What did you see instead? + 'id': 'result' 'type': 'textarea' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': > - Please add additional information, such as non-standard OS or port, - here. You can also put screenshots here, if applicable. For - example, it is better to copy and paste text from a terminal instead - of posting a screenshot of the terminal. - 'label': 'Additional information and/or screenshots' - 'placeholder': > - Additional OS information, screenshots of the UI, etc. + 'description': > + Please add additional information, such as non-standard OS or port, here. You can also put screenshots here, if applicable. For example, it is better to copy and paste text from a terminal instead of posting a screenshot of the terminal. + + 'label': 'Additional information and/or screenshots' + 'placeholder': > + Additional OS information, screenshots of the UI, etc. + 'id': 'additional' 'type': 'textarea' 'validations': - 'required': false + 'required': false # NOTE: GitHub limits the description length to 200 characters. Also, Markdown # doesn't work here. 'description': | - For help, use the Discussions section instead. Write the title in English - to make it easier for other people to search for duplicates. (Any language - is fine in the body.) + For help, use the Discussions section instead. Write the title in English + to make it easier for other people to search for duplicates. (Any language + is fine in the body.) 'name': 'Bug' diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d2ca2128c05..f6ee99ad5f2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,22 +1,22 @@ 'blank_issues_enabled': false 'contact_links': - 'about': > - Please report filtering issues, for example advertising filters - misfiring or safe browsing false positives, using the form on our - website + Please report filtering issues, for example advertising filters misfiring or safe browsing false positives, using the form on our website + 'name': 'AdGuard filters issues' 'url': 'https://link.adtidy.org/forward.html?action=report&app=home&from=github' - 'about': > - Please send requests for new blocked services and vetted filtering lists - to the Hostlists Registry repository + Please send requests for new blocked services and vetted filtering lists to the Hostlists Registry repository + 'name': 'Blocked services and vetted filtering rule lists: AdGuard Hostlists Registry' 'url': 'https://github.com/AdguardTeam/HostlistsRegistry' - 'about': > - Please use GitHub Discussions for questions + Please use GitHub Discussions for questions + 'name': 'Q&A Discussions' 'url': 'https://github.com/AdguardTeam/AdGuardHome/discussions' - 'about': > - Please check our Wiki for configuration file description, frequently - asked questions, and other documentation + Please check our Wiki for configuration file description, frequently asked questions, and other documentation + 'name': 'Wiki' 'url': 'https://github.com/AdguardTeam/AdGuardHome/wiki' diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml index f86ff470f82..56569f5c23d 100644 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -1,58 +1,58 @@ 'body': - 'attributes': - 'description': > - Please make sure that the issue is not a duplicate or a question. - If it's a duplicate, please react to the original issue with a - thumbs up. If it's a question, please post it to the GitHub - Discussions page. - 'label': 'Prerequisites' - 'options': - - 'label': > - I have checked the - [Wiki](https://github.com/AdguardTeam/AdGuardHome/wiki) and - [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions) - and found no answer - 'required': true - - 'label': > - I have searched other issues and found no duplicates - 'required': true - - 'label': > - I want to request a feature or enhancement and not ask a - question - 'required': true + 'description': > + Please make sure that the issue is not a duplicate or a question. If it's a duplicate, please react to the original issue with a thumbs up. If it's a question, please post it to the GitHub Discussions page. + + 'label': 'Prerequisites' + 'options': + - 'label': > + I have checked the [Wiki](https://github.com/AdguardTeam/AdGuardHome/wiki) and [Discussions](https://github.com/AdguardTeam/AdGuardHome/discussions) and found no answer + + 'required': true + - 'label': > + I have searched other issues and found no duplicates + + 'required': true + - 'label': > + I want to request a feature or enhancement and not ask a question + + 'required': true 'id': 'prerequisites' 'type': 'checkboxes' - 'attributes': - 'description': 'Please describe the problem you are trying to solve' - 'label': 'The problem' - 'placeholder': > - Please describe the problem you are trying to solve + 'description': 'Please describe the problem you are trying to solve' + 'label': 'The problem' + 'placeholder': > + Please describe the problem you are trying to solve + 'id': 'problem' 'type': 'textarea' 'validations': - 'required': true + 'required': true - 'attributes': - 'description': 'What feature are you proposing to solve this problem?' - 'label': 'Proposed solution' - 'placeholder': > - What feature are you proposing to solve this problem? + 'description': 'What feature are you proposing to solve this problem?' + 'label': 'Proposed solution' + 'placeholder': > + What feature are you proposing to solve this problem? + 'id': 'proposed_solution' 'type': 'textarea' 'validations': - 'required': true + 'required': true - 'attributes': - 'label': 'Alternatives considered and additional information' - 'placeholder': > - Are there any other ways to solve the problem? + 'label': 'Alternatives considered and additional information' + 'placeholder': > + Are there any other ways to solve the problem? + 'id': 'additional' 'type': 'textarea' 'validations': - 'required': false + 'required': false # NOTE: GitHub limits the description length to 200 characters. Also, Markdown # doesn't work here. 'description': | - Write the title in English to make it easier for other people to search for - duplicates. (Any language is fine in the body.) + Write the title in English to make it easier for other people to search for + duplicates. (Any language is fine in the body.) 'labels': - 'feature request' 'name': 'Feature request or enhancement' diff --git a/.github/stale.yml b/.github/stale.yml index 6042fc60f5d..9dc2c519205 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -19,9 +19,8 @@ 'staleLabel': 'wontfix' # Comment to post when marking an issue as stale. Set to `false` to disable. 'markComment': > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. + This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. + # Comment to post when closing a stale issue. Set to `false` to disable. 'closeComment': false # Limit the number of actions per hour. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 12a6b336b39..00000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,158 +0,0 @@ -# TODO(a.garipov): Use client_v2 for the frontend tests once Windows build is -# fixed. -'name': 'build' -# Permissions are disabled for all the jobs by default, and then overridden for -# specific jobs if needed. This is a recommended practice for security reasons, -# and also allows to avoid mistakes with permissions when creating new jobs. -# -# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. -'permissions': {} -'env': - 'GO_VERSION': '1.26.6' - 'NODE_VERSION': '20' -'on': - 'push': - 'branches': - - '*' - 'tags': - - 'v*' - 'pull_request': -'jobs': - 'test': - 'runs-on': '${{ matrix.os }}' - 'permissions': - 'contents': 'read' - 'env': - 'GO111MODULE': 'on' - 'GOPROXY': 'https://goproxy.cn' - 'strategy': - 'fail-fast': false - 'matrix': - 'os': - - 'ubuntu-latest' - - 'macOS-latest' - - 'windows-latest' - 'steps': - - 'name': 'Checkout' - 'uses': 'actions/checkout@v2' - 'with': - 'fetch-depth': 0 - # Set to false to avoid GITHUB_TOKEN leaking. - # - # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Set up Go' - 'uses': 'actions/setup-go@v3' - 'with': - 'go-version': '${{ env.GO_VERSION }}' - - 'name': 'Set up Node' - 'uses': 'actions/setup-node@v1' - 'with': - 'node-version': '${{ env.NODE_VERSION }}' - - 'name': 'Set up Go modules cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '~/go/pkg/mod' - 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" - 'restore-keys': '${{ runner.os }}-go-' - - 'name': 'Get npm cache directory' - 'id': 'npm-cache' - 'run': 'echo "::set-output name=dir::$( npm config get cache )"' - - 'name': 'Set up npm cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '${{ steps.npm-cache.outputs.dir }}' - 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" - 'restore-keys': '${{ runner.os }}-node-' - - 'name': 'Run tests' - 'shell': 'bash' - 'run': 'make CLIENT_DIR=client VERBOSE=1 deps test go-bench go-fuzz' - - 'name': 'Upload coverage' - 'uses': 'codecov/codecov-action@v1' - 'if': "success() && matrix.os == 'ubuntu-latest'" - 'with': - 'token': '${{ secrets.CODECOV_TOKEN }}' - 'file': './coverage.txt' - 'build-release': - 'runs-on': 'ubuntu-latest' - 'needs': 'test' - 'permissions': - 'contents': 'read' - 'steps': - - 'name': 'Checkout' - 'uses': 'actions/checkout@v2' - 'with': - 'fetch-depth': 0 - # Set to false to avoid GITHUB_TOKEN leaking. - # - # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Set up Go' - 'uses': 'actions/setup-go@v3' - 'with': - 'go-version': '${{ env.GO_VERSION }}' - - 'name': 'Set up Node' - 'uses': 'actions/setup-node@v1' - 'with': - 'node-version': '${{ env.NODE_VERSION }}' - - 'name': 'Set up Go modules cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '~/go/pkg/mod' - 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}" - 'restore-keys': '${{ runner.os }}-go-' - - 'name': 'Get npm cache directory' - 'id': 'npm-cache' - 'run': 'echo "::set-output name=dir::$(npm config get cache)"' - - 'name': 'Set up npm cache' - 'uses': 'actions/cache@v4' - 'with': - 'path': '${{ steps.npm-cache.outputs.dir }}' - 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" - 'restore-keys': '${{ runner.os }}-node-' - - 'name': 'Set up Snapcraft' - 'run': 'sudo snap install snapcraft --classic' - - 'name': 'Set up QEMU' - 'uses': 'docker/setup-qemu-action@v3' - - 'name': 'Set up Docker Buildx' - 'uses': 'docker/setup-buildx-action@v3' - 'with': - 'install': true - - 'name': 'Run snapshot build' - # Set a custom version string, since the checkout@v2 action does not seem - # to know about the master branch, while the version script uses it to - # count the number of commits within the branch. - 'run': 'make SIGN=0 VERBOSE=1 VERSION="v0.0.0-github" build-release build-docker' - 'notify': - 'needs': - - 'build-release' - # Secrets are not passed to workflows that are triggered by a pull request - # from a fork. - # - # Use always() to signal to the runner that this job must run even if the - # previous ones failed. - 'if': | - ${{ - always() && - github.repository_owner == 'AdguardTeam' && - ( - github.event_name == 'push' || - github.event.pull_request.head.repo.full_name == github.repository - ) - }} - 'runs-on': 'ubuntu-latest' - 'permissions': - # Required by workflow-conclusion-action to check workflow status. - 'actions': 'read' - 'contents': 'read' - 'steps': - - 'name': 'Conclusion' - 'uses': 'technote-space/workflow-conclusion-action@v1' - - 'name': 'Send Slack notif' - 'uses': '8398a7/action-slack@v3' - 'with': - 'status': '${{ env.WORKFLOW_CONCLUSION }}' - 'fields': 'repo, message, commit, author, workflow' - 'env': - 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' - 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 82b0a35fccf..00000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,85 +0,0 @@ -'name': 'lint' -# Permissions are disabled for all the jobs by default, and then overridden for -# specific jobs if needed. This is a recommended practice for security reasons, -# and also allows to avoid mistakes with permissions when creating new jobs. -# -# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. -'permissions': {} -'env': - 'GO_VERSION': '1.26.3' -'on': - 'push': - 'tags': - - 'v*' - 'branches': - - '*' - 'pull_request': -'jobs': - 'go-lint': - 'runs-on': 'ubuntu-latest' - 'permissions': - 'contents': 'read' - 'steps': - - 'uses': 'actions/checkout@v2' - 'with': - # Set to false to avoid GITHUB_TOKEN leaking. - # - # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Set up Go' - 'uses': 'actions/setup-go@v3' - 'with': - 'go-version': '${{ env.GO_VERSION }}' - - 'name': 'run-lint' - 'run': > - make go-deps go-lint - - 'eslint': - 'runs-on': 'ubuntu-latest' - 'permissions': - 'contents': 'read' - 'steps': - - 'uses': 'actions/checkout@v2' - 'with': - # Set to false to avoid GITHUB_TOKEN leaking. - # - # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. - 'persist-credentials': false - - 'name': 'Install modules' - 'run': 'npm --prefix="./client" ci' - - 'name': 'Run ESLint' - 'run': 'npm --prefix="./client" run lint' - 'notify': - 'needs': - - 'go-lint' - - 'eslint' - # Secrets are not passed to workflows that are triggered by a pull request - # from a fork. - # - # Use always() to signal to the runner that this job must run even if the - # previous ones failed. - 'if': | - ${{ - always() && - github.repository_owner == 'AdguardTeam' && - ( - github.event_name == 'push' || - github.event.pull_request.head.repo.full_name == github.repository - ) - }} - 'runs-on': 'ubuntu-latest' - 'permissions': - # Required by workflow-conclusion-action to check workflow status. - 'actions': 'read' - 'contents': 'read' - 'steps': - - 'name': 'Conclusion' - 'uses': 'technote-space/workflow-conclusion-action@v1' - - 'name': 'Send Slack notif' - 'uses': '8398a7/action-slack@v3' - 'with': - 'status': '${{ env.WORKFLOW_CONCLUSION }}' - 'fields': 'repo, message, commit, author, workflow' - 'env': - 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}' - 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}' diff --git a/.github/workflows/mirror.yaml b/.github/workflows/mirror.yaml new file mode 100644 index 00000000000..4af3fd6ba7a --- /dev/null +++ b/.github/workflows/mirror.yaml @@ -0,0 +1,25 @@ +'jobs': + 'mirror': + 'if': | + ${{ github.repository_owner == 'AdGuardSoftwareLimited' }} + 'permissions': + 'actions': 'write' + 'contents': 'read' + 'id-token': 'write' + 'uses': 'AdGuardSoftwareLimited/actions/.github/workflows/mirror.yml@master' + 'with': + 'disable_workflows_source': 'workflow.yaml' + 'disable_workflows_target': 'mirror.yaml private.yaml' + 'target_repo': 'git@github.com:AdguardTeam/AdGuardHome.git' + 'team': 'go' +'name': 'Mirror' +'on': + 'push': + 'branches': ['master'] + 'workflow_dispatch': null +# Permissions are disabled for all the jobs by default, and then overridden for +# specific jobs if needed. This is a recommended practice for security reasons, +# and also allows to avoid mistakes with permissions when creating new jobs. +# +# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. +'permissions': {} diff --git a/.github/workflows/private.yaml b/.github/workflows/private.yaml new file mode 100644 index 00000000000..4198d8b318d --- /dev/null +++ b/.github/workflows/private.yaml @@ -0,0 +1,161 @@ +'env': + 'BASE_IMAGE': |- + ${{ vars.BASE_IMAGE || 'adguard/go-builder:1.26.6--1' }} + 'CACHE_BUSTER': |- + ${{ inputs.cache_buster || '0' }} + 'CLIENT_DIR': |- + ${{ inputs.client_dir || 'client_v2' }} + 'FRONTEND_BASE_IMAGE': |- + ${{ vars.FRONTEND_BASE_IMAGE || 'adguard/home-js-builder:4.0' }} +'jobs': + 'TestFrontend': + 'if': | + ${{ github.repository_owner == 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': 'team-go' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'name': 'Run frontend tests' + 'run': | + #!/bin/sh + + set -e -f -o pipefail -u -x + + docker build \ + --build-arg "BASE_IMAGE=${FRONTEND_BASE_IMAGE}" \ + --build-arg "CACHE_BUSTER=${CACHE_BUSTER}" \ + --build-arg "CLIENT_DIR=${CLIENT_DIR}" \ + --progress 'plain' \ + --target 'tester' \ + -f ./docker/frontend.Dockerfile \ + . + 'LintAndTestJobDocker': + 'if': | + ${{ github.repository_owner == 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': 'team-go' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'name': 'Lint and test step' + 'run': | + #!/bin/sh + + set -e -f -o pipefail -u -x + + docker build \ + --build-arg "BASE_IMAGE=${BASE_IMAGE}" \ + --build-arg "CACHE_BUSTER=${CACHE_BUSTER}" \ + --output '.' \ + --progress 'plain' \ + --target 'tester-exporter' \ + -f ./docker/ci.Dockerfile \ + . + + exit_code="$(cat ./test-reports/test-exit-code.txt)" + readonly exit_code + + exit "$exit_code" + 'LintAndTestJobMacOS': + 'if': | + ${{ github.repository_owner == 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': + - 'ephemeral' + - 'ephemeral-mac' + - '${{ vars.BUILD_IMAGE_VERSION_MACOS }}' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'name': 'Lint and test step' + 'run': | + #!/bin/sh + + set -e -f -o pipefail -u -x + + # NOTE: Only run those checks that only need Go and Go tools. + make \ + VERBOSE=1 \ + go-deps \ + go-os-check \ + go-lint \ + go-test \ + go-bench \ + go-fuzz \ + ; + 'LintAndTestJobWindows': + 'if': | + ${{ github.repository_owner == 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': + - 'ephemeral' + - 'ephemeral-vmwin' + - '${{ vars.BUILD_IMAGE_VERSION_WINDOWS_GO }}' + - 'ephemeral-limit-memory-8192' + - 'ephemeral-limit-cpu-4' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'name': 'Lint and test step' + 'run': | + set -e -f -o pipefail -u -x + + make \ + VERBOSE=1 \ + go-deps \ + go-os-check \ + go-lint \ + ; + + # NOTE: Only run go-test with CGO_ENABLED for race test. + make \ + VERBOSE=1 \ + CGO_ENABLED=1 \ + go-test \ + ; + + make \ + VERBOSE=1 \ + go-bench \ + go-fuzz \ + ; + 'shell': 'bash' +'name': 'Lint and test workflow (private)' +'on': + 'push': + 'branches': + - '*' + 'workflow_dispatch': + 'inputs': + 'cache_buster': + 'default': '' + 'description': | + Override to force re-run of cached stages (pass any unique value). + 'type': 'string' +# Permissions are disabled for all the jobs by default, and then overridden for +# specific jobs if needed. This is a recommended practice for security reasons, +# and also allows to avoid mistakes with permissions when creating new jobs. +# +# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. +'permissions': {} diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 00000000000..20c4b95273c --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,123 @@ +'env': + 'CLIENT_DIR': 'client' + 'GO_VERSION': '1.26.6' + 'NODE_VERSION': '24' +'jobs': + 'ESLint': + 'if': | + ${{ github.repository_owner != 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': 'ubuntu-latest' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'name': 'Install modules' + 'run': | + #!/bin/sh + + set -e -f -u -x + + npm \ + --prefix="./${{ env.CLIENT_DIR }}" \ + ci \ + ; + - 'name': 'Run ESLint' + 'run': | + #!/bin/sh + + set -e -f -u -x + + npm \ + --prefix="./${{ env.CLIENT_DIR }}" \ + run lint \ + ; + 'TestJob': + 'if': | + ${{ github.repository_owner != 'AdGuardSoftwareLimited' }} + 'permissions': + 'contents': 'read' + 'runs-on': '${{ matrix.os }}' + 'strategy': + 'fail-fast': false + 'matrix': + 'os': + - 'windows-latest' + - 'macos-latest' + - 'ubuntu-latest' + 'steps': + - 'uses': 'actions/checkout@v6' + 'with': + # Set to false to avoid GITHUB_TOKEN leaking. + # + # See https://github.com/actions/checkout/issues/485#issuecomment-934422611. + 'persist-credentials': false + - 'uses': 'actions/setup-go@v6' + 'with': + 'go-version': '${{ env.GO_VERSION }}' + - 'name': 'Lint step' + 'run': | + #!/bin/sh + + set -e -f -u -x + + # NOTE: Only run those checks that only need Go and Go tools. + make \ + VERBOSE=1 \ + go-deps \ + go-os-check \ + go-lint \ + ; + 'shell': 'bash' + - 'name': 'Set up Node' + 'uses': 'actions/setup-node@v1' + 'with': + 'node-version': '${{ env.NODE_VERSION }}' + - 'name': 'Get npm cache directory' + 'id': 'npm-cache' + 'run': 'echo "::set-output name=dir::$( npm config get cache )"' + - 'name': 'Set up npm cache' + 'uses': 'actions/cache@v4' + 'with': + 'path': '${{ steps.npm-cache.outputs.dir }}' + 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}" + 'restore-keys': '${{ runner.os }}-node-' + - 'name': 'Run tests' + 'shell': 'bash' + 'run': | + #!/bin/sh + + set -e -f -u -x + make \ + CLIENT_DIR=client \ + VERBOSE=1 \ + deps \ + test \ + go-bench \ + go-fuzz \ + ; + - 'name': 'Upload coverage' + 'uses': 'codecov/codecov-action@v1' + 'if': "success() && matrix.os == 'ubuntu-latest'" + 'with': + 'token': '${{ secrets.CODECOV_TOKEN }}' + 'file': './cover.out' + # TODO(d.kolyshev): Build snapshot. +'name': 'Lint and test workflow' +'on': + 'push': + 'tags': + - 'v*' + 'branches': + - '*' + 'pull_request': +# Permissions are disabled for all the jobs by default, and then overridden for +# specific jobs if needed. This is a recommended practice for security reasons, +# and also allows to avoid mistakes with permissions when creating new jobs. +# +# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions. +'permissions': {} diff --git a/README.md b/README.md index 86862dc5f87..7926ab9b2fc 100644 --- a/README.md +++ b/README.md @@ -394,6 +394,8 @@ Please note that these projects are not affiliated with AdGuard, but are made by - [Chocolatey package](https://community.chocolatey.org/packages/adguardhome/) by [niks255](https://community.chocolatey.org/profiles/niks255). +- [ZimaOS App Store listing](https://www.zimaspace.com/zimaos/app-store/app/org.icewhale.adguardhome) by [CasaOS Team](https://casaos.zimaspace.com/). + ## Acknowledgments This software wouldn't have been possible without: diff --git a/go.mod b/go.mod index c4aac02c44c..74b0d58794f 100644 --- a/go.mod +++ b/go.mod @@ -54,6 +54,7 @@ require ( github.com/anthropics/anthropic-sdk-go v1.63.1 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0 // indirect + github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect github.com/buger/jsonparser v1.6.1 // indirect github.com/ccojocar/zxcvbn-go v1.0.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -63,6 +64,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golangci/misspell v0.8.0 // indirect github.com/google/s2a-go v0.1.9 // indirect + github.com/google/yamlfmt v0.21.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.21 // indirect github.com/googleapis/gax-go/v2 v2.23.0 // indirect github.com/gookit/color v1.6.1 // indirect @@ -73,6 +75,7 @@ require ( github.com/jstemmer/go-junit-report/v2 v2.1.0 // indirect github.com/kisielk/errcheck v1.20.0 // indirect github.com/mdlayher/socket v0.6.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/openai/openai-go/v3 v3.52.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pb33f/ordered-map/v2 v2.3.1 // indirect @@ -81,6 +84,7 @@ require ( github.com/quic-go/qpack v0.6.0 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.16.0 // indirect + github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect github.com/securego/gosec/v2 v2.28.0 // indirect github.com/standard-webhooks/standard-webhooks/libraries v0.0.1 // indirect github.com/tidwall/gjson v1.19.0 // indirect @@ -117,6 +121,7 @@ require ( mvdan.cc/gofumpt v0.11.0 // indirect mvdan.cc/sh/v3 v3.13.1 // indirect mvdan.cc/unparam v0.0.0-20260818115549-3f964bcb5673 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect ) // NOTE: Keep in sync with .gitignore. @@ -135,6 +140,7 @@ ignore ( tool ( github.com/fzipp/gocyclo/cmd/gocyclo github.com/golangci/misspell/cmd/misspell + github.com/google/yamlfmt/cmd/yamlfmt github.com/gordonklaus/ineffassign github.com/jstemmer/go-junit-report/v2 github.com/kisielk/errcheck diff --git a/go.sum b/go.sum index 106ffc5cc49..2a35cfe97ea 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0 h1:0b2vaepXIfMsG+ github.com/beefsack/go-rate v0.0.0-20220214233405-116f4ca011a0/go.mod h1:6YNgTHLutezwnBvyneBbwvB8C82y3dcoOj5EQJIdGXA= github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= +github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/buger/jsonparser v1.6.1 h1:I0phFv0PlbLHnM7TZAVjZ2MJ2/eWRTDyuO7GLR98IEs= github.com/buger/jsonparser v1.6.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500 h1:6lhrsTEnloDPXyeZBvSYvQf8u86jbKehZPVDDlkgDl4= @@ -85,6 +87,8 @@ github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0 github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/yamlfmt v0.21.0 h1:9FKApQkDpMKgBjwLFytBHUCgqnQgxaQnci0uiESfbzs= +github.com/google/yamlfmt v0.21.0/go.mod h1:q6FYExB+Ueu7jZDjKECJk+EaeDXJzJ6Ne0dxx69GWfI= github.com/googleapis/enterprise-certificate-proxy v0.3.21 h1:OFdQ3tnCX/zaQ0Cedur3D3z7kI6HiLX9g3TiAN4/DFU= github.com/googleapis/enterprise-certificate-proxy v0.3.21/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= github.com/googleapis/gax-go/v2 v2.23.0 h1:Tchl7qkvE7Ip3y+ztvNufYFvkfqTe7NfLTYGIdJRLuE= @@ -134,6 +138,8 @@ github.com/mdlayher/socket v0.6.1 h1:M7uj2NtuujUY4mYr1C57NmfNiRHbkKpnBxO856lsc3A github.com/mdlayher/socket v0.6.1/go.mod h1:+/SGtqc9V+5dAuRgQsU0fGBI+oRDiW7O2Obx10OIWfg= github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI= github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/onsi/ginkgo/v2 v2.32.0 h1:Hw7s2pVrQo/8Yz5N77qdnpHaoc+c6cC9WIV1Jce+J6E= github.com/onsi/ginkgo/v2 v2.32.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= github.com/onsi/gomega v1.42.1 h1:iN1rCUX+44NZ1Dc97MPoeFYbFR0vh8zxoxMFwKdyZ6I= @@ -160,6 +166,8 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= +github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= +github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/securego/gosec/v2 v2.28.0 h1:ZsSdiDb0AtTpLFVol5z91gbMei9ZiLEPG/pZjZujp7c= @@ -170,6 +178,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.12.0 h1:K6Mr6jO9JICuend/5xzTM03ydSV3vdNRYAdPSukj8uI= github.com/stretchr/testify v1.12.0/go.mod h1:bOYBZb5qJ00vPzWfIqBUZPaxK8jWiXc6d3ErP4Ca9Gw= github.com/ti-mo/netfilter v0.2.0/go.mod h1:8GbBGsY/8fxtyIdfwy29JiluNcPK4K7wIT+x42ipqUU= @@ -212,6 +221,8 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4= @@ -295,6 +306,7 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.7.0 h1:w6WUp1VbkqPEgLz4rkBzH/CSU6HkoqNLp6GstyTx3lU= @@ -309,3 +321,7 @@ mvdan.cc/sh/v3 v3.13.1 h1:DP3TfgZhDkT7lerUdnp6PTGKyxxzz6T+cOlY/xEvfWk= mvdan.cc/sh/v3 v3.13.1/go.mod h1:lXJ8SexMvEVcHCoDvAGLZgFJ9Wsm2sulmoNEXGhYZD0= mvdan.cc/unparam v0.0.0-20260818115549-3f964bcb5673 h1:dEE6li4OPIE54oojY2qaayFS1fSp17G14si0gXRxl0U= mvdan.cc/unparam v0.0.0-20260818115549-3f964bcb5673/go.mod h1:62roFV3D3nYOWIXv3PfGO4UYEKAotz2WgLywT87ONd8= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/internal/aghos/os_windows.go b/internal/aghos/os_windows.go index 07f3205e1e7..981eeb9ae40 100644 --- a/internal/aghos/os_windows.go +++ b/internal/aghos/os_windows.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" + "github.com/AdguardTeam/golibs/errors" "golang.org/x/sys/windows" ) @@ -20,11 +21,11 @@ func haveAdminRights() (bool, error) { if err != nil { return false, err } + defer func() { err = errors.WithDeferred(err, token.Close()) }() info := make([]byte, 4) var returnedLen uint32 err = windows.GetTokenInformation(token, windows.TokenElevation, &info[0], uint32(len(info)), &returnedLen) - token.Close() if err != nil { return false, err } diff --git a/internal/next/AdGuardHome.example.yaml b/internal/next/AdGuardHome.example.yaml index dd75a302102..f224d0f9a4b 100644 --- a/internal/next/AdGuardHome.example.yaml +++ b/internal/next/AdGuardHome.example.yaml @@ -1,35 +1,34 @@ # This is a file showing example configuration for AdGuard Home. # # TODO(a.garipov): Move to the top level once the rewrite is over. - dns: - upstream_mode: parallel - addresses: - - '0.0.0.0:53' - bootstrap_dns: - - '9.9.9.10' - - '149.112.112.10' - - '2620:fe::10' - - '2620:fe::fe:10' - upstream_dns: - - '8.8.8.8' - dns64_prefixes: - - '1234::/64' - upstream_timeout: 1s - cache_size: 1048576 - ratelimit: 100 - bootstrap_prefer_ipv6: true - refuse_any: true - use_dns64: true + upstream_mode: parallel + addresses: + - '0.0.0.0:53' + bootstrap_dns: + - '9.9.9.10' + - '149.112.112.10' + - '2620:fe::10' + - '2620:fe::fe:10' + upstream_dns: + - '8.8.8.8' + dns64_prefixes: + - '1234::/64' + upstream_timeout: 1s + cache_size: 1048576 + ratelimit: 100 + bootstrap_prefer_ipv6: true + refuse_any: true + use_dns64: true http: - pprof: - port: 6060 - enabled: true - addresses: - - '0.0.0.0:3000' - secure_addresses: [] - timeout: 5s - force_https: true + pprof: + port: 6060 + enabled: true + addresses: + - '0.0.0.0:3000' + secure_addresses: [] + timeout: 5s + force_https: true log: - verbose: true + verbose: true schema_version: 100 diff --git a/scripts/make/sh-lint.sh b/scripts/make/sh-lint.sh index f7a9ca4db49..a6df00e2b04 100644 --- a/scripts/make/sh-lint.sh +++ b/scripts/make/sh-lint.sh @@ -3,14 +3,14 @@ # This comment is used to simplify checking local copies of the script. Bump # this number every time a significant change is made to this script. # -# AdGuard-Project-Version: 4 +# AdGuard-Project-Version: 5 + +# Don't use -f, because we use globs in this script. +set -e -o 'pipefail' -u verbose="${VERBOSE:-0}" readonly verbose -# Don't use -f, because we use globs in this script. -set -e -u - if [ "$verbose" -gt '0' ]; then set -x fi @@ -29,7 +29,7 @@ run_linter -e "$go" tool shfmt --binary-next-line -d -p -s \ ./snap/local/*.sh \ ; -shellcheck -e 'SC2250' -e 'SC2310' -f 'gcc' -o 'all' -x -- \ +shellcheck -e 'SC2250,SC2310,SC3040' -f 'gcc' -o 'all' -x -- \ ./scripts/hooks/* \ ./scripts/install.sh \ ./scripts/make/*.sh \ diff --git a/scripts/make/txt-lint.sh b/scripts/make/txt-lint.sh index a0c28da0fdf..1f38100f5e1 100644 --- a/scripts/make/txt-lint.sh +++ b/scripts/make/txt-lint.sh @@ -3,7 +3,10 @@ # This comment is used to simplify checking local copies of the script. Bump # this number every time a significant change is made to this script. # -# AdGuard-Project-Version: 12 +# AdGuard-Project-Version: 14 + +# Don't use -f, because we use globs in this script. +set -e -o 'pipefail' -u verbose="${VERBOSE:-0}" readonly verbose @@ -12,16 +15,6 @@ if [ "$verbose" -gt '0' ]; then set -x fi -# Set $EXIT_ON_ERROR to zero to see all errors. -if [ "${EXIT_ON_ERROR:-1}" -eq '0' ]; then - set +e -else - set -e -fi - -# We don't need glob expansions and we want to see errors about unset variables. -set -f -u - # Source the common helpers, including not_found. . ./scripts/make/helper.sh @@ -79,7 +72,7 @@ trailing_whitespace() { ')' \ -print \ | while read -r f; do - grep -e '[[:space:]]$' -n -- "$f" \ + { grep -e '[[:space:]]$' -n -- "$f" || :; } \ | sed -e "s:^:${f}\::" -e 's/ \+$/>>>&<<