├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md ├── dependabot.yml └── workflows │ └── ci.yml ├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── git_toolbox_blame.xml ├── git_toolbox_prj.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── kotlinc.xml ├── misc.xml ├── runConfigurations │ ├── nginx_pro__publishPlugin_.xml │ ├── nginx_pro__test_.xml │ └── nginx_pro__verifyPlugin_.xml └── vcs.xml ├── CHANGES.md ├── LICENSE ├── README.md ├── build.gradle.kts ├── description.html ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src ├── main ├── java │ └── dev │ │ └── meanmail │ │ ├── NginxLexer.java │ │ └── psi │ │ ├── BlockStmt.java │ │ ├── ConcatenatedExpr.java │ │ ├── ConditionExpr.java │ │ ├── ConditionStmt.java │ │ ├── DirectiveStmt.java │ │ ├── GeoBlockContent.java │ │ ├── GeoBlockStmt.java │ │ ├── GeoDefaultStmt.java │ │ ├── GeoDeleteStmt.java │ │ ├── GeoDirectiveStmt.java │ │ ├── GeoIncludeStmt.java │ │ ├── GeoProxyStmt.java │ │ ├── GeoRangesStmt.java │ │ ├── GeoStmt.java │ │ ├── GeoValueStmt.java │ │ ├── IfDirectiveStmt.java │ │ ├── IfParenStmt.java │ │ ├── IfStmt.java │ │ ├── LocationDirectiveStmt.java │ │ ├── LocationModifierStmt.java │ │ ├── LocationPathStmt.java │ │ ├── LocationStmt.java │ │ ├── LuaBlockStmt.java │ │ ├── LuaCodeStmt.java │ │ ├── LuaDirectiveStmt.java │ │ ├── LuaStmt.java │ │ ├── MapBlockContent.java │ │ ├── MapBlockStmt.java │ │ ├── MapDefaultStmt.java │ │ ├── MapDirectiveStmt.java │ │ ├── MapHostnamesStmt.java │ │ ├── MapIncludeStmt.java │ │ ├── MapStmt.java │ │ ├── MapValueStmt.java │ │ ├── MapVolatileStmt.java │ │ ├── NameStmt.java │ │ ├── RegularDirectiveStmt.java │ │ ├── StringStmt.java │ │ ├── Types.java │ │ ├── ValueStmt.java │ │ ├── VariableStmt.java │ │ ├── Visitor.java │ │ ├── impl │ │ ├── BlockStmtImpl.java │ │ ├── ConcatenatedExprImpl.java │ │ ├── ConditionExprImpl.java │ │ ├── ConditionStmtImpl.java │ │ ├── DirectiveStmtImpl.java │ │ ├── GeoBlockContentImpl.java │ │ ├── GeoBlockStmtImpl.java │ │ ├── GeoDefaultStmtImpl.java │ │ ├── GeoDeleteStmtImpl.java │ │ ├── GeoDirectiveStmtImpl.java │ │ ├── GeoIncludeStmtImpl.java │ │ ├── GeoProxyStmtImpl.java │ │ ├── GeoRangesStmtImpl.java │ │ ├── GeoStmtImpl.java │ │ ├── GeoValueStmtImpl.java │ │ ├── IfDirectiveStmtImpl.java │ │ ├── IfParenStmtImpl.java │ │ ├── IfStmtImpl.java │ │ ├── LocationDirectiveStmtImpl.java │ │ ├── LocationModifierStmtImpl.java │ │ ├── LocationPathStmtImpl.java │ │ ├── LocationStmtImpl.java │ │ ├── LuaBlockStmtImpl.java │ │ ├── LuaCodeStmtImpl.java │ │ ├── LuaDirectiveStmtImpl.java │ │ ├── LuaStmtImpl.java │ │ ├── MapBlockContentImpl.java │ │ ├── MapBlockStmtImpl.java │ │ ├── MapDefaultStmtImpl.java │ │ ├── MapDirectiveStmtImpl.java │ │ ├── MapHostnamesStmtImpl.java │ │ ├── MapIncludeStmtImpl.java │ │ ├── MapStmtImpl.java │ │ ├── MapValueStmtImpl.java │ │ ├── MapVolatileStmtImpl.java │ │ ├── NameStmtImpl.java │ │ ├── RegularDirectiveStmtImpl.java │ │ ├── StringStmtImpl.java │ │ ├── ValueStmtImpl.java │ │ └── VariableStmtImpl.java │ │ └── parser │ │ └── NginxParser.java ├── kotlin │ └── dev │ │ └── meanmail │ │ ├── Nginx.bnf │ │ ├── Nginx.flex │ │ ├── NginxCommenter.kt │ │ ├── NginxFileType.kt │ │ ├── NginxIcons.kt │ │ ├── NginxLanguage.kt │ │ ├── NginxLexerAdapter.kt │ │ ├── NginxParserDefinition.kt │ │ ├── NginxSyntaxHighlighter.kt │ │ ├── NginxSyntaxHighlighterFactory.kt │ │ ├── Utils.kt │ │ ├── codeInsight │ │ ├── completion │ │ │ └── NginxCompletionContributor.kt │ │ └── inspections │ │ │ ├── NginxDirectiveInspection.kt │ │ │ └── NginxGeoInspection.kt │ │ ├── directives │ │ ├── Common.kt │ │ └── nginx │ │ │ ├── core │ │ │ └── ngx_core_module.kt │ │ │ ├── google │ │ │ └── ngx_google_perftools_module.kt │ │ │ ├── http │ │ │ ├── auth │ │ │ │ ├── ngx_http_auth_basic_module.kt │ │ │ │ ├── ngx_http_auth_jwt_module.kt │ │ │ │ └── ngx_http_auth_request_module.kt │ │ │ ├── gzip │ │ │ │ ├── ngx_http_gzip_module.kt │ │ │ │ └── ngx_http_gzip_static_module.kt │ │ │ ├── limit │ │ │ │ ├── ngx_http_limit_conn_module.kt │ │ │ │ └── ngx_http_limit_req_module.kt │ │ │ ├── ngx_http_access_module.kt │ │ │ ├── ngx_http_addition_module.kt │ │ │ ├── ngx_http_api_module.kt │ │ │ ├── ngx_http_autoindex_module.kt │ │ │ ├── ngx_http_browser_module.kt │ │ │ ├── ngx_http_charset_module.kt │ │ │ ├── ngx_http_core_module.kt │ │ │ ├── ngx_http_dav_module.kt │ │ │ ├── ngx_http_empty_gif_module.kt │ │ │ ├── ngx_http_f4f_module.kt │ │ │ ├── ngx_http_fastcgi_module.kt │ │ │ ├── ngx_http_flv_module.kt │ │ │ ├── ngx_http_geo_module.kt │ │ │ ├── ngx_http_geoip_module.kt │ │ │ ├── ngx_http_grpc_module.kt │ │ │ ├── ngx_http_gunzip_module.kt │ │ │ ├── ngx_http_headers_module.kt │ │ │ ├── ngx_http_hls_module.kt │ │ │ ├── ngx_http_image_filter_module.kt │ │ │ ├── ngx_http_index_module.kt │ │ │ ├── ngx_http_js_module.kt │ │ │ ├── ngx_http_keyval_module.kt │ │ │ ├── ngx_http_log_module.kt │ │ │ ├── ngx_http_map_module.kt │ │ │ ├── ngx_http_memcached_module.kt │ │ │ ├── ngx_http_mirror_module.kt │ │ │ ├── ngx_http_mp4_module.kt │ │ │ ├── ngx_http_perl_module.kt │ │ │ ├── ngx_http_proxy_module.kt │ │ │ ├── ngx_http_random_index_module.kt │ │ │ ├── ngx_http_realip_module.kt │ │ │ ├── ngx_http_referer_module.kt │ │ │ ├── ngx_http_rewrite_module.kt │ │ │ ├── ngx_http_scgi_module.kt │ │ │ ├── ngx_http_secure_link_module.kt │ │ │ ├── ngx_http_session_log_module.kt │ │ │ ├── ngx_http_slice_module.kt │ │ │ ├── ngx_http_spdy_module.kt │ │ │ ├── ngx_http_split_clients_module.kt │ │ │ ├── ngx_http_ssi_module.kt │ │ │ ├── ngx_http_ssl_module.kt │ │ │ ├── ngx_http_status_module.kt │ │ │ ├── ngx_http_stub_status_module.kt │ │ │ ├── ngx_http_sub_module.kt │ │ │ ├── ngx_http_userid_module.kt │ │ │ ├── ngx_http_uwsgi_module.kt │ │ │ ├── ngx_http_v2_module.kt │ │ │ ├── ngx_http_xslt_module.kt │ │ │ └── upstream │ │ │ │ ├── ngx_http_upstream_conf_module.kt │ │ │ │ ├── ngx_http_upstream_hc_module.kt │ │ │ │ └── ngx_http_upstream_module.kt │ │ │ ├── mail │ │ │ ├── ngx_mail_auth_http_module.kt │ │ │ ├── ngx_mail_core_module.kt │ │ │ ├── ngx_mail_imap_module.kt │ │ │ ├── ngx_mail_pop3_module.kt │ │ │ ├── ngx_mail_proxy_module.kt │ │ │ ├── ngx_mail_realip_module.kt │ │ │ ├── ngx_mail_smtp_module.kt │ │ │ └── ngx_mail_ssl_module.kt │ │ │ └── stream │ │ │ ├── ngx_stream_access_module.kt │ │ │ ├── ngx_stream_core_module.kt │ │ │ ├── ngx_stream_geo_module.kt │ │ │ ├── ngx_stream_geoip_module.kt │ │ │ ├── ngx_stream_js_module.kt │ │ │ ├── ngx_stream_keyval_module.kt │ │ │ ├── ngx_stream_limit_conn_module.kt │ │ │ ├── ngx_stream_log_module.kt │ │ │ ├── ngx_stream_map_module.kt │ │ │ ├── ngx_stream_pass_module.kt │ │ │ ├── ngx_stream_proxy_module.kt │ │ │ ├── ngx_stream_realip_module.kt │ │ │ ├── ngx_stream_return_module.kt │ │ │ ├── ngx_stream_set_module.kt │ │ │ ├── ngx_stream_split_clients_module.kt │ │ │ ├── ngx_stream_zone_sync_module.kt │ │ │ ├── ssl │ │ │ ├── ngx_stream_ssl_module.kt │ │ │ └── ngx_stream_ssl_preread_module.kt │ │ │ └── upstream │ │ │ ├── ngx_stream_upstream_hc_module.kt │ │ │ └── ngx_stream_upstream_module.kt │ │ ├── folding │ │ └── NginxFoldingBuilder.kt │ │ ├── psi │ │ ├── NamedElement.kt │ │ ├── NginxElementType.kt │ │ ├── NginxFile.kt │ │ ├── NginxTokenType.kt │ │ ├── PsiImplUtil.kt │ │ ├── Reference.kt │ │ └── WithPathElement.kt │ │ └── structure │ │ ├── NginxStructureViewElement.kt │ │ ├── NginxStructureViewFactory.kt │ │ └── NginxStructureViewModel.kt └── resources │ ├── META-INF │ ├── plugin.xml │ ├── pluginIcon.svg │ └── pluginIcon_dark.svg │ ├── inspectionDescriptions │ ├── NginxDirectiveValueInspection.html │ └── NginxGeoInspection.html │ ├── nginx-dark.png │ └── nginx.png └── test ├── kotlin └── dev │ └── meanmail │ ├── codeInsight │ ├── completion │ │ └── NginxCompletionContributorTest.kt │ └── inspections │ │ ├── NginxGeoInspectionTest.kt │ │ └── NginxIfInspectionTest.kt │ ├── folding │ └── NginxFoldingBuilderTest.kt │ ├── lexer │ └── NginxLexerTest.kt │ ├── parsing │ └── ParsingTest.kt │ ├── reference │ └── NginxReferenceTest.kt │ └── structure │ └── NginxStructureViewElementTest.kt └── resources └── dev └── meanmail ├── inspections ├── geo │ ├── geoOutsideContext.nginx │ ├── geoWithDelete.nginx │ ├── geoWithInclude.nginx │ ├── geoWithRangesInStream.nginx │ ├── geoWithSingleVariable.nginx │ ├── geoWithoutDefault.nginx │ ├── httpGeoWithProxy.nginx │ ├── streamGeoWithDelete.nginx │ └── streamGeoWithProxy.nginx └── if │ ├── ifWithEqual.nginx │ ├── ifWithFile.nginx │ ├── ifWithNotEqual.nginx │ └── ifWithRegex.nginx └── parsing └── testData ├── GeoDirective.nginx.conf ├── GeoDirective.txt ├── Location.nginx.conf ├── Location.txt ├── Logging.nginx.conf ├── Logging.txt ├── Lua.nginx.conf ├── Lua.txt ├── NestedLocation.nginx.conf ├── NestedLocation.txt ├── RateLimiting.nginx.conf ├── RateLimiting.txt ├── SSL.nginx.conf ├── SSL.txt ├── Sample.nginx.conf ├── Sample.txt ├── Sample2.nginx.conf ├── Sample2.txt ├── SetByLuaBlock.nginx.conf ├── SetByLuaBlock.txt ├── Upstream.nginx.conf ├── Upstream.txt ├── Upstream_1_27_3.nginx.conf └── Upstream_1_27_3.txt /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: meanmail 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **IDE (please complete the following information. See Main Menu -> Help -> About):** 27 | - OS: [e.g. Windows 10] 28 | - Product: [e.g. Idea Ultimate, PyCharm Community] 29 | - Version [e.g. IU-192.7142.36, 2019.2.4] 30 | - JRE Version: [e.g. OpenJDK 64-Bit Server VM by JetBrains s.r.o] 31 | - Project SDK: [Python 3.7.1, Python 2.7.17] 32 | 33 | **Plugin (please complete the following information. See Main Menu -> File -> Settings -> Plugins):** 34 | - Version [e.g. 2020.1-193] 35 | 36 | **Additional context** 37 | Add any other context about the problem here. 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: meanmail 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | target-branch: main 6 | schedule: 7 | interval: "daily" 8 | time: "00:00" 9 | groups: 10 | all-actions: 11 | patterns: [ "*" ] 12 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | validation: 15 | name: Validation 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | 20 | - uses: gradle/actions/wrapper-validation@v4 21 | 22 | test: 23 | name: Test 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - name: Set up JDK 29 | uses: actions/setup-java@v4 30 | with: 31 | distribution: 'corretto' 32 | java-version: '17' 33 | 34 | - name: Test 35 | run: ./gradlew test 36 | 37 | build: 38 | name: Build 39 | runs-on: ubuntu-latest 40 | needs: 41 | - test 42 | steps: 43 | - uses: actions/checkout@v4 44 | 45 | - name: Set up JDK 46 | uses: actions/setup-java@v4 47 | with: 48 | distribution: 'corretto' 49 | java-version: '17' 50 | 51 | - name: Build with Gradle 52 | run: ./gradlew buildPlugin 53 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | nginx-intellij-plugin -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/git_toolbox_blame.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/runConfigurations/nginx_pro__publishPlugin_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/runConfigurations/nginx_pro__test_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/runConfigurations/nginx_pro__verifyPlugin_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 meanmail.dev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nginx intellij plugin 2 | 3 | [![JetBrains IntelliJ Plugins](https://img.shields.io/jetbrains/plugin/r/stars/15461?label=JetBrans%20Marketplace)](https://plugins.jetbrains.com/plugin/15461) 4 | [![JetBrains IntelliJ plugins](https://img.shields.io/jetbrains/plugin/d/15461)](https://plugins.jetbrains.com/plugin/15461) 5 | [![Twitter Follow](https://img.shields.io/twitter/follow/meanmaildev?style=plastic)](https://twitter.com/meanmaildev) 6 | 7 | https://plugins.jetbrains.com/plugin/15461 8 | 9 | https://meanmail.dev 10 | 11 | Your ratings and feedback are very important. The feature will appear the faster the more people request it. 12 | 13 | ## Features 14 | 15 | * Highlighting for nginx configuration files in IDE 16 | * Comment with Line Comment action 17 | * Structure view 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Gradle 2 | gradleVersion=8.14.1 3 | org.gradle.parallel=true 4 | # Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html 5 | org.gradle.configuration-cache=true 6 | # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html 7 | org.gradle.caching=true 8 | # https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions 9 | jvmVersion=17 10 | # 11 | # Plugin 12 | group=dev.meanmail 13 | repository=https://github.com/meanmail-dev/nginx-intellij-plugin 14 | pluginName=Nginx Configuration 15 | version=2025.11 16 | # https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library 17 | kotlin.stdlib.default.dependency=false 18 | # 19 | # Platform 20 | platformSinceBuild=233 21 | # Develop platform 22 | platformVersion=2024.3 23 | platformType=PC 24 | plugins=com.tang:1.4.17-IDEA243 25 | #platformBundledPlugins=PythonCore 26 | # 27 | # Publish 28 | publishChannel=Stable 29 | # 30 | # Nginx 31 | nginxVersion=1.27.3 32 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | # libraries 3 | junit = "4.13.2" 4 | 5 | # plugins 6 | intelliJPlatform = "2.1.0" 7 | kotlin = "1.9.25" 8 | 9 | 10 | [libraries] 11 | junit = { group = "junit", name = "junit", version.ref = "junit" } 12 | 13 | [plugins] 14 | intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" } 15 | kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meanmail-dev/nginx-intellij-plugin/d3e56500160fceeae86ee48d44de00ab88160b00/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "nginx-intellij-plugin" 2 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/BlockStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface BlockStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getDirectiveStmtList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/ConcatenatedExpr.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface ConcatenatedExpr extends PsiElement { 10 | 11 | @NotNull 12 | List getVariableStmtList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/ConditionExpr.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface ConditionExpr extends PsiElement { 8 | 9 | @Nullable 10 | ConcatenatedExpr getConcatenatedExpr(); 11 | 12 | @Nullable 13 | StringStmt getStringStmt(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/ConditionStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface ConditionStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getConditionExprList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/DirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.List; 8 | 9 | public interface DirectiveStmt extends WithPathElement { 10 | 11 | @Nullable 12 | GeoDirectiveStmt getGeoDirectiveStmt(); 13 | 14 | @Nullable 15 | IfDirectiveStmt getIfDirectiveStmt(); 16 | 17 | @Nullable 18 | LocationDirectiveStmt getLocationDirectiveStmt(); 19 | 20 | @Nullable 21 | LuaDirectiveStmt getLuaDirectiveStmt(); 22 | 23 | @Nullable 24 | MapDirectiveStmt getMapDirectiveStmt(); 25 | 26 | @Nullable 27 | RegularDirectiveStmt getRegularDirectiveStmt(); 28 | 29 | @NotNull 30 | List getPath(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoBlockContent.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface GeoBlockContent extends PsiElement { 8 | 9 | @Nullable 10 | GeoDefaultStmt getGeoDefaultStmt(); 11 | 12 | @Nullable 13 | GeoDeleteStmt getGeoDeleteStmt(); 14 | 15 | @Nullable 16 | GeoIncludeStmt getGeoIncludeStmt(); 17 | 18 | @Nullable 19 | GeoProxyStmt getGeoProxyStmt(); 20 | 21 | @Nullable 22 | GeoRangesStmt getGeoRangesStmt(); 23 | 24 | @Nullable 25 | GeoValueStmt getGeoValueStmt(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoBlockStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface GeoBlockStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getGeoBlockContentList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoDefaultStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface GeoDefaultStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoDeleteStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface GeoDeleteStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.List; 9 | 10 | public interface GeoDirectiveStmt extends PsiElement { 11 | 12 | @Nullable 13 | GeoBlockStmt getGeoBlockStmt(); 14 | 15 | @NotNull 16 | GeoStmt getGeoStmt(); 17 | 18 | @NotNull 19 | List getVariableStmtList(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoIncludeStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface GeoIncludeStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoProxyStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface GeoProxyStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoRangesStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface GeoRangesStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface GeoStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/GeoValueStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface GeoValueStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getValueStmtList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/IfDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | public interface IfDirectiveStmt extends PsiElement { 9 | 10 | @Nullable 11 | BlockStmt getBlockStmt(); 12 | 13 | @Nullable 14 | IfParenStmt getIfParenStmt(); 15 | 16 | @NotNull 17 | IfStmt getIfStmt(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/IfParenStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface IfParenStmt extends PsiElement { 8 | 9 | @Nullable 10 | ConditionStmt getConditionStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/IfStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface IfStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LocationDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | public interface LocationDirectiveStmt extends PsiElement { 9 | 10 | @Nullable 11 | BlockStmt getBlockStmt(); 12 | 13 | @Nullable 14 | LocationModifierStmt getLocationModifierStmt(); 15 | 16 | @Nullable 17 | LocationPathStmt getLocationPathStmt(); 18 | 19 | @NotNull 20 | LocationStmt getLocationStmt(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LocationModifierStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface LocationModifierStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LocationPathStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public interface LocationPathStmt extends PsiElement { 8 | 9 | @NotNull 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LocationStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface LocationStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LuaBlockStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface LuaBlockStmt extends PsiElement { 8 | 9 | @Nullable 10 | LuaCodeStmt getLuaCodeStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LuaCodeStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiLanguageInjectionHost; 5 | 6 | public interface LuaCodeStmt extends PsiLanguageInjectionHost { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LuaDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.List; 9 | 10 | public interface LuaDirectiveStmt extends PsiElement { 11 | 12 | @Nullable 13 | LuaBlockStmt getLuaBlockStmt(); 14 | 15 | @NotNull 16 | LuaStmt getLuaStmt(); 17 | 18 | @NotNull 19 | List getValueStmtList(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/LuaStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface LuaStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapBlockContent.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface MapBlockContent extends PsiElement { 8 | 9 | @Nullable 10 | MapDefaultStmt getMapDefaultStmt(); 11 | 12 | @Nullable 13 | MapHostnamesStmt getMapHostnamesStmt(); 14 | 15 | @Nullable 16 | MapIncludeStmt getMapIncludeStmt(); 17 | 18 | @Nullable 19 | MapValueStmt getMapValueStmt(); 20 | 21 | @Nullable 22 | MapVolatileStmt getMapVolatileStmt(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapBlockStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface MapBlockStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getMapBlockContentList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapDefaultStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface MapDefaultStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.List; 9 | 10 | public interface MapDirectiveStmt extends PsiElement { 11 | 12 | @Nullable 13 | MapBlockStmt getMapBlockStmt(); 14 | 15 | @NotNull 16 | MapStmt getMapStmt(); 17 | 18 | @NotNull 19 | List getValueStmtList(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapHostnamesStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface MapHostnamesStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapIncludeStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public interface MapIncludeStmt extends PsiElement { 8 | 9 | @Nullable 10 | ValueStmt getValueStmt(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface MapStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapValueStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.List; 8 | 9 | public interface MapValueStmt extends PsiElement { 10 | 11 | @NotNull 12 | List getValueStmtList(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/MapVolatileStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface MapVolatileStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/NameStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface NameStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/RegularDirectiveStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.List; 9 | 10 | public interface RegularDirectiveStmt extends PsiElement { 11 | 12 | @Nullable 13 | BlockStmt getBlockStmt(); 14 | 15 | @NotNull 16 | NameStmt getNameStmt(); 17 | 18 | @NotNull 19 | List getValueStmtList(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/StringStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface StringStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/ValueStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public interface ValueStmt extends ReferenceElement { 7 | 8 | @Nullable 9 | ConcatenatedExpr getConcatenatedExpr(); 10 | 11 | @Nullable 12 | StringStmt getStringStmt(); 13 | 14 | @Nullable 15 | VariableStmt getVariableStmt(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/VariableStmt.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi; 3 | 4 | import com.intellij.psi.PsiElement; 5 | 6 | public interface VariableStmt extends PsiElement { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/BlockStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.BlockStmt; 9 | import dev.meanmail.psi.DirectiveStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class BlockStmtImpl extends ASTWrapperPsiElement implements BlockStmt { 16 | 17 | public BlockStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitBlockStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getDirectiveStmtList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, DirectiveStmt.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/ConcatenatedExprImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.ConcatenatedExpr; 9 | import dev.meanmail.psi.VariableStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class ConcatenatedExprImpl extends ASTWrapperPsiElement implements ConcatenatedExpr { 16 | 17 | public ConcatenatedExprImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitConcatenatedExpr(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getVariableStmtList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, VariableStmt.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/ConditionExprImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.ConcatenatedExpr; 8 | import dev.meanmail.psi.ConditionExpr; 9 | import dev.meanmail.psi.StringStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public class ConditionExprImpl extends ASTWrapperPsiElement implements ConditionExpr { 15 | 16 | public ConditionExprImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull Visitor visitor) { 21 | visitor.visitConditionExpr(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof Visitor) accept((Visitor) visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | @Nullable 32 | public ConcatenatedExpr getConcatenatedExpr() { 33 | return findChildByClass(ConcatenatedExpr.class); 34 | } 35 | 36 | @Override 37 | @Nullable 38 | public StringStmt getStringStmt() { 39 | return findChildByClass(StringStmt.class); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/ConditionStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.ConditionExpr; 9 | import dev.meanmail.psi.ConditionStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class ConditionStmtImpl extends ASTWrapperPsiElement implements ConditionStmt { 16 | 17 | public ConditionStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitConditionStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getConditionExprList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ConditionExpr.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoBlockContentImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.*; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | public class GeoBlockContentImpl extends ASTWrapperPsiElement implements GeoBlockContent { 12 | 13 | public GeoBlockContentImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitGeoBlockContent(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | @Override 28 | @Nullable 29 | public GeoDefaultStmt getGeoDefaultStmt() { 30 | return findChildByClass(GeoDefaultStmt.class); 31 | } 32 | 33 | @Override 34 | @Nullable 35 | public GeoDeleteStmt getGeoDeleteStmt() { 36 | return findChildByClass(GeoDeleteStmt.class); 37 | } 38 | 39 | @Override 40 | @Nullable 41 | public GeoIncludeStmt getGeoIncludeStmt() { 42 | return findChildByClass(GeoIncludeStmt.class); 43 | } 44 | 45 | @Override 46 | @Nullable 47 | public GeoProxyStmt getGeoProxyStmt() { 48 | return findChildByClass(GeoProxyStmt.class); 49 | } 50 | 51 | @Override 52 | @Nullable 53 | public GeoRangesStmt getGeoRangesStmt() { 54 | return findChildByClass(GeoRangesStmt.class); 55 | } 56 | 57 | @Override 58 | @Nullable 59 | public GeoValueStmt getGeoValueStmt() { 60 | return findChildByClass(GeoValueStmt.class); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoBlockStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.GeoBlockContent; 9 | import dev.meanmail.psi.GeoBlockStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class GeoBlockStmtImpl extends ASTWrapperPsiElement implements GeoBlockStmt { 16 | 17 | public GeoBlockStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitGeoBlockStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getGeoBlockContentList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, GeoBlockContent.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoDefaultStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoDefaultStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class GeoDefaultStmtImpl extends ASTWrapperPsiElement implements GeoDefaultStmt { 14 | 15 | public GeoDefaultStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitGeoDefaultStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoDeleteStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoDeleteStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class GeoDeleteStmtImpl extends ASTWrapperPsiElement implements GeoDeleteStmt { 14 | 15 | public GeoDeleteStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitGeoDeleteStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.*; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.List; 13 | 14 | public class GeoDirectiveStmtImpl extends ASTWrapperPsiElement implements GeoDirectiveStmt { 15 | 16 | public GeoDirectiveStmtImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull Visitor visitor) { 21 | visitor.visitGeoDirectiveStmt(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof Visitor) accept((Visitor) visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | @Nullable 32 | public GeoBlockStmt getGeoBlockStmt() { 33 | return findChildByClass(GeoBlockStmt.class); 34 | } 35 | 36 | @Override 37 | @NotNull 38 | public GeoStmt getGeoStmt() { 39 | return findNotNullChildByClass(GeoStmt.class); 40 | } 41 | 42 | @Override 43 | @NotNull 44 | public List getVariableStmtList() { 45 | return PsiTreeUtil.getChildrenOfTypeAsList(this, VariableStmt.class); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoIncludeStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoIncludeStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class GeoIncludeStmtImpl extends ASTWrapperPsiElement implements GeoIncludeStmt { 14 | 15 | public GeoIncludeStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitGeoIncludeStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoProxyStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoProxyStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class GeoProxyStmtImpl extends ASTWrapperPsiElement implements GeoProxyStmt { 14 | 15 | public GeoProxyStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitGeoProxyStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoRangesStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoRangesStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class GeoRangesStmtImpl extends ASTWrapperPsiElement implements GeoRangesStmt { 12 | 13 | public GeoRangesStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitGeoRangesStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.GeoStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class GeoStmtImpl extends ASTWrapperPsiElement implements GeoStmt { 12 | 13 | public GeoStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitGeoStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/GeoValueStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.GeoValueStmt; 9 | import dev.meanmail.psi.ValueStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class GeoValueStmtImpl extends ASTWrapperPsiElement implements GeoValueStmt { 16 | 17 | public GeoValueStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitGeoValueStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getValueStmtList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueStmt.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/IfDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.*; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | public class IfDirectiveStmtImpl extends ASTWrapperPsiElement implements IfDirectiveStmt { 12 | 13 | public IfDirectiveStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitIfDirectiveStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | @Override 28 | @Nullable 29 | public BlockStmt getBlockStmt() { 30 | return findChildByClass(BlockStmt.class); 31 | } 32 | 33 | @Override 34 | @Nullable 35 | public IfParenStmt getIfParenStmt() { 36 | return findChildByClass(IfParenStmt.class); 37 | } 38 | 39 | @Override 40 | @NotNull 41 | public IfStmt getIfStmt() { 42 | return findNotNullChildByClass(IfStmt.class); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/IfParenStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.ConditionStmt; 8 | import dev.meanmail.psi.IfParenStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class IfParenStmtImpl extends ASTWrapperPsiElement implements IfParenStmt { 14 | 15 | public IfParenStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitIfParenStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ConditionStmt getConditionStmt() { 32 | return findChildByClass(ConditionStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/IfStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.IfStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class IfStmtImpl extends ASTWrapperPsiElement implements IfStmt { 12 | 13 | public IfStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitIfStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LocationDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.*; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | public class LocationDirectiveStmtImpl extends ASTWrapperPsiElement implements LocationDirectiveStmt { 12 | 13 | public LocationDirectiveStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitLocationDirectiveStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | @Override 28 | @Nullable 29 | public BlockStmt getBlockStmt() { 30 | return findChildByClass(BlockStmt.class); 31 | } 32 | 33 | @Override 34 | @Nullable 35 | public LocationModifierStmt getLocationModifierStmt() { 36 | return findChildByClass(LocationModifierStmt.class); 37 | } 38 | 39 | @Override 40 | @Nullable 41 | public LocationPathStmt getLocationPathStmt() { 42 | return findChildByClass(LocationPathStmt.class); 43 | } 44 | 45 | @Override 46 | @NotNull 47 | public LocationStmt getLocationStmt() { 48 | return findNotNullChildByClass(LocationStmt.class); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LocationModifierStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.LocationModifierStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class LocationModifierStmtImpl extends ASTWrapperPsiElement implements LocationModifierStmt { 12 | 13 | public LocationModifierStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitLocationModifierStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LocationPathStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.LocationPathStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | public class LocationPathStmtImpl extends ASTWrapperPsiElement implements LocationPathStmt { 13 | 14 | public LocationPathStmtImpl(@NotNull ASTNode node) { 15 | super(node); 16 | } 17 | 18 | public void accept(@NotNull Visitor visitor) { 19 | visitor.visitLocationPathStmt(this); 20 | } 21 | 22 | @Override 23 | public void accept(@NotNull PsiElementVisitor visitor) { 24 | if (visitor instanceof Visitor) accept((Visitor) visitor); 25 | else super.accept(visitor); 26 | } 27 | 28 | @Override 29 | @NotNull 30 | public ValueStmt getValueStmt() { 31 | return findNotNullChildByClass(ValueStmt.class); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LocationStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.LocationStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class LocationStmtImpl extends ASTWrapperPsiElement implements LocationStmt { 12 | 13 | public LocationStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitLocationStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LuaBlockStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.LuaBlockStmt; 8 | import dev.meanmail.psi.LuaCodeStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class LuaBlockStmtImpl extends ASTWrapperPsiElement implements LuaBlockStmt { 14 | 15 | public LuaBlockStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitLuaBlockStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public LuaCodeStmt getLuaCodeStmt() { 32 | return findChildByClass(LuaCodeStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LuaCodeStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.LiteralTextEscaper; 7 | import com.intellij.psi.PsiElementVisitor; 8 | import com.intellij.psi.PsiLanguageInjectionHost; 9 | import dev.meanmail.psi.LuaCodeStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | public class LuaCodeStmtImpl extends ASTWrapperPsiElement implements LuaCodeStmt { 14 | 15 | public LuaCodeStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitLuaCodeStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | public boolean isValidHost() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public PsiLanguageInjectionHost updateText(@NotNull String text) { 36 | return this; 37 | } 38 | 39 | @Override 40 | public @NotNull 41 | LiteralTextEscaper createLiteralTextEscaper() { 42 | return LiteralTextEscaper.createSimple(this); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LuaDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.*; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.List; 13 | 14 | public class LuaDirectiveStmtImpl extends ASTWrapperPsiElement implements LuaDirectiveStmt { 15 | 16 | public LuaDirectiveStmtImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull Visitor visitor) { 21 | visitor.visitLuaDirectiveStmt(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof Visitor) accept((Visitor) visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | @Nullable 32 | public LuaBlockStmt getLuaBlockStmt() { 33 | return findChildByClass(LuaBlockStmt.class); 34 | } 35 | 36 | @Override 37 | @NotNull 38 | public LuaStmt getLuaStmt() { 39 | return findNotNullChildByClass(LuaStmt.class); 40 | } 41 | 42 | @Override 43 | @NotNull 44 | public List getValueStmtList() { 45 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueStmt.class); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/LuaStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.LuaStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class LuaStmtImpl extends ASTWrapperPsiElement implements LuaStmt { 12 | 13 | public LuaStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitLuaStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapBlockContentImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.*; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | public class MapBlockContentImpl extends ASTWrapperPsiElement implements MapBlockContent { 12 | 13 | public MapBlockContentImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitMapBlockContent(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | @Override 28 | @Nullable 29 | public MapDefaultStmt getMapDefaultStmt() { 30 | return findChildByClass(MapDefaultStmt.class); 31 | } 32 | 33 | @Override 34 | @Nullable 35 | public MapHostnamesStmt getMapHostnamesStmt() { 36 | return findChildByClass(MapHostnamesStmt.class); 37 | } 38 | 39 | @Override 40 | @Nullable 41 | public MapIncludeStmt getMapIncludeStmt() { 42 | return findChildByClass(MapIncludeStmt.class); 43 | } 44 | 45 | @Override 46 | @Nullable 47 | public MapValueStmt getMapValueStmt() { 48 | return findChildByClass(MapValueStmt.class); 49 | } 50 | 51 | @Override 52 | @Nullable 53 | public MapVolatileStmt getMapVolatileStmt() { 54 | return findChildByClass(MapVolatileStmt.class); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapBlockStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.MapBlockContent; 9 | import dev.meanmail.psi.MapBlockStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class MapBlockStmtImpl extends ASTWrapperPsiElement implements MapBlockStmt { 16 | 17 | public MapBlockStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitMapBlockStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getMapBlockContentList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, MapBlockContent.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapDefaultStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.MapDefaultStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class MapDefaultStmtImpl extends ASTWrapperPsiElement implements MapDefaultStmt { 14 | 15 | public MapDefaultStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitMapDefaultStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.*; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.List; 13 | 14 | public class MapDirectiveStmtImpl extends ASTWrapperPsiElement implements MapDirectiveStmt { 15 | 16 | public MapDirectiveStmtImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull Visitor visitor) { 21 | visitor.visitMapDirectiveStmt(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof Visitor) accept((Visitor) visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | @Nullable 32 | public MapBlockStmt getMapBlockStmt() { 33 | return findChildByClass(MapBlockStmt.class); 34 | } 35 | 36 | @Override 37 | @NotNull 38 | public MapStmt getMapStmt() { 39 | return findNotNullChildByClass(MapStmt.class); 40 | } 41 | 42 | @Override 43 | @NotNull 44 | public List getValueStmtList() { 45 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueStmt.class); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapHostnamesStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.MapHostnamesStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class MapHostnamesStmtImpl extends ASTWrapperPsiElement implements MapHostnamesStmt { 12 | 13 | public MapHostnamesStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitMapHostnamesStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapIncludeStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.MapIncludeStmt; 8 | import dev.meanmail.psi.ValueStmt; 9 | import dev.meanmail.psi.Visitor; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.jetbrains.annotations.Nullable; 12 | 13 | public class MapIncludeStmtImpl extends ASTWrapperPsiElement implements MapIncludeStmt { 14 | 15 | public MapIncludeStmtImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull Visitor visitor) { 20 | visitor.visitMapIncludeStmt(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof Visitor) accept((Visitor) visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | @Nullable 31 | public ValueStmt getValueStmt() { 32 | return findChildByClass(ValueStmt.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.MapStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class MapStmtImpl extends ASTWrapperPsiElement implements MapStmt { 12 | 13 | public MapStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitMapStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapValueStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.MapValueStmt; 9 | import dev.meanmail.psi.ValueStmt; 10 | import dev.meanmail.psi.Visitor; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.List; 14 | 15 | public class MapValueStmtImpl extends ASTWrapperPsiElement implements MapValueStmt { 16 | 17 | public MapValueStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitMapValueStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @NotNull 33 | public List getValueStmtList() { 34 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueStmt.class); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/MapVolatileStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.MapVolatileStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class MapVolatileStmtImpl extends ASTWrapperPsiElement implements MapVolatileStmt { 12 | 13 | public MapVolatileStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitMapVolatileStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/NameStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.NameStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class NameStmtImpl extends ASTWrapperPsiElement implements NameStmt { 12 | 13 | public NameStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitNameStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/RegularDirectiveStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import com.intellij.psi.util.PsiTreeUtil; 8 | import dev.meanmail.psi.*; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.List; 13 | 14 | public class RegularDirectiveStmtImpl extends ASTWrapperPsiElement implements RegularDirectiveStmt { 15 | 16 | public RegularDirectiveStmtImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull Visitor visitor) { 21 | visitor.visitRegularDirectiveStmt(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof Visitor) accept((Visitor) visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | @Nullable 32 | public BlockStmt getBlockStmt() { 33 | return findChildByClass(BlockStmt.class); 34 | } 35 | 36 | @Override 37 | @NotNull 38 | public NameStmt getNameStmt() { 39 | return findNotNullChildByClass(NameStmt.class); 40 | } 41 | 42 | @Override 43 | @NotNull 44 | public List getValueStmtList() { 45 | return PsiTreeUtil.getChildrenOfTypeAsList(this, ValueStmt.class); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/StringStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.StringStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class StringStmtImpl extends ASTWrapperPsiElement implements StringStmt { 12 | 13 | public StringStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitStringStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/ValueStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.openapi.util.NlsSafe; 7 | import com.intellij.psi.PsiElement; 8 | import com.intellij.psi.PsiElementVisitor; 9 | import com.intellij.psi.PsiReference; 10 | import com.intellij.util.IncorrectOperationException; 11 | import dev.meanmail.psi.*; 12 | import org.jetbrains.annotations.NotNull; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | public class ValueStmtImpl extends ASTWrapperPsiElement implements ValueStmt { 16 | 17 | public ValueStmtImpl(@NotNull ASTNode node) { 18 | super(node); 19 | } 20 | 21 | public void accept(@NotNull Visitor visitor) { 22 | visitor.visitValueStmt(this); 23 | } 24 | 25 | @Override 26 | public void accept(@NotNull PsiElementVisitor visitor) { 27 | if (visitor instanceof Visitor) accept((Visitor) visitor); 28 | else super.accept(visitor); 29 | } 30 | 31 | @Override 32 | @Nullable 33 | public ConcatenatedExpr getConcatenatedExpr() { 34 | return findChildByClass(ConcatenatedExpr.class); 35 | } 36 | 37 | @Override 38 | @Nullable 39 | public StringStmt getStringStmt() { 40 | return findChildByClass(StringStmt.class); 41 | } 42 | 43 | @Override 44 | @Nullable 45 | public VariableStmt getVariableStmt() { 46 | return findChildByClass(VariableStmt.class); 47 | } 48 | 49 | @NotNull 50 | @Override 51 | public String getRef() { 52 | return getText(); 53 | } 54 | 55 | @Override 56 | public @Nullable PsiElement getNameIdentifier() { 57 | return this; 58 | } 59 | 60 | @Override 61 | public PsiElement setName(@NlsSafe @NotNull String name) throws IncorrectOperationException { 62 | return this; 63 | } 64 | 65 | @Override 66 | public PsiReference getReference() { 67 | Reference reference = new Reference(this); 68 | if (reference.resolve() == null) { 69 | return null; 70 | } 71 | return reference; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/dev/meanmail/psi/impl/VariableStmtImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package dev.meanmail.psi.impl; 3 | 4 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 5 | import com.intellij.lang.ASTNode; 6 | import com.intellij.psi.PsiElementVisitor; 7 | import dev.meanmail.psi.VariableStmt; 8 | import dev.meanmail.psi.Visitor; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class VariableStmtImpl extends ASTWrapperPsiElement implements VariableStmt { 12 | 13 | public VariableStmtImpl(@NotNull ASTNode node) { 14 | super(node); 15 | } 16 | 17 | public void accept(@NotNull Visitor visitor) { 18 | visitor.visitVariableStmt(this); 19 | } 20 | 21 | @Override 22 | public void accept(@NotNull PsiElementVisitor visitor) { 23 | if (visitor instanceof Visitor) accept((Visitor) visitor); 24 | else super.accept(visitor); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxCommenter.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.lang.Commenter 4 | 5 | class NginxCommenter : Commenter { 6 | 7 | override fun getCommentedBlockCommentPrefix(): String? = null 8 | 9 | override fun getCommentedBlockCommentSuffix(): String? = null 10 | 11 | override fun getBlockCommentPrefix(): String? = null 12 | 13 | override fun getBlockCommentSuffix(): String? = null 14 | 15 | override fun getLineCommentPrefix(): String = "# " 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxFileType.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | 4 | import com.intellij.openapi.fileTypes.LanguageFileType 5 | import javax.swing.Icon 6 | 7 | 8 | class NginxFileType : LanguageFileType(NginxLanguage) { 9 | override fun getName(): String { 10 | return NginxLanguage.id 11 | } 12 | 13 | override fun getDescription(): String { 14 | return "Nginx configuration file" 15 | } 16 | 17 | override fun getDefaultExtension(): String { 18 | return "conf" 19 | } 20 | 21 | override fun getIcon(): Icon { 22 | return AllIcons.FILE 23 | } 24 | 25 | companion object { 26 | val INSTANCE: NginxFileType = NginxFileType() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxIcons.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.openapi.util.IconLoader 4 | import com.intellij.ui.JBColor 5 | 6 | object AllIcons { 7 | 8 | val FILE = 9 | IconLoader.getIcon(if (JBColor.isBright()) "/nginx.png" else "/nginx-dark.png", this::class.java) // 16x16 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxLanguage.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.lang.Language 4 | 5 | object NginxLanguage : Language("Nginx Configuration") 6 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxLexerAdapter.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.lexer.FlexAdapter 4 | 5 | import java.io.Reader 6 | 7 | class NginxLexerAdapter : FlexAdapter(NginxLexer(null as Reader?)) 8 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxParserDefinition.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.lang.ParserDefinition 5 | import com.intellij.lang.PsiParser 6 | import com.intellij.lexer.Lexer 7 | import com.intellij.openapi.project.Project 8 | import com.intellij.psi.FileViewProvider 9 | import com.intellij.psi.PsiElement 10 | import com.intellij.psi.PsiFile 11 | import com.intellij.psi.TokenType 12 | import com.intellij.psi.tree.IFileElementType 13 | import com.intellij.psi.tree.TokenSet 14 | import dev.meanmail.psi.NginxFile 15 | import dev.meanmail.psi.Types 16 | import dev.meanmail.psi.parser.NginxParser 17 | 18 | class NginxParserDefinition : ParserDefinition { 19 | 20 | override fun createLexer(project: Project): Lexer { 21 | return NginxLexerAdapter() 22 | } 23 | 24 | override fun getWhitespaceTokens(): TokenSet { 25 | return WHITE_SPACES 26 | } 27 | 28 | override fun getCommentTokens(): TokenSet { 29 | return COMMENTS 30 | } 31 | 32 | override fun getStringLiteralElements(): TokenSet { 33 | return TokenSet.EMPTY 34 | } 35 | 36 | override fun createParser(project: Project): PsiParser { 37 | return NginxParser() 38 | } 39 | 40 | override fun getFileNodeType(): IFileElementType { 41 | return FILE 42 | } 43 | 44 | override fun createFile(viewProvider: FileViewProvider): PsiFile { 45 | return NginxFile(viewProvider) 46 | } 47 | 48 | override fun spaceExistenceTypeBetweenTokens(left: ASTNode, right: ASTNode): ParserDefinition.SpaceRequirements { 49 | return ParserDefinition.SpaceRequirements.MAY 50 | } 51 | 52 | override fun createElement(node: ASTNode): PsiElement { 53 | return Types.Factory.createElement(node) 54 | } 55 | 56 | } 57 | 58 | val WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE) 59 | val COMMENTS = TokenSet.create(Types.COMMENT) 60 | val FILE = IFileElementType(NginxLanguage) 61 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/NginxSyntaxHighlighterFactory.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.openapi.fileTypes.SyntaxHighlighter 4 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory 5 | import com.intellij.openapi.project.Project 6 | import com.intellij.openapi.vfs.VirtualFile 7 | 8 | class NginxSyntaxHighlighterFactory : SyntaxHighlighterFactory() { 9 | override fun getSyntaxHighlighter(project: Project?, virtualFile: VirtualFile?): SyntaxHighlighter { 10 | return NginxSyntaxHighlighter() 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/Utils.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail 2 | 3 | import com.intellij.openapi.vfs.VirtualFile 4 | import java.io.File 5 | 6 | fun resolveFile(filepath: String, base: VirtualFile): VirtualFile? { 7 | val target = File(filepath) 8 | 9 | // First try absolute path 10 | if (target.isAbsolute) { 11 | return base.fileSystem.findFileByPath(filepath) 12 | } 13 | 14 | // Try relative to current file 15 | base.findFileByRelativePath(filepath)?.let { return it } 16 | 17 | // Try relative to nginx root directory (parent directories until we find nginx.conf) 18 | var currentDir = base 19 | while (currentDir.parent != null) { 20 | currentDir = currentDir.parent 21 | if (currentDir.findChild("nginx.conf") != null) { 22 | // Found nginx root directory, try to resolve relative to it 23 | currentDir.findFileByRelativePath(filepath)?.let { return it } 24 | break 25 | } 26 | } 27 | 28 | return null 29 | } 30 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/codeInsight/completion/NginxCompletionContributor.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.codeInsight.completion 2 | 3 | import com.intellij.codeInsight.completion.* 4 | import com.intellij.codeInsight.lookup.LookupElementBuilder 5 | import com.intellij.patterns.PlatformPatterns 6 | import com.intellij.psi.util.findParentOfType 7 | import com.intellij.util.ProcessingContext 8 | import dev.meanmail.directives.Directive 9 | import dev.meanmail.directives.findDirectives 10 | import dev.meanmail.psi.DirectiveStmt 11 | import dev.meanmail.psi.NameStmt 12 | 13 | class NginxCompletionContributor : CompletionContributor() { 14 | init { 15 | extend( 16 | CompletionType.BASIC, 17 | PlatformPatterns.psiElement().withParent(NameStmt::class.java), 18 | DirectiveNameCompletionProvider() 19 | ) 20 | 21 | } 22 | } 23 | 24 | class DirectiveNameCompletionProvider : CompletionProvider() { 25 | private val directiveCache = mutableMapOf>() 26 | 27 | override fun addCompletions( 28 | parameters: CompletionParameters, 29 | context: ProcessingContext, 30 | result: CompletionResultSet 31 | ) { 32 | val contextStmt = parameters.originalPosition 33 | ?.parent?.findParentOfType() 34 | var parent = contextStmt?.findParentOfType() 35 | if (contextStmt != null) { 36 | val name = contextStmt.name 37 | val path = parent?.path 38 | if (name != null) { 39 | val directives = findDirectives(name, path) 40 | if (directives.isNotEmpty()) { 41 | if (result.prefixMatcher.prefix == "") { 42 | parent = contextStmt 43 | } 44 | } 45 | } 46 | } 47 | val name = parent?.name 48 | 49 | val directives = directiveCache.getOrPut(name) { 50 | if (name == null || parent == null) { 51 | Directive.all 52 | } else { 53 | val directives = findDirectives(name, parent.path.subList(0, parent.path.size - 1)) 54 | if (directives.isEmpty()) { 55 | emptyList() 56 | } else { 57 | directives.flatMap { it.children } 58 | } 59 | } 60 | } 61 | 62 | for (directive in directives) { 63 | val lookupElement = LookupElementBuilder 64 | .create(directive.name) 65 | .withTypeText(directive.description) 66 | .withPresentableText(directive.name) 67 | 68 | result.addElement(lookupElement) 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/google/ngx_google_perftools_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.google 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/ngx_google_perftools_module.html 6 | 7 | val ngx_google_perftools_module = NginxModule( 8 | name = "ngx_google_perftools_module", 9 | description = "Enables Google Perftools profiling for Nginx stream module", 10 | enabled = false 11 | ) 12 | 13 | val streamGooglePerftoolsProfiles = Directive( 14 | "google_perftools_profiles", 15 | description = "Configures Google Perftools profiling for Nginx stream module", 16 | parameters = listOf( 17 | DirectiveParameter( 18 | name = "path", 19 | description = "Path to the directory for storing profiling files", 20 | valueType = ValueType.PATH, 21 | required = true, 22 | defaultValue = "/tmp/nginx_profiles" 23 | ) 24 | ), 25 | context = listOf(main), 26 | module = ngx_google_perftools_module 27 | ) 28 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/auth/ngx_http_auth_basic_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http.auth 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | import dev.meanmail.directives.nginx.http.http 8 | import dev.meanmail.directives.nginx.http.location 9 | import dev.meanmail.directives.nginx.http.server 10 | 11 | // https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html 12 | 13 | val ngx_http_auth_basic_module = NginxModule( 14 | "ngx_http_auth_basic_module", 15 | description = "HTTP basic authentication module", 16 | enabled = true 17 | ) 18 | 19 | val authBasic = Directive( 20 | name = "auth_basic", 21 | description = "Enables HTTP basic authentication and specifies the authentication realm", 22 | parameters = listOf( 23 | DirectiveParameter( 24 | name = "realm", 25 | description = "Authentication realm displayed in the browser's login prompt", 26 | valueType = ValueType.STRING, 27 | required = false, 28 | defaultValue = "Restricted" 29 | ) 30 | ), 31 | context = listOf(http, server, location), 32 | module = ngx_http_auth_basic_module 33 | ) 34 | 35 | val authBasicUserFile = Directive( 36 | name = "auth_basic_user_file", 37 | description = "Specifies the path to the file containing user credentials for basic authentication", 38 | parameters = listOf( 39 | DirectiveParameter( 40 | name = "file_path", 41 | description = "Path to the htpasswd file containing username and encrypted password", 42 | valueType = ValueType.PATH, 43 | required = true 44 | ) 45 | ), 46 | context = listOf(http, server, location), 47 | module = ngx_http_auth_basic_module 48 | ) 49 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/auth/ngx_http_auth_request_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http.auth 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | import dev.meanmail.directives.nginx.http.http 8 | import dev.meanmail.directives.nginx.http.location 9 | import dev.meanmail.directives.nginx.http.server 10 | 11 | // https://nginx.org/en/docs/http/ngx_http_auth_request_module.html 12 | 13 | val ngx_http_auth_request_module = NginxModule( 14 | "ngx_http_auth_request_module", 15 | description = "Enables external authorization request for client access", 16 | enabled = false 17 | ) 18 | 19 | val authRequest = Directive( 20 | name = "auth_request", 21 | description = "Enables external authorization request for client access", 22 | parameters = listOf( 23 | DirectiveParameter( 24 | name = "uri", 25 | description = "URI of the authorization server or location", 26 | valueType = ValueType.STRING, 27 | required = true 28 | ) 29 | ), 30 | context = listOf(http, server, location), 31 | module = ngx_http_auth_request_module 32 | ) 33 | 34 | val authRequestSet = Directive( 35 | name = "auth_request_set", 36 | description = "Sets a variable based on the authorization request response", 37 | parameters = listOf( 38 | DirectiveParameter( 39 | name = "variable", 40 | description = "Name of the variable to set", 41 | valueType = ValueType.STRING, 42 | required = true 43 | ), 44 | DirectiveParameter( 45 | name = "value", 46 | description = "Value to assign to the variable based on the authorization response", 47 | valueType = ValueType.STRING, 48 | required = true 49 | ) 50 | ), 51 | context = listOf(http, server, location), 52 | module = ngx_http_auth_request_module 53 | ) 54 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/gzip/ngx_http_gzip_static_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http.gzip 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | import dev.meanmail.directives.nginx.http.location 8 | 9 | // https://nginx.org/en/docs/http/ngx_http_gzip_static_module.html 10 | 11 | val ngx_http_gzip_static_module = NginxModule( 12 | "ngx_http_gzip_static_module", 13 | description = "Module for serving pre-compressed files with .gz extension", 14 | enabled = false 15 | ) 16 | 17 | val gzipStatic = Directive( 18 | name = "gzip_static", 19 | description = "Enables serving of pre-compressed .gz files instead of compressing files on-the-fly. Allows efficient delivery of static pre-compressed content.", 20 | context = listOf(location), 21 | module = ngx_http_gzip_static_module, 22 | parameters = listOf( 23 | DirectiveParameter( 24 | name = "mode", 25 | description = "Compression mode for static gzip files: 'on' (serve .gz if exists), 'off' (disable), 'always' (always prefer .gz file).", 26 | valueType = ValueType.STRING, 27 | required = false, 28 | allowedValues = listOf("on", "off", "always"), 29 | defaultValue = "off" 30 | ) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_access_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_access_module.html 9 | 10 | val ngx_http_access_module = NginxModule( 11 | name = "ngx_http_access_module", 12 | description = "Permits or denies access based on IP addresses or networks", 13 | enabled = true 14 | ) 15 | 16 | val allow = Directive( 17 | "allow", 18 | description = "Allows access for specified IP addresses or networks", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "address", 22 | description = "IP address, network, or special value (all, unix:)", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(http, server, location), 28 | module = ngx_http_access_module 29 | ) 30 | 31 | val deny = Directive( 32 | "deny", 33 | description = "Denies access for specified IP addresses or networks", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "address", 37 | description = "IP address, network, or special value (all, unix:)", 38 | valueType = ValueType.STRING, 39 | required = true 40 | ) 41 | ), 42 | context = listOf(http, server, location), 43 | module = ngx_http_access_module 44 | ) 45 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_addition_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_addition_module.html 9 | 10 | val ngx_http_addition_module = NginxModule( 11 | "ngx_http_addition_module", 12 | description = "Provides content addition capabilities for HTTP responses", 13 | enabled = false 14 | ) 15 | 16 | val addAfterBody = Directive( 17 | "add_after_body", 18 | description = "Adds content after the response body", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "file", 22 | description = "Path to the file to be added after the response body", 23 | valueType = ValueType.PATH, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(http, server, location), 28 | module = ngx_http_addition_module 29 | ) 30 | 31 | val addBeforeBody = Directive( 32 | "add_before_body", 33 | description = "Adds content before the response body", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "file", 37 | description = "Path to the file to be added before the response body", 38 | valueType = ValueType.PATH, 39 | required = true 40 | ) 41 | ), 42 | context = listOf(http, server, location), 43 | module = ngx_http_addition_module 44 | ) 45 | 46 | val additionTypes = Directive( 47 | "addition_types", 48 | description = "Specifies MIME types for which content addition is performed", 49 | parameters = listOf( 50 | DirectiveParameter( 51 | name = "mime_type", 52 | description = "MIME type for which content addition is applied", 53 | valueType = ValueType.STRING, 54 | required = true 55 | ) 56 | ), 57 | context = listOf(http, server, location), 58 | module = ngx_http_addition_module 59 | ) 60 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_api_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_api_module.html 9 | 10 | val ngx_http_api_module = NginxModule( 11 | "ngx_http_api_module", 12 | description = "Provides an API for accessing configuration and status information", 13 | enabled = true 14 | ) 15 | 16 | val api = Directive( 17 | "api", 18 | description = "Enables Nginx API for accessing configuration and status information", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "write", 22 | description = "Enables write access to the API", 23 | valueType = ValueType.BOOLEAN, 24 | required = false, 25 | defaultValue = "off" 26 | ) 27 | ), 28 | context = listOf(http, server, location), 29 | module = ngx_http_api_module 30 | ) 31 | 32 | val statusZone = Directive( 33 | "status_zone", 34 | description = "Defines a shared memory zone for collecting server status information", 35 | parameters = listOf( 36 | DirectiveParameter( 37 | name = "zone_name", 38 | description = "Name of the shared memory zone for status tracking", 39 | valueType = ValueType.STRING, 40 | required = true 41 | ) 42 | ), 43 | context = listOf(server), 44 | module = ngx_http_api_module 45 | ) 46 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_autoindex_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/http/ngx_http_autoindex_module.html 6 | 7 | val ngx_http_autoindex_module = NginxModule( 8 | name = "ngx_http_autoindex_module", 9 | description = "Enables or disables directory listing", 10 | enabled = true 11 | ) 12 | 13 | val autoindex = ToggleDirective( 14 | name = "autoindex", 15 | description = "Enables or disables directory listing", 16 | enabled = false, 17 | context = listOf(http, server, location), 18 | module = ngx_http_autoindex_module 19 | ) 20 | 21 | val autoindexExactSize = ToggleDirective( 22 | name = "autoindex_exact_size", 23 | description = "Controls whether file sizes are displayed in exact bytes or human-readable format", 24 | enabled = true, 25 | context = listOf(http, server, location), 26 | module = ngx_http_autoindex_module 27 | ) 28 | 29 | val autoindexFormat = Directive( 30 | name = "autoindex_format", 31 | description = "Sets the output format for directory listing", 32 | parameters = listOf( 33 | DirectiveParameter( 34 | name = "format", 35 | description = "Format of the directory listing", 36 | valueType = ValueType.ENUM, 37 | allowedValues = listOf("html", "xml", "json", "jsonp"), 38 | required = false, 39 | defaultValue = "html" 40 | ) 41 | ), 42 | context = listOf(http, server, location), 43 | module = ngx_http_autoindex_module 44 | ) 45 | 46 | val autoindexLocaltime = ToggleDirective( 47 | name = "autoindex_localtime", 48 | description = "Controls whether to display file modification times in local time or UTC", 49 | enabled = false, 50 | context = listOf(http, server, location), 51 | module = ngx_http_autoindex_module 52 | ) 53 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_browser_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_browser_module.html 9 | 10 | val ngx_http_browser_module = NginxModule( 11 | "ngx_http_browser_module", 12 | description = "Enables browser detection and classification in Nginx", 13 | enabled = true 14 | ) 15 | 16 | val ancientBrowser = Directive( 17 | name = "ancient_browser", 18 | description = "Defines browsers considered outdated or ancient", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "browser_name", 22 | description = "Name of the browser to be considered ancient", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(http, server, location), 28 | module = ngx_http_browser_module 29 | ) 30 | 31 | val ancientBrowserValue = Directive( 32 | name = "ancient_browser_value", 33 | description = "Sets the value returned for ancient browsers", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "value", 37 | description = "Value returned when an ancient browser is detected", 38 | valueType = ValueType.STRING, 39 | required = false, 40 | defaultValue = "1" 41 | ) 42 | ), 43 | context = listOf(http, server, location), 44 | module = ngx_http_browser_module 45 | ) 46 | 47 | val modernBrowser = Directive( 48 | name = "modern_browser", 49 | description = "Defines browsers considered modern or up-to-date", 50 | parameters = listOf( 51 | DirectiveParameter( 52 | name = "browser_name", 53 | description = "Name of the browser to be considered modern", 54 | valueType = ValueType.STRING, 55 | required = true 56 | ) 57 | ), 58 | context = listOf(http, server, location), 59 | module = ngx_http_browser_module 60 | ) 61 | 62 | val modernBrowserValue = Directive( 63 | name = "modern_browser_value", 64 | description = "Sets the value returned for modern browsers", 65 | parameters = listOf( 66 | DirectiveParameter( 67 | name = "value", 68 | description = "Value returned when a modern browser is detected", 69 | valueType = ValueType.STRING, 70 | required = false, 71 | defaultValue = "0" 72 | ) 73 | ), 74 | context = listOf(http, server, location), 75 | module = ngx_http_browser_module 76 | ) 77 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_dav_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/http/ngx_http_dav_module.html 6 | 7 | val ngx_http_dav_module = NginxModule( 8 | "ngx_http_dav_module", 9 | description = "The Nginx HTTP DAV module", 10 | enabled = true 11 | ) 12 | 13 | val createFullPutPath = ToggleDirective( 14 | "create_full_put_path", 15 | "Enables creation of intermediate directories during PUT requests", 16 | false, 17 | context = listOf(location), 18 | module = ngx_http_dav_module 19 | ) 20 | 21 | val davAccess = Directive( 22 | name = "dav_access", 23 | description = "Sets the access permissions for created files and directories", 24 | parameters = listOf( 25 | DirectiveParameter( 26 | name = "permissions", 27 | description = "Access permissions in user:mode format", 28 | valueType = ValueType.STRING, 29 | required = false, 30 | defaultValue = "user:rw group:r all:r" 31 | ) 32 | ), 33 | context = listOf(http, server, location), 34 | module = ngx_http_dav_module 35 | ) 36 | 37 | val davMethods = Directive( 38 | name = "dav_methods", 39 | description = "Enables WebDAV HTTP methods for the location", 40 | parameters = listOf( 41 | DirectiveParameter( 42 | name = "methods", 43 | description = "List of WebDAV methods to enable", 44 | valueType = ValueType.STRING, 45 | required = false, 46 | defaultValue = "PUT DELETE MKCOL COPY MOVE" 47 | ) 48 | ), 49 | context = listOf(location), 50 | module = ngx_http_dav_module 51 | ) 52 | 53 | val minDeleteDepth = Directive( 54 | name = "min_delete_depth", 55 | description = "Sets the minimum directory depth allowed for DELETE requests", 56 | parameters = listOf( 57 | DirectiveParameter( 58 | name = "depth", 59 | description = "Minimum directory depth for DELETE operations", 60 | valueType = ValueType.NUMBER, 61 | required = false, 62 | defaultValue = "0" 63 | ) 64 | ), 65 | context = listOf(location), 66 | module = ngx_http_dav_module 67 | ) 68 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_empty_gif_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_empty_gif_module.html 9 | 10 | val ngx_http_empty_gif_module = NginxModule( 11 | "ngx_http_empty_gif_module", 12 | description = "Provides a location that always returns a 1x1 transparent GIF image", 13 | enabled = true 14 | ) 15 | 16 | val emptyGif = Directive( 17 | name = "empty_gif", 18 | description = "Provides a location that always returns a 1x1 transparent GIF image", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "no_parameters", 22 | description = "This directive does not accept any parameters", 23 | valueType = ValueType.STRING, 24 | required = false 25 | ) 26 | ), 27 | context = listOf(location), 28 | module = ngx_http_empty_gif_module 29 | ) 30 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_f4f_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_f4f_module.html 9 | 10 | val ngx_http_f4f_module = NginxModule( 11 | "ngx_http_f4f_module", 12 | description = "Enables HTTP Dynamic Streaming (F4F) support for Adobe Flash Media Server", 13 | enabled = true 14 | ) 15 | 16 | val f4f = Directive( 17 | name = "f4f", 18 | description = "Enables HTTP Dynamic Streaming (F4F) support for Adobe Flash Media Server", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "no_parameters", 22 | description = "This directive does not accept any parameters", 23 | valueType = ValueType.STRING, 24 | required = false 25 | ) 26 | ), 27 | context = listOf(location), 28 | module = ngx_http_f4f_module 29 | ) 30 | 31 | val f4FBufferSize = Directive( 32 | name = "f4f_buffer_size", 33 | description = "Sets the buffer size for F4F (Flash) streaming", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "size", 37 | description = "Buffer size for F4F streaming operations", 38 | valueType = ValueType.SIZE, 39 | required = true 40 | ) 41 | ), 42 | context = listOf(location), 43 | module = ngx_http_f4f_module 44 | ) 45 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_flv_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.NginxModule 5 | 6 | // https://nginx.org/en/docs/http/ngx_http_flv_module.html 7 | 8 | val ngx_http_flv_module = NginxModule( 9 | "ngx_http_flv_module", 10 | description = "Enables pseudo-streaming support for Flash Video (FLV) files", 11 | enabled = true 12 | ) 13 | 14 | val flv = Directive( 15 | name = "flv", 16 | description = "Enables pseudo-streaming support for Flash Video (FLV) files, allowing clients to start playing a video from a specified time position", 17 | parameters = emptyList(), 18 | context = listOf(location), 19 | module = ngx_http_flv_module 20 | ) 21 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_geo_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_geo_module.html 9 | 10 | val ngx_http_geo_module = NginxModule( 11 | "ngx_http_geo_module", 12 | description = "Provides a way to create variables based on client IP addresses", 13 | enabled = true 14 | ) 15 | 16 | val geo = Directive( 17 | name = "geo", 18 | description = "Creates variables with values depending on the client IP address, useful for creating IP-based access controls or conditional configurations", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "address_variable", 22 | description = "Optional variable for IP address (default: \$remote_addr)", 23 | valueType = ValueType.STRING, 24 | required = false 25 | ), 26 | DirectiveParameter( 27 | name = "result_variable", 28 | description = "Variable to store geolocation result", 29 | valueType = ValueType.STRING, 30 | required = true 31 | ) 32 | ), 33 | context = listOf(http), 34 | module = ngx_http_geo_module 35 | ) 36 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_gunzip_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/http/ngx_http_gunzip_module.html 6 | 7 | val ngx_http_gunzip_module = NginxModule( 8 | "ngx_http_gunzip_module", 9 | description = "Provides support for decompressing gzipped responses for clients that do not support gzip encoding", 10 | enabled = false 11 | ) 12 | 13 | val gunzip = ToggleDirective( 14 | name = "gunzip", 15 | description = "Enables or disables decompression of gzipped responses for clients that do not support gzip encoding. When enabled, NGINX will decompress gzip-encoded responses before sending them to clients that do not support gzip compression.", 16 | context = listOf(location), 17 | module = ngx_http_gunzip_module, 18 | enabled = false 19 | ) 20 | 21 | val gunzipBuffers = Directive( 22 | name = "gunzip_buffers", 23 | description = "Configures the number and size of buffers used for decompressing gzipped responses. This directive allows fine-tuning memory allocation for gunzip operations.", 24 | context = listOf(location), 25 | module = ngx_http_gunzip_module, 26 | parameters = listOf( 27 | DirectiveParameter( 28 | name = "number", 29 | description = "Number of buffers allocated for gunzip operations. Determines how many buffers will be used during decompression.", 30 | valueType = ValueType.INTEGER, 31 | required = true 32 | ), 33 | DirectiveParameter( 34 | name = "size", 35 | description = "Size of each buffer used for decompression. Defines the memory allocation for each buffer during gunzip operations.", 36 | valueType = ValueType.SIZE, 37 | required = true 38 | ) 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_index_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_index_module.html 9 | 10 | val ngx_http_index_module = NginxModule( 11 | name = "ngx_http_index_module", 12 | description = "Processes requests ending with slash and defines index files", 13 | enabled = true 14 | ) 15 | 16 | val index = Directive( 17 | name = "index", 18 | description = "Defines files that will be used as an index when a directory is requested", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "index_files", 22 | description = "List of index files to search for, in order of priority. Can contain variables and absolute paths.", 23 | valueType = ValueType.LIST, 24 | required = true, 25 | defaultValue = "index.html" 26 | ) 27 | ), 28 | context = listOf(http, server, location), 29 | module = ngx_http_index_module 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_map_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_map_module.html 9 | 10 | val ngx_http_map_module = NginxModule( 11 | "ngx_http_map_module", 12 | description = "Creates variables whose values depend on values of other variables", 13 | enabled = true 14 | ) 15 | 16 | val map = Directive( 17 | name = "map", 18 | description = "Creates a new variable whose value depends on values of one or more source variables. " + 19 | "Supports special mapping values like 'default' (catch-all rule) and '' (empty string mapping).", 20 | parameters = listOf( 21 | DirectiveParameter( 22 | name = "source_variable", 23 | description = "Source variable to use for mapping (can be a string or regular expression)", 24 | valueType = ValueType.STRING, 25 | required = true 26 | ), 27 | DirectiveParameter( 28 | name = "result_variable", 29 | description = "Target variable to store the mapped result", 30 | valueType = ValueType.STRING, 31 | required = true 32 | ) 33 | ), 34 | context = listOf(http), 35 | module = ngx_http_map_module 36 | ) 37 | 38 | val mapHashBucketSize = Directive( 39 | name = "map_hash_bucket_size", 40 | description = "Sets the bucket size for the map variables hash tables", 41 | parameters = listOf( 42 | DirectiveParameter( 43 | name = "size", 44 | description = "Size of hash table bucket in bytes (depends on processor's cache line size)", 45 | valueType = ValueType.SIZE, 46 | required = false, 47 | defaultValue = "32|64|128" 48 | ) 49 | ), 50 | context = listOf(http), 51 | module = ngx_http_map_module 52 | ) 53 | 54 | val mapHashMaxSize = Directive( 55 | name = "map_hash_max_size", 56 | description = "Sets the maximum size of the map variables hash tables", 57 | parameters = listOf( 58 | DirectiveParameter( 59 | name = "max_size", 60 | description = "Maximum number of elements in the hash table", 61 | valueType = ValueType.NUMBER, 62 | required = false, 63 | defaultValue = "2048" 64 | ) 65 | ), 66 | context = listOf(http), 67 | module = ngx_http_map_module 68 | ) 69 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_mirror_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_mirror_module.html 9 | 10 | val ngx_http_mirror_module = NginxModule( 11 | name = "ngx_http_mirror_module", 12 | description = "Implements mirroring of an original request by creating background mirror subrequests", 13 | enabled = true 14 | ) 15 | 16 | val mirror = Directive( 17 | name = "mirror", 18 | description = "Sets the URI to which an original request will be mirrored", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "uri", 22 | description = "URI for mirroring the original request, can be 'off'", 23 | valueType = ValueType.STRING, 24 | required = true, 25 | defaultValue = "off" 26 | ) 27 | ), 28 | context = listOf(http, server, location), 29 | module = ngx_http_mirror_module 30 | ) 31 | 32 | val mirrorRequestBody = Directive( 33 | name = "mirror_request_body", 34 | description = "Controls whether the client request body is mirrored", 35 | parameters = listOf( 36 | DirectiveParameter( 37 | name = "state", 38 | description = "Enable or disable mirroring of client request body", 39 | valueType = ValueType.BOOLEAN, 40 | required = false, 41 | defaultValue = "on" 42 | ) 43 | ), 44 | context = listOf(http, server, location), 45 | module = ngx_http_mirror_module 46 | ) 47 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_perl_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_perl_module.html 9 | 10 | val ngx_http_perl_module = NginxModule( 11 | name = "ngx_http_perl_module", 12 | description = "Implements location and variable handlers in Perl and allows Perl calls in SSI", 13 | enabled = true 14 | ) 15 | 16 | val perl = Directive( 17 | name = "perl", 18 | description = "Sets a Perl handler for the given location", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "handler", 22 | description = "Perl module::function or anonymous subroutine", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(location, limitExcept), 28 | module = ngx_http_perl_module 29 | ) 30 | 31 | val perlModules = Directive( 32 | name = "perl_modules", 33 | description = "Sets an additional path for Perl modules", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "path", 37 | description = "Directory path for additional Perl modules", 38 | valueType = ValueType.STRING, 39 | required = true 40 | ) 41 | ), 42 | context = listOf(http), 43 | module = ngx_http_perl_module 44 | ) 45 | 46 | val perlRequire = Directive( 47 | name = "perl_require", 48 | description = "Defines a module to be loaded during each reconfiguration", 49 | parameters = listOf( 50 | DirectiveParameter( 51 | name = "module", 52 | description = "Name of the Perl module to require", 53 | valueType = ValueType.STRING, 54 | required = true 55 | ) 56 | ), 57 | context = listOf(http), 58 | module = ngx_http_perl_module 59 | ) 60 | 61 | val perlSet = Directive( 62 | name = "perl_set", 63 | description = "Installs a Perl handler for the specified variable", 64 | parameters = listOf( 65 | DirectiveParameter( 66 | name = "variable", 67 | description = "NGINX variable to set using Perl", 68 | valueType = ValueType.STRING, 69 | required = true 70 | ), 71 | DirectiveParameter( 72 | name = "handler", 73 | description = "Perl module::function or anonymous subroutine", 74 | valueType = ValueType.STRING, 75 | required = true 76 | ) 77 | ), 78 | context = listOf(http), 79 | module = ngx_http_perl_module 80 | ) 81 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_random_index_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.NginxModule 4 | import dev.meanmail.directives.ToggleDirective 5 | 6 | // https://nginx.org/en/docs/http/ngx_http_random_index_module.html 7 | 8 | val ngx_http_random_index_module = NginxModule( 9 | "ngx_http_random_index_module", 10 | description = "Processes requests ending with '/' and picks a random file in a directory to serve as an index file", 11 | enabled = false 12 | ) 13 | 14 | val randomIndex = ToggleDirective( 15 | name = "random_index", 16 | description = "Enables or disables processing of random index file selection in a location", 17 | context = listOf(location), 18 | module = ngx_http_random_index_module, 19 | enabled = false 20 | ) 21 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_realip_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/http/ngx_http_realip_module.html 6 | 7 | val ngx_http_realip_module = NginxModule( 8 | "ngx_http_realip_module", 9 | description = "Provides a way to obtain the client's IP address from a proxy or a load balancer", 10 | enabled = false 11 | ) 12 | 13 | val setRealIpFrom = Directive( 14 | name = "set_real_ip_from", 15 | description = "Defines a network or IP address from which the real client IP should be obtained", 16 | parameters = listOf( 17 | DirectiveParameter( 18 | name = "address", 19 | description = "IP address or CIDR range of trusted proxy or load balancer", 20 | valueType = ValueType.STRING, 21 | required = true 22 | ) 23 | ), 24 | context = listOf(http, server, location), 25 | module = ngx_http_realip_module 26 | ) 27 | 28 | val realIpHeader = Directive( 29 | name = "real_ip_header", 30 | description = "Specifies the header field used to obtain the real client IP address", 31 | parameters = listOf( 32 | DirectiveParameter( 33 | name = "header", 34 | description = "Name of the header containing the real client IP (e.g., X-Forwarded-For, X-Real-IP)", 35 | valueType = ValueType.STRING, 36 | required = true 37 | ) 38 | ), 39 | context = listOf(http, server, location), 40 | module = ngx_http_realip_module 41 | ) 42 | 43 | val realIpRecursive = ToggleDirective( 44 | name = "real_ip_recursive", 45 | description = "Enables recursive search for the real client IP when multiple proxy servers are involved", 46 | context = listOf(http, server, location), 47 | module = ngx_http_realip_module, 48 | enabled = false 49 | ) 50 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_referer_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_referer_module.html 9 | 10 | val ngx_http_referer_module = NginxModule( 11 | name = "ngx_http_referer_module", 12 | description = "Controls and validates HTTP referer headers to prevent unauthorized access", 13 | enabled = true 14 | ) 15 | 16 | val refererHashBucketSize = Directive( 17 | name = "referer_hash_bucket_size", 18 | description = "Sets the size of hash bucket for the referer hash table to optimize memory usage", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "size", 22 | description = "Size of hash bucket in bytes (default varies by system architecture)", 23 | valueType = ValueType.SIZE, 24 | required = false, 25 | defaultValue = "64" 26 | ) 27 | ), 28 | context = listOf(http), 29 | module = ngx_http_referer_module 30 | ) 31 | 32 | val refererHashMaxSize = Directive( 33 | name = "referer_hash_max_size", 34 | description = "Sets the maximum size of the referer hash table to control memory allocation", 35 | parameters = listOf( 36 | DirectiveParameter( 37 | name = "size", 38 | description = "Maximum size of the hash table in bytes", 39 | valueType = ValueType.SIZE, 40 | required = false, 41 | defaultValue = "1024" 42 | ) 43 | ), 44 | context = listOf(http), 45 | module = ngx_http_referer_module 46 | ) 47 | 48 | val validReferers = Directive( 49 | name = "valid_referers", 50 | description = "Defines a list of valid referrer sources for request validation and blocking", 51 | parameters = listOf( 52 | DirectiveParameter( 53 | name = "referers", 54 | description = "List of allowed referrer domains or patterns (none, blocked, server_names, *.example.com)", 55 | valueType = ValueType.STRING_LIST, 56 | required = false 57 | ) 58 | ), 59 | context = listOf(server, location), 60 | module = ngx_http_referer_module 61 | ) 62 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_secure_link_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_secure_link_module.html 9 | 10 | val ngx_http_secure_link_module = NginxModule( 11 | name = "ngx_http_secure_link_module", 12 | description = "Module for checking authenticity of requested links and protecting resources from unauthorized access", 13 | enabled = false 14 | ) 15 | 16 | val secureLink = Directive( 17 | name = "secure_link", 18 | description = "Defines a string with variables to extract the checksum value and lifetime of a link", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "expression", 22 | description = "Expression with variables to extract checksum and link lifetime", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(http, server, location), 28 | module = ngx_http_secure_link_module 29 | ) 30 | 31 | val secureLinkMd5 = Directive( 32 | name = "secure_link_md5", 33 | description = "Defines an expression for computing the MD5 hash value to compare with the request value", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "expression", 37 | description = "Expression containing the secured link, secret ingredient, and optional expiration time", 38 | valueType = ValueType.STRING, 39 | required = true 40 | ) 41 | ), 42 | context = listOf(http, server, location), 43 | module = ngx_http_secure_link_module 44 | ) 45 | 46 | val secureLinkSecret = Directive( 47 | name = "secure_link_secret", 48 | description = "Defines a secret word for checking the authenticity of requested links", 49 | parameters = listOf( 50 | DirectiveParameter( 51 | name = "word", 52 | description = "Secret word used to validate link authenticity", 53 | valueType = ValueType.STRING, 54 | required = true 55 | ) 56 | ), 57 | context = listOf(location), 58 | module = ngx_http_secure_link_module 59 | ) 60 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_session_log_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_session_log_module.html 9 | 10 | val ngx_http_session_log_module = NginxModule( 11 | name = "ngx_http_session_log_module", 12 | description = "The session log module for NGINX", 13 | enabled = true 14 | ) 15 | 16 | val sessionLog = Directive( 17 | name = "session_log", 18 | description = "Enables or configures session logging", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "zone", 22 | description = "Name of the shared memory zone for session logging", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ) 26 | ), 27 | context = listOf(http, server, location), 28 | module = ngx_http_session_log_module 29 | ) 30 | 31 | val sessionLogFormat = Directive( 32 | name = "session_log_format", 33 | description = "Defines a custom format for session logging", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "name", 37 | description = "Name of the log format", 38 | valueType = ValueType.STRING, 39 | required = true 40 | ), 41 | DirectiveParameter( 42 | name = "format", 43 | description = "Detailed format string for session logging", 44 | valueType = ValueType.STRING, 45 | required = true 46 | ) 47 | ), 48 | context = listOf(http), 49 | module = ngx_http_session_log_module 50 | ) 51 | 52 | val sessionLogZone = Directive( 53 | name = "session_log_zone", 54 | description = "Defines a shared memory zone for session logging", 55 | parameters = listOf( 56 | DirectiveParameter( 57 | name = "name", 58 | description = "Name of the shared memory zone", 59 | valueType = ValueType.STRING, 60 | required = true 61 | ), 62 | DirectiveParameter( 63 | name = "size", 64 | description = "Size of the shared memory zone", 65 | valueType = ValueType.SIZE, 66 | required = true 67 | ) 68 | ), 69 | context = listOf(http), 70 | module = ngx_http_session_log_module 71 | ) 72 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_slice_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_slice_module.html 9 | 10 | val ngx_http_slice_module = NginxModule( 11 | name = "ngx_http_slice_module", 12 | description = "Module for splitting responses into slices for more effective caching of big responses", 13 | enabled = false 14 | ) 15 | 16 | val slice = Directive( 17 | name = "slice", 18 | description = "Sets the size of the slice. Zero value disables splitting responses into slices", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "size", 22 | description = "Size of each slice chunk. A too low value may result in excessive memory usage and opening a large number of files", 23 | valueType = ValueType.SIZE, 24 | required = false, 25 | defaultValue = "0" 26 | ) 27 | ), 28 | context = listOf(http, server, location), 29 | module = ngx_http_slice_module 30 | ) 31 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_spdy_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_spdy_module.html 9 | // Note: This module was superseded by ngx_http_v2_module in 1.9.5 10 | 11 | val ngx_http_spdy_module = NginxModule( 12 | name = "ngx_http_spdy_module", 13 | description = "DEPRECATED: SPDY module superseded by HTTP/2 module (ngx_http_v2_module)", 14 | enabled = false 15 | ) 16 | 17 | val spdyChunkSize = Directive( 18 | name = "spdy_chunk_size", 19 | description = "Sets the size of chunks for SPDY responses (DEPRECATED)", 20 | parameters = listOf( 21 | DirectiveParameter( 22 | name = "size", 23 | description = "Size of chunks in bytes (DEPRECATED)", 24 | valueType = ValueType.SIZE, 25 | required = false, 26 | defaultValue = "8k" 27 | ) 28 | ), 29 | context = listOf(http, server), 30 | module = ngx_http_spdy_module 31 | ) 32 | 33 | val spdyHeadersComp = Directive( 34 | name = "spdy_headers_comp", 35 | description = "Sets the compression level for SPDY headers (DEPRECATED)", 36 | parameters = listOf( 37 | DirectiveParameter( 38 | name = "level", 39 | description = "Compression level (0-9) (DEPRECATED)", 40 | valueType = ValueType.NUMBER, 41 | required = false, 42 | defaultValue = "0" 43 | ) 44 | ), 45 | context = listOf(http, server), 46 | module = ngx_http_spdy_module 47 | ) 48 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_split_clients_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_split_clients_module.html 9 | 10 | val ngx_http_split_clients_module = NginxModule( 11 | name = "ngx_http_split_clients_module", 12 | description = "Module for creating variables suitable for A/B testing using client hash distribution", 13 | enabled = true 14 | ) 15 | 16 | val splitClients = Directive( 17 | name = "split_clients", 18 | description = "Creates a variable for A/B testing by hashing a given string and distributing clients into percentage-based groups", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "string", 22 | description = "Original string used for hashing (e.g., \${remote_addr}AAA) to generate distribution", 23 | valueType = ValueType.STRING, 24 | required = true 25 | ), 26 | DirectiveParameter( 27 | name = "variable", 28 | description = "Variable name to store the distribution result, which will contain the matching group value", 29 | valueType = ValueType.STRING, 30 | required = true 31 | ) 32 | ), 33 | context = listOf(http), 34 | module = ngx_http_split_clients_module 35 | ) 36 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_status_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/http/ngx_http_status_module.html 9 | 10 | val ngx_http_status_module = NginxModule( 11 | name = "ngx_http_status_module", 12 | description = """ 13 | Provides access to various status information. 14 | Formerly part of commercial subscription until version 1.13.10, 15 | partially replaced by ngx_http_api_module. 16 | 17 | Allows retrieving detailed information about NGINX server status, 18 | connections, requests, SSL handshakes, and other metrics. 19 | """.trimIndent(), 20 | enabled = true 21 | ) 22 | 23 | val status = Directive( 24 | name = "status", 25 | description = """ 26 | Enables status information access in the current location. 27 | 28 | Notes: 29 | - Access to this location should be strictly limited 30 | - Provides comprehensive server status information 31 | - Requires careful configuration to prevent unauthorized access 32 | """.trimIndent(), 33 | parameters = emptyList(), 34 | context = listOf(location), 35 | module = ngx_http_status_module 36 | ) 37 | 38 | val statusFormat = Directive( 39 | name = "status_format", 40 | description = """ 41 | Configures the output format for status information. 42 | 43 | Notes: 44 | - Default format is JSON 45 | - JSONP support allows cross-domain status retrieval 46 | - Callback parameter can contain variables 47 | """.trimIndent(), 48 | parameters = listOf( 49 | DirectiveParameter( 50 | name = "format", 51 | description = "Output format for status information", 52 | valueType = ValueType.STRING, 53 | required = true, 54 | defaultValue = "json", 55 | allowedValues = listOf("json", "jsonp") 56 | ), 57 | DirectiveParameter( 58 | name = "callback", 59 | description = """ 60 | Optional callback function name for JSONP. 61 | If omitted or empty, defaults to 'ngx_status_jsonp_callback'. 62 | Can contain variables. 63 | """.trimIndent(), 64 | valueType = ValueType.STRING, 65 | required = false 66 | ) 67 | ), 68 | context = listOf(http, server, location), 69 | module = ngx_http_status_module 70 | ) 71 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/ngx_http_stub_status_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.NginxModule 5 | 6 | // https://nginx.org/en/docs/http/ngx_http_stub_status_module.html 7 | 8 | val ngx_http_stub_status_module = NginxModule( 9 | name = "ngx_http_stub_status_module", 10 | description = """ 11 | Provides access to basic status information. 12 | 13 | Features: 14 | - Basic server status data including active connections, requests, etc. 15 | - Embedded variables support since version 1.3.14 16 | - Not built by default, requires --with-http_stub_status_module 17 | 18 | Note: Module must be explicitly enabled during NGINX compilation 19 | """.trimIndent(), 20 | enabled = true 21 | ) 22 | 23 | val stubStatus = Directive( 24 | name = "stub_status", 25 | description = """ 26 | Enables basic status information page in the surrounding location. 27 | 28 | Status information includes: 29 | - Active connections (current number including Waiting) 30 | - Total accepted/handled connections and requests 31 | - Current reading/writing/waiting connections 32 | 33 | Note: Prior to 1.7.5, required an argument (e.g., "stub_status on") 34 | """.trimIndent(), 35 | parameters = emptyList(), 36 | context = listOf(server, location), 37 | module = ngx_http_stub_status_module 38 | ) 39 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/http/upstream/ngx_http_upstream_conf_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.http.upstream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.NginxModule 5 | import dev.meanmail.directives.nginx.http.location 6 | 7 | // https://nginx.org/en/docs/http/ngx_http_upstream_conf_module.html 8 | 9 | val ngx_http_upstream_conf_module = NginxModule( 10 | name = "ngx_http_upstream_conf_module", 11 | description = """ 12 | Allows configuring upstream server groups on-the-fly via a simple HTTP interface 13 | without the need of restarting nginx. 14 | 15 | Notes: 16 | - The upstream server group must reside in the shared memory 17 | - Was part of commercial subscription until 1.13.10 18 | - Superseded by ngx_http_api_module in 1.13.3 19 | """.trimIndent(), 20 | enabled = true 21 | ) 22 | 23 | val upstreamConf = Directive( 24 | name = "upstream_conf", 25 | description = """ 26 | Turns on the HTTP interface of upstream configuration in the surrounding location. 27 | Access to this location should be limited. 28 | 29 | Features: 30 | - View group configuration 31 | - View, modify, or remove a server 32 | - Add a new server 33 | 34 | Note: Since addresses in a group are not required to be unique, specific servers 35 | in a group are referenced by their IDs. 36 | """.trimIndent(), 37 | parameters = emptyList(), 38 | context = listOf(location), 39 | module = ngx_http_upstream_conf_module 40 | ) 41 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_auth_http_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/mail/ngx_mail_auth_http_module.html 6 | 7 | val ngx_mail_auth_http_module = NginxModule( 8 | "ngx_mail_auth_http_module", 9 | description = "HTTP authentication module for mail servers", 10 | enabled = true 11 | ) 12 | 13 | val mailAuthHttp = Directive( 14 | name = "auth_http", 15 | description = "Sets the URL of the HTTP authentication server for mail authentication", 16 | parameters = listOf( 17 | DirectiveParameter( 18 | name = "url", 19 | description = "Full URL of the HTTP authentication server", 20 | valueType = ValueType.STRING, 21 | required = true 22 | ) 23 | ), 24 | context = listOf(mail, mailServer), 25 | module = ngx_mail_auth_http_module 26 | ) 27 | 28 | val mailAuthHttpHeader = Directive( 29 | name = "auth_http_header", 30 | description = "Appends a specified header to requests sent to the authentication server", 31 | parameters = listOf( 32 | DirectiveParameter( 33 | name = "header", 34 | description = "Custom header to be added to the authentication request", 35 | valueType = ValueType.STRING, 36 | required = true 37 | ), 38 | DirectiveParameter( 39 | name = "value", 40 | description = "Value of the custom header", 41 | valueType = ValueType.STRING, 42 | required = true 43 | ) 44 | ), 45 | context = listOf(mail, mailServer), 46 | module = ngx_mail_auth_http_module 47 | ) 48 | 49 | val mailAuthHttpPassClientCert = ToggleDirective( 50 | name = "auth_http_pass_client_cert", 51 | description = "Appends client SSL certificate to requests sent to the authentication server", 52 | context = listOf(mail, mailServer), 53 | enabled = false, 54 | module = ngx_mail_auth_http_module 55 | ) 56 | 57 | val mailAuthHttpTimeout = Directive( 58 | name = "auth_http_timeout", 59 | description = "Sets the timeout for communication with the authentication server", 60 | parameters = listOf( 61 | DirectiveParameter( 62 | name = "time", 63 | description = "Timeout duration for HTTP authentication requests", 64 | valueType = ValueType.TIME, 65 | required = false, 66 | defaultValue = "60s" 67 | ) 68 | ), 69 | context = listOf(mail, mailServer), 70 | module = ngx_mail_auth_http_module 71 | ) 72 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_imap_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/mail/ngx_mail_imap_module.html 9 | 10 | val ngx_mail_imap_module = NginxModule( 11 | "ngx_mail_imap_module", 12 | description = "Module for handling IMAP protocol in NGINX mail proxy", 13 | enabled = false 14 | ) 15 | 16 | val imapAuth = Directive( 17 | name = "imap_auth", 18 | description = "Sets permitted methods of authentication for IMAP clients. Supported methods are: plain (LOGIN, AUTH=PLAIN), login (AUTH=LOGIN), cram-md5 (AUTH=CRAM-MD5), and external (AUTH=EXTERNAL)", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "method", 22 | description = "Authentication method for IMAP clients", 23 | valueType = ValueType.STRING, 24 | required = true, 25 | allowedValues = listOf("plain", "login", "cram-md5", "external"), 26 | defaultValue = "plain" 27 | ) 28 | ), 29 | context = listOf(mail, mailServer), 30 | module = ngx_mail_imap_module 31 | ) 32 | 33 | val imapCapabilities = Directive( 34 | name = "imap_capabilities", 35 | description = "Sets the IMAP protocol extensions list passed to the client in response to the CAPABILITY command. Authentication methods and STARTTLS are automatically added based on configuration", 36 | parameters = listOf( 37 | DirectiveParameter( 38 | name = "extension", 39 | description = "IMAP protocol extension supported by the server", 40 | valueType = ValueType.STRING, 41 | required = true, 42 | defaultValue = "IMAP4 IMAP4rev1 UIDPLUS" 43 | ) 44 | ), 45 | context = listOf(mail, mailServer), 46 | module = ngx_mail_imap_module 47 | ) 48 | 49 | val imapClientBuffer = Directive( 50 | name = "imap_client_buffer", 51 | description = "Sets the size of the buffer used for reading IMAP commands. Default size is equal to one memory page (4K or 8K depending on platform)", 52 | parameters = listOf( 53 | DirectiveParameter( 54 | name = "size", 55 | description = "Buffer size for reading IMAP commands", 56 | valueType = ValueType.SIZE, 57 | required = false, 58 | defaultValue = "4k|8k" 59 | ) 60 | ), 61 | context = listOf(mail, mailServer), 62 | module = ngx_mail_imap_module 63 | ) 64 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_pop3_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/mail/ngx_mail_pop3_module.html 9 | 10 | val ngx_mail_pop3_module = NginxModule( 11 | "ngx_mail_pop3_module", 12 | description = "Module for handling POP3 protocol in NGINX mail proxy", 13 | enabled = false 14 | ) 15 | 16 | val pop3Auth = Directive( 17 | name = "pop3_auth", 18 | description = "Sets permitted methods of authentication for POP3 clients. Supported methods are: plain (USER/PASS, AUTH PLAIN, AUTH LOGIN), apop (APOP), cram-md5 (AUTH CRAM-MD5), and external (AUTH EXTERNAL)", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "method", 22 | description = "Authentication method for POP3 clients", 23 | valueType = ValueType.STRING, 24 | required = true, 25 | allowedValues = listOf("plain", "apop", "cram-md5", "external"), 26 | defaultValue = "plain" 27 | ) 28 | ), 29 | context = listOf(mail, mailServer), 30 | module = ngx_mail_pop3_module 31 | ) 32 | 33 | val pop3Capabilities = Directive( 34 | name = "pop3_capabilities", 35 | description = "Sets the POP3 protocol extensions list passed to the client in response to the CAPA command. Authentication methods and STLS are automatically added based on configuration", 36 | parameters = listOf( 37 | DirectiveParameter( 38 | name = "extension", 39 | description = "POP3 protocol extension supported by the server", 40 | valueType = ValueType.STRING, 41 | required = true, 42 | defaultValue = "TOP USER UIDL" 43 | ) 44 | ), 45 | context = listOf(mail, mailServer), 46 | module = ngx_mail_pop3_module 47 | ) 48 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_proxy_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.* 4 | 5 | // https://nginx.org/en/docs/mail/ngx_mail_proxy_module.html 6 | 7 | val ngx_mail_proxy_module = NginxModule( 8 | name = "ngx_mail_proxy_module", 9 | description = "Module for proxying mail protocols in NGINX mail server", 10 | enabled = false 11 | ) 12 | 13 | val proxyBuffer = Directive( 14 | name = "proxy_buffer", 15 | description = "Sets the size of the buffer used for proxying. Default size is equal to one memory page (4K or 8K depending on platform)", 16 | module = ngx_mail_proxy_module, 17 | parameters = listOf( 18 | DirectiveParameter( 19 | name = "size", 20 | description = "Buffer size for proxying", 21 | valueType = ValueType.SIZE, 22 | required = true, 23 | defaultValue = "4k|8k" 24 | ) 25 | ), 26 | context = listOf(mail, mailServer) 27 | ) 28 | 29 | val proxyPassErrorMessage = ToggleDirective( 30 | name = "proxy_pass_error_message", 31 | description = "Indicates whether to pass the error message obtained during backend authentication to the client. Default is off to prevent exposing internal error details", 32 | module = ngx_mail_proxy_module, 33 | context = listOf(mail, mailServer), 34 | enabled = false 35 | ) 36 | 37 | val proxyProtocol = ToggleDirective( 38 | name = "proxy_protocol", 39 | description = "Enables the PROXY protocol for connections to a backend. Default is off", 40 | module = ngx_mail_proxy_module, 41 | context = listOf(mail, mailServer), 42 | enabled = false 43 | ) 44 | 45 | val proxySmtpAuth = ToggleDirective( 46 | name = "proxy_smtp_auth", 47 | description = "Enables or disables user authentication on the SMTP backend using the AUTH command. Default is off", 48 | module = ngx_mail_proxy_module, 49 | context = listOf(mail, mailServer), 50 | enabled = false 51 | ) 52 | 53 | val proxyTimeout = Directive( 54 | name = "proxy_timeout", 55 | description = "Sets the timeout between two successive read or write operations on client or proxied server connections. If no data is transmitted within this time, the connection is closed", 56 | module = ngx_mail_proxy_module, 57 | parameters = listOf( 58 | DirectiveParameter( 59 | name = "timeout", 60 | description = "Connection timeout duration", 61 | valueType = ValueType.TIME, 62 | required = true, 63 | defaultValue = "24h" 64 | ) 65 | ), 66 | context = listOf(mail, mailServer) 67 | ) 68 | 69 | val xclient = ToggleDirective( 70 | name = "xclient", 71 | description = "Enables or disables the passing of the XCLIENT command with client parameters when connecting to the SMTP backend. Default is on", 72 | module = ngx_mail_proxy_module, 73 | context = listOf(mail, mailServer), 74 | enabled = true 75 | ) 76 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_realip_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/mail/ngx_mail_realip_module.html 9 | 10 | val ngx_mail_realip_module = NginxModule( 11 | "ngx_mail_realip_module", 12 | description = "Module for changing client address and port sent in the PROXY protocol header", 13 | enabled = false 14 | ) 15 | 16 | val mailSetRealIpFrom = Directive( 17 | name = "set_real_ip_from", 18 | description = "Defines trusted addresses that are known to send correct replacement addresses", 19 | module = ngx_mail_realip_module, 20 | parameters = listOf( 21 | DirectiveParameter( 22 | name = "address", 23 | description = "Trusted IP address, CIDR range, or 'unix:' for all UNIX-domain sockets", 24 | valueType = ValueType.STRING, 25 | required = true 26 | ) 27 | ), 28 | context = listOf(mail, mailServer) 29 | ) 30 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/mail/ngx_mail_smtp_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.mail 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/mail/ngx_mail_smtp_module.html 9 | 10 | val ngx_mail_smtp_module = NginxModule( 11 | name = "ngx_mail_smtp_module", 12 | description = "Module for configuring SMTP protocol support in NGINX mail proxy", 13 | enabled = false 14 | ) 15 | 16 | val smtpAuth = Directive( 17 | name = "smtp_auth", 18 | description = "Sets permitted methods of SASL authentication for SMTP clients", 19 | module = ngx_mail_smtp_module, 20 | parameters = listOf( 21 | DirectiveParameter( 22 | name = "method", 23 | description = "Authentication methods: plain, login, cram-md5, external, none", 24 | valueType = ValueType.STRING, 25 | required = true, 26 | multiple = true, 27 | allowedValues = listOf("plain", "login", "cram-md5", "external", "none"), 28 | defaultValue = "plain login" 29 | ) 30 | ), 31 | context = listOf(mail, mailServer) 32 | ) 33 | 34 | val smtpCapabilities = Directive( 35 | name = "smtp_capabilities", 36 | description = "Sets the SMTP protocol extensions list passed to the client in response to the EHLO command", 37 | module = ngx_mail_smtp_module, 38 | parameters = listOf( 39 | DirectiveParameter( 40 | name = "extension", 41 | description = "SMTP protocol extensions supported by the backend MTA", 42 | valueType = ValueType.STRING, 43 | required = true, 44 | multiple = true 45 | ) 46 | ), 47 | context = listOf(mail, mailServer) 48 | ) 49 | 50 | val smtpClientBuffer = Directive( 51 | name = "smtp_client_buffer", 52 | description = "Sets the size of the buffer used for reading SMTP commands", 53 | module = ngx_mail_smtp_module, 54 | parameters = listOf( 55 | DirectiveParameter( 56 | name = "size", 57 | description = "Buffer size for SMTP commands", 58 | valueType = ValueType.SIZE, 59 | defaultValue = "4k|8k" 60 | ) 61 | ), 62 | context = listOf(mail, mailServer) 63 | ) 64 | 65 | val smtpGreetingDelay = Directive( 66 | name = "smtp_greeting_delay", 67 | description = "Sets a delay before sending an SMTP greeting to reject premature clients", 68 | module = ngx_mail_smtp_module, 69 | parameters = listOf( 70 | DirectiveParameter( 71 | name = "time", 72 | description = "Delay time before SMTP greeting", 73 | valueType = ValueType.TIME, 74 | defaultValue = "0" 75 | ) 76 | ), 77 | context = listOf(mail, mailServer) 78 | ) 79 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_access_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_access_module.html 9 | 10 | val ngx_stream_access_module = NginxModule( 11 | name = "ngx_stream_access_module", 12 | description = "Comprehensive stream module for fine-grained access control based on client IP addresses, networks, and UNIX-domain sockets", 13 | enabled = true 14 | ) 15 | 16 | val streamAllow = Directive( 17 | name = "allow", 18 | description = "Allows access for specific IP addresses, networks, or UNIX-domain sockets", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "address", 22 | description = "IP address, network range, or UNIX-domain socket", 23 | valueType = ValueType.STRING 24 | ), 25 | DirectiveParameter( 26 | name = "type", 27 | description = "Optional type of address (CIDR notation, IPv4/IPv6)", 28 | valueType = ValueType.STRING, 29 | required = false 30 | ) 31 | ), 32 | module = ngx_stream_access_module, 33 | context = listOf(stream, streamServer) 34 | ) 35 | 36 | val streamDeny = Directive( 37 | name = "deny", 38 | description = "Denies access for specific IP addresses, networks, or UNIX-domain sockets", 39 | parameters = listOf( 40 | DirectiveParameter( 41 | name = "address", 42 | description = "IP address, network range, or UNIX-domain socket", 43 | valueType = ValueType.STRING 44 | ), 45 | DirectiveParameter( 46 | name = "type", 47 | description = "Optional type of address (CIDR notation, IPv4/IPv6)", 48 | valueType = ValueType.STRING, 49 | required = false 50 | ) 51 | ), 52 | module = ngx_stream_access_module, 53 | context = listOf(stream, streamServer) 54 | ) 55 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_geo_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_geo_module.html 9 | 10 | 11 | val ngx_stream_geo_module = NginxModule( 12 | name = "ngx_stream_geo_module", 13 | enabled = true, 14 | description = "Advanced stream module for creating dynamic geolocation variables based on client IP addresses, supporting complex routing and content delivery strategies", 15 | ) 16 | 17 | val streamGeo = Directive( 18 | name = "geo", 19 | description = "Defines a geolocation variable based on the client IP address in stream context, enabling dynamic content and routing decisions", 20 | parameters = listOf( 21 | DirectiveParameter( 22 | name = "address_variable", 23 | description = "Optional variable for IP address (default: \$remote_addr)", 24 | valueType = ValueType.STRING, 25 | required = false 26 | ), 27 | DirectiveParameter( 28 | name = "result_variable", 29 | description = "Variable to store geolocation result", 30 | valueType = ValueType.STRING 31 | ) 32 | ), 33 | module = ngx_stream_geo_module, 34 | context = listOf(stream) 35 | ) 36 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_geoip_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_geoip_module.html 9 | 10 | val ngx_stream_geoip_module = NginxModule( 11 | name = "ngx_stream_geoip_module", 12 | description = "The GeoIP module for NGINX", 13 | enabled = false 14 | ) 15 | 16 | val streamGeoipCountry = Directive( 17 | name = "geoip_country", 18 | description = "Specifies the path to the GeoIP country database", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "database_file", 22 | description = "Path to the MaxMind GeoIP database file", 23 | valueType = ValueType.PATH, 24 | required = true 25 | ) 26 | ), 27 | module = ngx_stream_geoip_module, 28 | context = listOf(stream) 29 | ) 30 | 31 | val streamGeoipCity = Directive( 32 | name = "geoip_city", 33 | description = "Specifies the path to the GeoIP city database", 34 | parameters = listOf( 35 | DirectiveParameter( 36 | name = "database_file", 37 | description = "Path to the MaxMind GeoIP database file", 38 | valueType = ValueType.PATH, 39 | required = true 40 | ) 41 | ), 42 | module = ngx_stream_geoip_module, 43 | context = listOf(stream) 44 | ) 45 | 46 | val streamGeoipOrg = Directive( 47 | name = "geoip_org", 48 | description = "Specifies the path to the GeoIP organization database", 49 | parameters = listOf( 50 | DirectiveParameter( 51 | name = "database_file", 52 | description = "Path to the MaxMind GeoIP database file", 53 | valueType = ValueType.PATH, 54 | required = true 55 | ) 56 | ), 57 | module = ngx_stream_geoip_module, 58 | context = listOf(stream) 59 | ) 60 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_pass_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_pass_module.html 9 | 10 | val ngx_stream_pass_module = NginxModule( 11 | name = "ngx_stream_pass_module", 12 | description = "Provides routing and proxying functionality for TCP/UDP stream connections to backend servers", 13 | enabled = true 14 | ) 15 | 16 | val streamPass = Directive( 17 | "pass", 18 | description = "Redirects the incoming stream connection to a specified backend server or server group", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "address", 22 | valueType = ValueType.STRING, 23 | description = "Specifies the destination server address. Can be an IP address, hostname, or upstream group name", 24 | required = true 25 | ), 26 | DirectiveParameter( 27 | name = "port", 28 | valueType = ValueType.NUMBER, 29 | description = "Optional destination server port. If not specified, uses the same port as the incoming connection", 30 | required = false 31 | ) 32 | ), 33 | context = listOf(stream, streamServer), 34 | module = ngx_stream_pass_module 35 | ) 36 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_realip_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_realip_module.html 9 | 10 | val ngx_stream_realip_module = NginxModule( 11 | name = "ngx_stream_realip_module", 12 | description = "Stream module for determining the real client IP address when using proxies or load balancers", 13 | enabled = false 14 | ) 15 | 16 | val streamSetRealIpFrom = Directive( 17 | name = "set_real_ip_from", 18 | description = "Defines trusted IP addresses or networks for determining the real client IP address in stream context", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "address", 22 | valueType = ValueType.STRING, 23 | description = "IP address, network range (CIDR), or 'unix:' to trust all UNIX-domain sockets", 24 | ) 25 | ), 26 | context = listOf(stream, streamServer), 27 | module = ngx_stream_realip_module 28 | ) 29 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_return_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_return_module.html 9 | 10 | val ngx_stream_return_module = NginxModule( 11 | name = "ngx_stream_return_module", 12 | description = "A module to return the specified value in response to a stream request", 13 | enabled = true 14 | ) 15 | 16 | val streamReturn = Directive( 17 | name = "return", 18 | description = "Sends a specified value to the client and closes the connection", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "value", 22 | valueType = ValueType.STRING, 23 | description = "Value to send to the client. Can contain text, variables, or their combination", 24 | ) 25 | ), 26 | context = listOf(streamServer), 27 | module = ngx_stream_return_module 28 | ) 29 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_set_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_set_module.html 9 | 10 | val ngx_stream_set_module = NginxModule( 11 | name = "ngx_stream_set_module", 12 | description = "Stream module for dynamically setting variables in Nginx stream processing", 13 | enabled = true 14 | ) 15 | 16 | val streamSet = Directive( 17 | name = "set", 18 | description = "Sets a value of a variable in stream context", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "variable", 22 | valueType = ValueType.STRING, 23 | description = "Name of the variable to set", 24 | ), 25 | DirectiveParameter( 26 | name = "value", 27 | valueType = ValueType.STRING, 28 | description = "Value to assign to the variable", 29 | ) 30 | ), 31 | context = listOf(stream, streamServer), 32 | module = ngx_stream_set_module 33 | ) 34 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ngx_stream_split_clients_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream 2 | 3 | import dev.meanmail.directives.Directive 4 | import dev.meanmail.directives.DirectiveParameter 5 | import dev.meanmail.directives.NginxModule 6 | import dev.meanmail.directives.ValueType 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_split_clients_module.html 9 | 10 | val ngx_stream_split_clients_module = NginxModule( 11 | name = "ngx_stream_split_clients_module", 12 | description = "Stream module for distributing client connections across multiple backend servers using percentage-based or weighted algorithms", 13 | enabled = true 14 | ) 15 | 16 | val streamSplitClients = Directive( 17 | name = "split_clients", 18 | description = "Creates a variable for A/B testing by hashing the input string and distributing clients across different groups", 19 | parameters = listOf( 20 | DirectiveParameter( 21 | name = "string", 22 | valueType = ValueType.STRING, 23 | description = "Input string to be hashed for client distribution (e.g., \${remote_addr}AAA)", 24 | ), 25 | DirectiveParameter( 26 | name = "variable", 27 | valueType = ValueType.STRING, 28 | description = "Variable to store the result of client distribution", 29 | ) 30 | ), 31 | context = listOf(stream), 32 | module = ngx_stream_split_clients_module 33 | ) 34 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/directives/nginx/stream/ssl/ngx_stream_ssl_preread_module.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.directives.nginx.stream.ssl 2 | 3 | import dev.meanmail.directives.NginxModule 4 | import dev.meanmail.directives.ToggleDirective 5 | import dev.meanmail.directives.nginx.stream.stream 6 | import dev.meanmail.directives.nginx.stream.streamServer 7 | 8 | // https://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html 9 | 10 | val ngx_stream_ssl_preread_module = NginxModule( 11 | name = "ngx_stream_ssl_preread_module", 12 | description = "Stream SSL preread module for extracting information from SSL/TLS handshake without terminating the connection", 13 | enabled = false 14 | ) 15 | 16 | val streamSslPreread = ToggleDirective( 17 | name = "ssl_preread", 18 | description = "Enables extracting information from the ClientHello message at the preread phase without terminating SSL/TLS connection", 19 | context = listOf(stream, streamServer), 20 | module = ngx_stream_ssl_preread_module, 21 | enabled = false 22 | ) 23 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/folding/NginxFoldingBuilder.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.folding 2 | 3 | import com.intellij.lang.ASTNode 4 | import com.intellij.lang.folding.FoldingBuilderEx 5 | import com.intellij.lang.folding.FoldingDescriptor 6 | import com.intellij.openapi.editor.Document 7 | import com.intellij.openapi.project.DumbAware 8 | import com.intellij.openapi.util.TextRange 9 | import com.intellij.psi.PsiElement 10 | import com.intellij.psi.util.PsiTreeUtil 11 | import dev.meanmail.psi.BlockStmt 12 | import dev.meanmail.psi.LuaBlockStmt 13 | 14 | 15 | class NginxFoldingBuilder : FoldingBuilderEx(), DumbAware { 16 | override fun buildFoldRegions( 17 | root: PsiElement, 18 | document: Document, 19 | quick: Boolean 20 | ): Array { 21 | val descriptors: MutableList = ArrayList() 22 | val blocks = PsiTreeUtil.findChildrenOfAnyType( 23 | root, 24 | BlockStmt::class.java, 25 | LuaBlockStmt::class.java 26 | ) 27 | for (block in blocks) { 28 | // Only create folding region if block has content (more than just braces) 29 | val start = block.textRange.startOffset + 1 30 | val end = block.textRange.endOffset - 1 31 | if (end > start) { 32 | descriptors.add( 33 | FoldingDescriptor( 34 | block.node, 35 | TextRange(start, end) 36 | ) 37 | ) 38 | } 39 | } 40 | return descriptors.toTypedArray() 41 | } 42 | 43 | override fun getPlaceholderText(node: ASTNode): String { 44 | return "..." 45 | } 46 | 47 | override fun isCollapsedByDefault(node: ASTNode): Boolean { 48 | return false 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/NamedElement.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | import com.intellij.psi.PsiNameIdentifierOwner 4 | 5 | interface NamedElement : PsiNameIdentifierOwner 6 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/NginxElementType.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | import com.intellij.psi.tree.IElementType 4 | import dev.meanmail.NginxLanguage 5 | import org.jetbrains.annotations.NonNls 6 | 7 | 8 | class NginxElementType(@NonNls debugName: String) : 9 | IElementType(debugName, NginxLanguage) 10 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/NginxFile.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | import com.intellij.extapi.psi.PsiFileBase 4 | import com.intellij.openapi.fileTypes.FileType 5 | import com.intellij.psi.FileViewProvider 6 | import dev.meanmail.NginxFileType 7 | import dev.meanmail.NginxLanguage 8 | 9 | 10 | class NginxFile(viewProvider: FileViewProvider) : 11 | PsiFileBase(viewProvider, NginxLanguage) { 12 | 13 | override fun getFileType(): FileType { 14 | return NginxFileType.INSTANCE 15 | } 16 | 17 | override fun toString(): String { 18 | return "Nginx configuration file" 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/NginxTokenType.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | 4 | import com.intellij.psi.tree.IElementType 5 | import dev.meanmail.NginxLanguage 6 | import org.jetbrains.annotations.NonNls 7 | 8 | class NginxTokenType(@NonNls debugName: String) : 9 | IElementType(debugName, NginxLanguage) { 10 | 11 | override fun toString(): String { 12 | return "NginxTokenType.${super.toString()}" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/PsiImplUtil.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | class PsiImplUtil 4 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/Reference.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | import com.intellij.openapi.paths.WebReference 4 | import com.intellij.openapi.util.TextRange 5 | import com.intellij.psi.PsiElement 6 | import com.intellij.psi.PsiManager 7 | import com.intellij.psi.PsiReferenceBase 8 | import dev.meanmail.resolveFile 9 | 10 | interface ReferenceElement : NamedElement { 11 | val ref: String 12 | } 13 | 14 | class Reference(element: ReferenceElement) : 15 | PsiReferenceBase(element, null, false) { 16 | override fun resolve(): PsiElement? { 17 | return resolveFile(element.ref) 18 | } 19 | 20 | private fun resolveFile(ref: String): PsiElement? { 21 | if (ref.startsWith("http://") || ref.startsWith("https://")) { 22 | return WebReference(element, ref).resolve() 23 | } 24 | if (ref.isEmpty()) return null 25 | val directory = element.containingFile 26 | ?.containingDirectory?.virtualFile ?: return null 27 | val file = resolveFile(ref, directory) ?: return null 28 | 29 | return PsiManager.getInstance(element.project).findFile(file) 30 | } 31 | 32 | override fun getRangeInElement(): TextRange { 33 | return TextRange(0, element.textLength) 34 | } 35 | 36 | override fun handleElementRename(newElementName: String): PsiElement? { 37 | val newElement = element.setName(newElementName) 38 | element.parent.node.replaceChild(element.node, newElement.node) 39 | return newElement 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/psi/WithPathElement.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.psi 2 | 3 | interface WithPathElement : NamedElement { 4 | val path: List 5 | } 6 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/structure/NginxStructureViewElement.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.structure 2 | 3 | import com.intellij.ide.projectView.PresentationData 4 | import com.intellij.ide.structureView.StructureViewTreeElement 5 | import com.intellij.ide.util.treeView.smartTree.SortableTreeElement 6 | import com.intellij.ide.util.treeView.smartTree.TreeElement 7 | import com.intellij.navigation.ItemPresentation 8 | import com.intellij.psi.NavigatablePsiElement 9 | import com.intellij.psi.util.PsiTreeUtil 10 | import dev.meanmail.psi.BlockStmt 11 | import dev.meanmail.psi.DirectiveStmt 12 | 13 | class NginxStructureViewElement(private val element: NavigatablePsiElement) : StructureViewTreeElement, 14 | SortableTreeElement { 15 | 16 | override fun getValue(): Any { 17 | return element 18 | } 19 | 20 | override fun navigate(requestFocus: Boolean) { 21 | element.navigate(requestFocus) 22 | } 23 | 24 | override fun canNavigate(): Boolean { 25 | return element.canNavigate() 26 | } 27 | 28 | override fun canNavigateToSource(): Boolean { 29 | return element.canNavigateToSource() 30 | } 31 | 32 | override fun getAlphaSortKey(): String { 33 | return element.name ?: "" 34 | } 35 | 36 | override fun getPresentation(): ItemPresentation { 37 | return element.presentation ?: object : PresentationData() { 38 | override fun getPresentableText(): String? { 39 | return element.name 40 | } 41 | } 42 | } 43 | 44 | override fun getChildren(): Array { 45 | if (element is DirectiveStmt) { 46 | var blockStmt: BlockStmt? = null 47 | val regularDirectiveStmt = element.getRegularDirectiveStmt() 48 | if (regularDirectiveStmt != null) { 49 | blockStmt = regularDirectiveStmt.getBlockStmt() 50 | } else { 51 | val locationDirectiveStmt = element.getLocationDirectiveStmt() 52 | if (locationDirectiveStmt != null) { 53 | blockStmt = locationDirectiveStmt.getBlockStmt() 54 | } else { 55 | val ifDirectiveStmt = element.getIfDirectiveStmt() 56 | if (ifDirectiveStmt != null) { 57 | blockStmt = ifDirectiveStmt.getBlockStmt() 58 | } 59 | } 60 | } 61 | if (blockStmt != null) { 62 | return blockStmt.directiveStmtList.map { NginxStructureViewElement(it as NavigatablePsiElement) } 63 | .toTypedArray() 64 | } 65 | return emptyArray() 66 | } 67 | return PsiTreeUtil.getChildrenOfAnyType( 68 | element, 69 | DirectiveStmt::class.java 70 | ) 71 | .map { NginxStructureViewElement(it as NavigatablePsiElement) } 72 | .toTypedArray() 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/structure/NginxStructureViewFactory.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.structure 2 | 3 | import com.intellij.ide.structureView.StructureViewBuilder 4 | import com.intellij.ide.structureView.StructureViewModel 5 | import com.intellij.ide.structureView.TreeBasedStructureViewBuilder 6 | import com.intellij.lang.PsiStructureViewFactory 7 | import com.intellij.openapi.editor.Editor 8 | import com.intellij.psi.PsiFile 9 | 10 | class NginxStructureViewFactory : PsiStructureViewFactory { 11 | override fun getStructureViewBuilder(psiFile: PsiFile): StructureViewBuilder { 12 | return object : TreeBasedStructureViewBuilder() { 13 | override fun createStructureViewModel(editor: Editor?): StructureViewModel { 14 | return NginxStructureViewModel(psiFile) 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/dev/meanmail/structure/NginxStructureViewModel.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.structure 2 | 3 | import com.intellij.ide.structureView.StructureViewModel 4 | import com.intellij.ide.structureView.StructureViewModelBase 5 | import com.intellij.ide.structureView.StructureViewTreeElement 6 | import com.intellij.ide.util.treeView.smartTree.Sorter 7 | import com.intellij.psi.PsiFile 8 | 9 | class NginxStructureViewModel(psiFile: PsiFile) : 10 | StructureViewModelBase(psiFile, NginxStructureViewElement(psiFile)), 11 | StructureViewModel.ElementInfoProvider { 12 | 13 | override fun getSorters(): Array { 14 | return arrayOf(Sorter.ALPHA_SORTER) 15 | } 16 | 17 | 18 | override fun isAlwaysShowsPlus(element: StructureViewTreeElement): Boolean { 19 | return false 20 | } 21 | 22 | override fun isAlwaysLeaf(element: StructureViewTreeElement): Boolean { 23 | return false 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | dev.meanmail.plugin.nginx-intellij-plugin 3 | Nginx Configuration 4 | SNAPSHOT 5 | 6 | meanmail 7 | 8 | 9 | 10 | com.intellij.modules.lang 11 | 12 | 13 | 14 | 20 | 22 | 30 | 38 | 39 | 40 | 41 | 42 | 44 | 46 | 48 | 50 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/pluginIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/pluginIcon_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/NginxDirectiveValueInspection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This inspection checks that directives in Nginx configuration files exist and are used in valid contexts. If a directive 4 | is unknown or not allowed in the current context, an error message will be displayed. The inspection also verifies if 5 | the directive can be used in its surrounding context and informs the user about the allowed contexts for each directive. 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/inspectionDescriptions/NginxGeoInspection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This inspection checks the usage of the geo directive in Nginx configuration files. It ensures that the directive is 4 | used within the correct contexts (either http or stream). Additionally, it verifies that parameters like proxy, delete, 5 | and ranges are only used within the http context, and that the default parameter is present inside the geo block. Errors 6 | are highlighted if any of these conditions are violated. 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/nginx-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meanmail-dev/nginx-intellij-plugin/d3e56500160fceeae86ee48d44de00ab88160b00/src/main/resources/nginx-dark.png -------------------------------------------------------------------------------- /src/main/resources/nginx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meanmail-dev/nginx-intellij-plugin/d3e56500160fceeae86ee48d44de00ab88160b00/src/main/resources/nginx.png -------------------------------------------------------------------------------- /src/test/kotlin/dev/meanmail/codeInsight/inspections/NginxGeoInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.codeInsight.inspections 2 | 3 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 4 | 5 | class NginxGeoInspectionTest : BasePlatformTestCase() { 6 | override fun getTestDataPath(): String { 7 | return "src/test/resources/dev/meanmail/inspections/geo" 8 | } 9 | 10 | private fun doTest(testName: String) { 11 | myFixture.enableInspections(NginxGeoInspection()) 12 | myFixture.configureByFile(testName) 13 | myFixture.checkHighlighting(true, false, true) 14 | } 15 | 16 | fun testGeoOutsideContext() { 17 | doTest("geoOutsideContext.nginx") 18 | } 19 | 20 | fun testHttpGeoWithProxy() { 21 | doTest("httpGeoWithProxy.nginx") 22 | } 23 | 24 | fun testStreamGeoWithProxy() { 25 | doTest("streamGeoWithProxy.nginx") 26 | } 27 | 28 | fun testGeoWithDelete() { 29 | doTest("geoWithDelete.nginx") 30 | } 31 | 32 | fun testStreamGeoWithDelete() { 33 | doTest("streamGeoWithDelete.nginx") 34 | } 35 | 36 | fun testGeoWithoutDefault() { 37 | doTest("geoWithoutDefault.nginx") 38 | } 39 | 40 | fun testGeoWithRangesInStream() { 41 | doTest("geoWithRangesInStream.nginx") 42 | } 43 | 44 | fun testGeoWithInclude() { 45 | doTest("geoWithInclude.nginx") 46 | } 47 | 48 | fun testGeoWithSingleVariable() { 49 | doTest("geoWithSingleVariable.nginx") 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/kotlin/dev/meanmail/codeInsight/inspections/NginxIfInspectionTest.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.codeInsight.inspections 2 | 3 | import com.intellij.testFramework.fixtures.BasePlatformTestCase 4 | 5 | class NginxIfInspectionTest : BasePlatformTestCase() { 6 | override fun getTestDataPath(): String { 7 | return "src/test/resources/dev/meanmail/inspections/if" 8 | } 9 | 10 | private fun doTest(testName: String) { 11 | myFixture.configureByFile(testName) 12 | myFixture.checkHighlighting(true, false, true) 13 | } 14 | 15 | fun testIfWithEqual() { 16 | doTest("ifWithEqual.nginx") 17 | } 18 | 19 | fun testIfWithNotEqual() { 20 | doTest("ifWithNotEqual.nginx") 21 | } 22 | 23 | fun testIfWithRegex() { 24 | doTest("ifWithRegex.nginx") 25 | } 26 | 27 | fun testIfWithFile() { 28 | doTest("ifWithFile.nginx") 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/kotlin/dev/meanmail/parsing/ParsingTest.kt: -------------------------------------------------------------------------------- 1 | package dev.meanmail.parsing 2 | 3 | import com.intellij.testFramework.ParsingTestCase 4 | import dev.meanmail.NginxParserDefinition 5 | 6 | class ParsingTest : ParsingTestCase( 7 | "testData", "nginx.conf", 8 | NginxParserDefinition() 9 | ) { 10 | fun testSample() { 11 | doTest(true) 12 | } 13 | 14 | fun testSample2() { 15 | doTest(true) 16 | } 17 | 18 | fun testLua() { 19 | doTest(true) 20 | } 21 | fun testNestedLocation() { 22 | doTest(true) 23 | } 24 | 25 | fun testUpstream() { 26 | doTest(true) 27 | } 28 | 29 | fun testLocation() { 30 | doTest(true) 31 | } 32 | 33 | fun testSSL() { 34 | doTest(true) 35 | } 36 | 37 | fun testLogging() { 38 | doTest(true) 39 | } 40 | 41 | fun testRateLimiting() { 42 | doTest(true) 43 | } 44 | 45 | fun testUpstream_1_27_3() { 46 | doTest(true) 47 | } 48 | 49 | fun testSetByLuaBlock() { 50 | doTest(true) 51 | } 52 | 53 | fun testGeoDirective() { 54 | doTest(true) 55 | } 56 | 57 | override fun getTestDataPath(): String { 58 | return "src/test/resources/" + 59 | this.javaClass.packageName.replace(".", "/") 60 | } 61 | 62 | override fun skipSpaces(): Boolean { 63 | return false 64 | } 65 | 66 | override fun includeRanges(): Boolean { 67 | return true 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoOutsideContext.nginx: -------------------------------------------------------------------------------- 1 | geo $address_variable $result_variable { 2 | default 0; 3 | 192.168.1.0/24 1; 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoWithDelete.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | geo $address_variable $result_variable { 3 | delete $arg_proxy; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoWithInclude.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | geo $address_variable $result_variable { 3 | include conf.d/geo/*.conf; 4 | default 0; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoWithRangesInStream.nginx: -------------------------------------------------------------------------------- 1 | stream { 2 | geo $address_variable $result_variable { 3 | ranges; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoWithSingleVariable.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | geo $v { 3 | default 0; 4 | 192.168.1.0/24 1; 5 | 10.0.0.0/8 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/geoWithoutDefault.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | geo $address_variable $result_variable { 3 | 192.168.1.0/24 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/httpGeoWithProxy.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | geo $address_variable $result_variable { 3 | proxy 127.0.0.1; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/streamGeoWithDelete.nginx: -------------------------------------------------------------------------------- 1 | stream { 2 | geo $address_variable $result_variable { 3 | delete $arg_proxy; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/geo/streamGeoWithProxy.nginx: -------------------------------------------------------------------------------- 1 | stream { 2 | geo $address_variable $result_variable { 3 | proxy 127.0.0.1; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/if/ifWithEqual.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | server { 3 | location / { 4 | if ($variable = 1) { 5 | return 403; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/if/ifWithFile.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | server { 3 | location / { 4 | if (-f $request_filename) { 5 | return 403; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/if/ifWithNotEqual.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | server { 3 | location / { 4 | if ($variable != 1) { 5 | return 403; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/inspections/if/ifWithRegex.nginx: -------------------------------------------------------------------------------- 1 | http { 2 | server { 3 | location / { 4 | if ($variable ~ "pattern") { 5 | return 403; 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/GeoDirective.nginx.conf: -------------------------------------------------------------------------------- 1 | http { 2 | geo $address_variable $result_variable { 3 | delete $arg_proxy; 4 | default 0; 5 | 192.168.1.0/24 1; 6 | } 7 | 8 | geo $binary_remote_addr $geo_variable { 9 | ranges; 10 | default 0; 11 | 127.0.0.0-127.255.255.255 1; 12 | 192.168.1.0-192.168.1.255 2; 13 | } 14 | 15 | geo $http_x_forwarded_for $geo_proxy { 16 | proxy 192.168.1.0/24; 17 | proxy 2001:0db8::/32; 18 | default ZZ; 19 | 127.0.0.1 US; 20 | 192.168.1.0/24 RU; 21 | 2001:0db8::/32 UK; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Location.nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name example.com; 3 | root /var/www/example.com; 4 | 5 | location = / { 6 | return 301 /home; 7 | } 8 | 9 | location / { 10 | ssi on; 11 | set $inc $request_uri; 12 | if (!-f $request_filename) { 13 | rewrite ^ /index.html last; 14 | } 15 | if (!-f $document_root$inc.html) { 16 | return 404; 17 | } 18 | } 19 | 20 | location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { 21 | expires 30d; 22 | add_header Cache-Control "public, no-transform"; 23 | } 24 | 25 | location ~ \.php$ { 26 | fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 27 | fastcgi_index index.php; 28 | include fastcgi_params; 29 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 30 | 31 | if ($request_method = 'OPTIONS') { 32 | add_header 'Access-Control-Allow-Origin' '*'; 33 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 34 | add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; 35 | add_header 'Access-Control-Max-Age' 1728000; 36 | add_header 'Content-Type' 'text/plain charset=UTF-8'; 37 | add_header 'Content-Length' 0; 38 | return 204; 39 | } 40 | } 41 | 42 | location ^~ /images/ { 43 | root /var/www/static; 44 | autoindex on; 45 | } 46 | 47 | rewrite ^/old-page$ /new-page permanent; 48 | rewrite ^/articles/([0-9]+)$ /view-article.php?id=$1 last; 49 | 50 | location = /exact { 51 | return 200; 52 | } 53 | 54 | location ^~ /images/ { 55 | root /data; 56 | } 57 | 58 | location ~* \.(gif|jpg|jpeg)$ { 59 | root /var/www/images; 60 | } 61 | 62 | location ~ /\w+\.php$ { 63 | fastcgi_pass localhost:9000; 64 | } 65 | 66 | location /api/ { 67 | proxy_pass http://backend; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Logging.nginx.conf: -------------------------------------------------------------------------------- 1 | map $request_method $loggable { 2 | default 1; 3 | ~^OPTIONS$ 0; 4 | } 5 | 6 | log_format detailed '$remote_addr - $remote_user [$time_local] ' 7 | '"$request" $status $body_bytes_sent ' 8 | '"$http_referer" "$http_user_agent" ' 9 | '$request_time $upstream_response_time'; 10 | 11 | log_format json escape=json '{' 12 | '"time_local": "$time_local", ' 13 | '"remote_addr": "$remote_addr", ' 14 | '"request": "$request", ' 15 | '"status": "$status", ' 16 | '"body_bytes_sent": "$body_bytes_sent", ' 17 | '"http_referer": "$http_referer", ' 18 | '"http_user_agent": "$http_user_agent"' 19 | '}'; 20 | 21 | server { 22 | access_log /var/log/nginx/detailed.log detailed if=$loggable; 23 | access_log /var/log/nginx/json.log json; 24 | error_log /var/log/nginx/error.log warn; 25 | 26 | location / { 27 | proxy_pass http://backend; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Lua.nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 443 ssl http2; 3 | listen [::]:443 ssl http2; 4 | server_name _; 5 | 6 | set $my_nginx_var ""; 7 | 8 | location / { 9 | access_by_lua_block { 10 | local redis = require "resty.redis" 11 | local red = redis:new() 12 | red:set_timeout(200) 13 | local ok, err = red:connect("127.0.0.1", 6379) 14 | if not ok then 15 | return 16 | end 17 | 18 | local access_num, err = red:incr("access_" .. ngx.var.remote_addr) 19 | 20 | if (not access_num or access_num >= 10) then 21 | ngx.var.my_nginx_var = "deny" 22 | return 23 | end 24 | ngx.var.my_nginx_var = "allow" 25 | red:expire("access_" .. ngx.var.remote_addr, 16*3600) 26 | } 27 | } 28 | 29 | ssl_certificate_by_lua_block { 30 | if ngx.var.my_nginx_var == "deny" then 31 | ngx.log(ngx.ERR, "access denied") 32 | return ngx.exit(ngx.HTTP_FORBIDDEN) 33 | end 34 | } 35 | 36 | set_by_lua_block { 37 | return ngx.var.my_nginx_var 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/NestedLocation.nginx.conf: -------------------------------------------------------------------------------- 1 | location /api/v1/ { 2 | proxy_pass http://rp3-forum:8080; 3 | limit_req zone=one burst=100 nodelay; 4 | limit_conn addr 20; 5 | 6 | location = /api/v1/user/subscribe { 7 | proxy_pass http://rp3-forum:8080; 8 | proxy_read_timeout 24h; 9 | proxy_http_version 1.1; 10 | proxy_set_header Connection ""; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/RateLimiting.nginx.conf: -------------------------------------------------------------------------------- 1 | limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; 2 | limit_conn_zone $binary_remote_addr zone=addr:10m; 3 | 4 | geo $allowed_country { 5 | default 0; 6 | 10.0.0.0/8 1; 7 | 192.168.0.0/16 1; 8 | 172.16.0.0/12 1; 9 | } 10 | 11 | map $allowed_country $block_country { 12 | 0 1; 13 | 1 0; 14 | } 15 | 16 | server { 17 | location / { 18 | limit_req zone=one burst=5 nodelay; 19 | limit_conn addr 10; 20 | 21 | if ($block_country = 1) { 22 | return 403; 23 | } 24 | 25 | proxy_pass http://backend; 26 | } 27 | 28 | location /admin { 29 | limit_req zone=one burst=2 nodelay; 30 | limit_conn addr 3; 31 | allow 192.168.1.0/24; 32 | deny all; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/SSL.nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 443 ssl http2; 3 | server_name secure.example.com; 4 | 5 | ssl_certificate /etc/nginx/ssl/example.com.crt; 6 | ssl_certificate_key /etc/nginx/ssl/example.com.key; 7 | 8 | ssl_protocols TLSv1.2 TLSv1.3; 9 | ssl_prefer_server_ciphers on; 10 | ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; 11 | ssl_ecdh_curve secp384r1; 12 | ssl_session_timeout 10m; 13 | ssl_session_cache shared:SSL:10m; 14 | ssl_session_tickets off; 15 | ssl_stapling on; 16 | ssl_stapling_verify on; 17 | 18 | add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; 19 | add_header X-Frame-Options DENY; 20 | add_header X-Content-Type-Options nosniff; 21 | 22 | location / { 23 | proxy_pass http://backend; 24 | proxy_set_header X-Forwarded-Proto https; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Sample.nginx.conf: -------------------------------------------------------------------------------- 1 | user nobody; # a directive in the 'main' context 2 | 3 | events { 4 | # configuration of connection processing 5 | } 6 | 7 | http { 8 | # Configuration specific to HTTP and affecting all virtual servers 9 | 10 | server { 11 | # configuration of HTTP virtual server 1 12 | location /one { 13 | # configuration for processing URIs starting with '/one' 14 | } 15 | location /two { 16 | # configuration for processing URIs starting with '/two' 17 | add_header X-Single-Quotes '\''; 18 | add_header X-Double-Quotes "\""; 19 | } 20 | } 21 | 22 | server { 23 | # configuration of HTTP virtual server 2 24 | } 25 | } 26 | 27 | stream { 28 | # Configuration specific to TCP/UDP and affecting all virtual servers 29 | server { 30 | # configuration of TCP virtual server 1 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Sample2.nginx.conf: -------------------------------------------------------------------------------- 1 | user nobody; 2 | worker_processes 1; 3 | error_log logs/error.log info; 4 | pid logs/nginx.pid; 5 | 6 | events { 7 | worker_connections 1024; 8 | multi_accept on; 9 | } 10 | 11 | http { 12 | perl_modules perl/lib; 13 | perl_require mailauth.pm; 14 | 15 | server { 16 | location /auth { 17 | perl mailauth::handler; 18 | } 19 | } 20 | } 21 | 22 | mail { 23 | auth_http 127.0.0.1:80/auth; 24 | 25 | pop3_capabilities "TOP" "USER"; 26 | imap_capabilities "IMAP4rev1" "UIDPLUS"; 27 | 28 | server { 29 | listen 110; 30 | protocol pop3; 31 | proxy on; 32 | } 33 | 34 | server { 35 | listen 143; 36 | protocol imap; 37 | proxy on; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/SetByLuaBlock.nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | # Basic variant without additional parameters 3 | set_by_lua_block $foo { 4 | ngx.var.foo = 32 5 | return ngx.var.foo 6 | } 7 | 8 | # With one numeric parameter 9 | set_by_lua_block $bar 10 { 10 | local a = tonumber(ngx.arg[1]) 11 | return a * 2 12 | } 13 | 14 | # With multiple parameters 15 | set_by_lua_block $sum 5 7 { 16 | local a, b = tonumber(ngx.arg[1]), tonumber(ngx.arg[2]) 17 | return a + b 18 | } 19 | 20 | # With different type parameters 21 | set_by_lua_block $complex "hello" 42 { 22 | local str = ngx.arg[1] 23 | local num = tonumber(ngx.arg[2]) 24 | return str .. num 25 | } 26 | 27 | location / { 28 | echo "Foo value: $foo"; 29 | echo "Bar value: $bar"; 30 | echo "Sum value: $sum"; 31 | echo "Complex value: $complex"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Upstream.nginx.conf: -------------------------------------------------------------------------------- 1 | upstream backend { 2 | server 127.0.0.1:8080; 3 | server 127.0.0.1:8081 backup; 4 | least_conn; 5 | keepalive 32; 6 | } 7 | 8 | upstream websocket { 9 | ip_hash; 10 | server 127.0.0.1:8090; 11 | server 127.0.0.1:8091; 12 | } 13 | 14 | server { 15 | location / { 16 | proxy_pass http://backend; 17 | proxy_set_header Host $host; 18 | proxy_set_header X-Real-IP $remote_addr; 19 | } 20 | 21 | location /ws { 22 | proxy_pass http://websocket; 23 | proxy_http_version 1.1; 24 | proxy_set_header Upgrade $http_upgrade; 25 | proxy_set_header Connection "upgrade"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/dev/meanmail/parsing/testData/Upstream_1_27_3.nginx.conf: -------------------------------------------------------------------------------- 1 | upstream backend { 2 | server example.com:8080 resolve; 3 | server example.org:8080; 4 | resolver 8.8.8.8 valid=30s; 5 | resolver_timeout 5s; 6 | } 7 | 8 | server { 9 | location / { 10 | proxy_pass http://backend; 11 | proxy_pass_trailers on; 12 | } 13 | } 14 | --------------------------------------------------------------------------------