Skip to content

Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN

License

Notifications You must be signed in to change notification settings

afiestas/gluetun-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gluetun-Sync

Build License Version Go Report Card

Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN. Built to run seamlessly alongside Gluetun, this tool monitors port changes and triggers HTTP requests to update the relevant services or send notifications.

Features

  • Auto Monitoring: Continuously watches Gluetun for port changes.
  • Configurable Actions: HTTP requests to update services or send notifications.
  • Authenticated actions: HTTP requests are executed in series and cookies/authorization headers are carried on
  • Flexible Configuration: Support for JSON, TOML, and YAML configuration files.
  • Docker Friendly: Designed to run in a Docker container.

Installation

Go get

go get -u github.com/afiestas/gluetun-sync

Container/Docker

docker run ...

Configuration

The service can be configured using JSON, TOML, or YAML configuration files. The URL and payload fields can be configured using a Go template to include either the provided credentials or the port.

  • Username
  • Password
  • Port

Here is an example using YAML for a service that requires login

config.yml

port-file: "/tmp/portfile"
requests:
  - someservice:
      credentials:
        username: "admin"
        password: "password"
      requests:
        - method: "POST"
          url: "http://localhost:8080/api/v2/auth/login"
          payload: "username={{.Username}}&password={{.Password}}"
          content-type: "application/x-www-form-urlencoded"
        - method: "POST"
          url: "http://localhost:8080/api/v2/app/setPreferences"
          payload: "json={\"listen_port\": \"{{.Port}}\"}"
          content-type: "application/x-www-form-urlencoded"

config.toml

Example in TOML for slack webhook

[[requests]]
  [requests.slack]
    [[requests.slack.requests]]
      method = "POST"
      url = "https://hooks.slack.com/services/your/webhook/url"
      payload = "{\"text\":\"New Port: {{.Port}}\"}"
      content-type = "application/json"

If you have some configuration that you want to share please issue a PR and we'll add it to the config/ folder as an example.

Usage

A config file is required for the list of requests, the port file can easily be indicated via arguments

gluetun-sync --port-file /portfile

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published