-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GOST (GO Simple Tunnel) v2 & v3 (#1119)
* Add GOST (GO Simple Tunnel) * Update gogostv2.yaml * added gogostv3 on alpine base image * Better End Instruction for GOSTv3 * fix file extension * change restart policy for v3 * Fix with `npm run formatter-write`
- Loading branch information
Showing
4 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
captainVersion: 4 | ||
services: | ||
$$cap_appname: | ||
environment: | ||
UBUNTU_TIMEZONE: $$cap_gost_ubuntutimezone | ||
TARGET_SERVER_IP: $$cap_gost_targetip | ||
TARGET_SERVER_NONSSL_PORT: $$cap_gost_ip_nonsslport | ||
TARGET_SERVER_SSL_PORT: $$cap_gost_ip_sslport | ||
restart: on-failure | ||
caproverExtra: | ||
notExposeAsWebApp: false | ||
containerHttpPort: 80 | ||
websocketSupport: true | ||
dockerfileLines: | ||
- # Specify the base image for the app | ||
- FROM ubuntu:$$cap_gost_ubuntuversion | ||
- # Set environment variables | ||
- ARG UBUNTU_TIMEZONE | ||
- ENV TZ=${UBUNTU_TIMEZONE} | ||
- ENV DEBIAN_FRONTEND=noninteractive | ||
- # Become Superuser | ||
- USER root | ||
- # Install necessary packages and download GOST | ||
- RUN apt update && apt install -y wget | ||
- RUN wget -q https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-linux-amd64-2.11.5.gz | ||
- RUN gunzip -q gost-linux-amd64-2.11.5.gz | ||
- RUN mv gost-linux-amd64-2.11.5 /usr/local/bin/gost | ||
- RUN chmod +x /usr/local/bin/gost | ||
- # Create dynamic start.sh script | ||
- RUN echo '#!/bin/bash\nprintenv\nexec /usr/local/bin/gost -L=tcp://:80/$TARGET_SERVER_IP:$TARGET_SERVER_NONSSL_PORT -L=tcp://:443/$TARGET_SERVER_IP:$TARGET_SERVER_SSL_PORT' > /start.sh | ||
- RUN chmod +x /start.sh | ||
- # Make the entrance | ||
- ENTRYPOINT ["/bin/bash", "/start.sh"] | ||
caproverOneClickApp: | ||
variables: | ||
- id: $$cap_gost_ubuntuversion | ||
label: Ubuntu Version | ||
description: Check out https://hub.docker.com/_/ubuntu/tags for valid tags. | ||
defaultValue: 22.04 | ||
- id: $$cap_gost_ubuntutimezone | ||
label: Timezone | ||
description: Timezone for Ubuntu, find yours at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | ||
defaultValue: Asia/Tehran | ||
validRegex: /.{1,}/ | ||
- id: $$cap_gost_targetip | ||
label: The IP you want Gost to make tunnel to | ||
defaultValue: 0.0.0.0 | ||
validRegex: /^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/ | ||
- id: $$cap_gost_ip_nonsslport | ||
label: Non-SSL port of the target IP address | ||
defaultValue: 80 | ||
validRegex: /^\d+$/ | ||
- id: $$cap_gost_ip_sslport | ||
label: SSL port of the target IP address | ||
defaultValue: 443 | ||
validRegex: /^\d+$/ | ||
instructions: | ||
start: |- | ||
Make a tunnel from one server to another in 2 minutes. | ||
Note: This app will use **80** and **443** of the container | ||
end: |- | ||
GOST Tunnel has been successfully deployed! | ||
Remember to do these steps in **HTTP Settings** of the app: | ||
1. **Connect a Custom Domain** to your app and **Enable HTTPS** for it | ||
2. Redirect all domains to your newly connected domain | ||
3. **Do not** enable **Force HTTPS** | ||
4. If CapRover version is not 1.12+, check the **Websocket Support** box, otherwise it's automatically checked by the app installer | ||
displayName: GOST v2 - GO Simple Tunnel | ||
isOfficial: false | ||
description: A simple security tunnel written in Go lang | ||
documentation: Read their official docs at https://v2.gost.run/en/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
captainVersion: 4 | ||
services: | ||
$$cap_appname: | ||
restart: always | ||
ports: | ||
- $$cap_gost_api_port:$$cap_gost_api_port | ||
volumes: | ||
- $$cap_appname-data:/configuration | ||
caproverExtra: | ||
notExposeAsWebApp: false | ||
containerHttpPort: 80 | ||
websocketSupport: true | ||
dockerfileLines: | ||
- # Specify the base image for the app | ||
- FROM alpine:$$cap_gost_alpineversion | ||
- # Install necessary packages | ||
- RUN apk update && apk add --no-cache wget tar bash yq-go iptables | ||
- # Make directories needed | ||
- RUN mkdir -p tmpfiles && mkdir -p /configuration | ||
- # Download and prepare GOST binary | ||
- RUN wget -q https://github.com/go-gost/gost/releases/download/v3.0.0-nightly.20240618/gost_3.0.0-nightly.20240618_linux_amd64.tar.gz | ||
- RUN tar -xzf gost_3.0.0-nightly.20240618_linux_amd64.tar.gz -C tmpfiles && mv tmpfiles/gost /bin/gost && chmod +x /bin/gost | ||
- # Remove temp files | ||
- RUN rm -rf tmpfiles gost_3.0.0-nightly.20240618_linux_amd64.tar.gz | ||
- # Create a base GOST config file | ||
- RUN touch /configuration/gost.yaml | ||
- RUN yq eval '.api.addr = ":$$cap_gost_api_port"' -i /configuration/gost.yaml | ||
- RUN yq eval '.api.pathPrefix = "/$$cap_gost_api_path"' -i /configuration/gost.yaml | ||
- RUN yq eval '.api.accesslog = $$cap_gost_api_alog' -i /configuration/gost.yaml | ||
- RUN yq eval '.api.auth.username = "$$cap_gost_api_user"' -i /configuration/gost.yaml | ||
- RUN yq eval '.api.auth.password = "$$cap_gost_api_password"' -i /configuration/gost.yaml | ||
- # Make the entrance | ||
- RUN printf '#!/bin/bash\nexec /bin/gost -C /configuration/gost.yaml' > /start.sh | ||
- # Set the entrypoint | ||
- ENTRYPOINT ["/bin/bash", "/start.sh"] | ||
caproverOneClickApp: | ||
variables: | ||
- id: $$cap_gost_alpineversion | ||
label: Alpine Linux Version | ||
description: Check out https://hub.docker.com/_/alpine/tags for valid tags. | ||
defaultValue: 3.20.0 | ||
- id: $$cap_gost_api_path | ||
label: Custom prefix path for GOST WebAPI | ||
description: At least 3 letter all lowercase | ||
defaultValue: api | ||
validRegex: /^[a-z]{3,}$/ | ||
- id: $$cap_gost_api_alog | ||
label: Print accessing API into log | ||
description: Boolean | ||
defaultValue: true | ||
validRegex: /^(true|false)$/ | ||
- id: $$cap_gost_api_user | ||
label: Username for GOST WebAPI | ||
description: At least 4 letter all lowercase | ||
defaultValue: gostguru | ||
validRegex: /^[a-z]{4,}$/ | ||
- id: $$cap_gost_api_password | ||
label: Password for GOST WebAPI | ||
description: At least 8 char, containing uppercase & lowercase letters, digit, also a special character. **you won't be able to change it** | ||
defaultValue: $$cap_gen_random_hex(10) | ||
validRegex: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s])[ -~]{8,}$/ | ||
- id: $$cap_gost_api_port | ||
label: Port for GOST WebAPI | ||
description: Regex makes sure you won't use a commonly known ports for other services | ||
defaultValue: 18080 | ||
validRegex: /^(?!21$|22$|23$|25$|53$|67$|68$|69$|80$|110$|119$|123$|143$|389$|443$|465$|587$|993$|995$|3306$|5432$|8080$|8443$|3389$)\d{1,5}$/ | ||
instructions: | ||
start: |- | ||
Make GOST service at your exposal using its WebAPI | ||
end: |- | ||
GOST service has been successfully deployed! | ||
**API Address**: $$cap_appname.$$cap_root_domain:$$cap_gost_api_port/$$cap_gost_api_path/config | ||
**Username**: $$cap_gost_api_user | ||
**Password**: $$cap_gost_api_password | ||
You can now use either of GOST's | ||
WebUI: https://ui.gost.run | ||
GUI: https://github.com/go-gost/gostctl/releases | ||
**Important Note**: | ||
If you want to change the Mapped Port (`$$cap_gost_api_port`) you need to edit `/configuration/gost.yaml` too otherwise the WebAPI will break, also you can change other values or add GOST services into that file manually. | ||
**Post Install Instruction**: | ||
If CapRover version is not 1.12+, check the **Websocket Support** box in **HTTP Settings**, otherwise it's automatically checked by the app installer | ||
displayName: GOST v3 - GO Simple Tunnel | ||
isOfficial: false | ||
description: A simple security tunnel written in Go lang | ||
documentation: Read their official docs at https://gost.run/en/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.