- Fork and clone the repository
- Create a new branch
git checkout -b my-branch-name
- Modify the code
- Commit your modifications
- Push to your fork and submit a pull request
Additional resources:
That should be easier and better than a local setup, although it might use more memory if you're not on Linux.
- Install Docker
- On Windows, share a drive with Docker Desktop and have the project on that partition
- On OSX, share your project directory with Docker Desktop
- With Visual Studio Code, install the remote containers extension
- In Visual Studio Code, press on
F1
and selectRemote-Containers: Open Folder in Container...
- Your dev environment is ready to go!... and it's running in a container 👍
Install Go, Docker and Git; then:
go mod download
And finally install golangci-lint.
You might want to use an editor such as Visual Studio Code with the Go extension.
- Test the code:
go test ./...
- Lint the code
golangci-lint run
- Build the program:
go build -o app cmd/updater/main.go
- Build the Docker image (tests and lint included):
docker build -t qmcgaw/ddns-updater .
- Run the Docker container:
docker run -it --rm -v /yourpath/data:/updater/data qmcgaw/ddns-updater
An "example" DNS provider is present in the code, you can simply copy paste it modify it to your needs. In more detailed steps:
-
Copy the directory
internal/provider/providers/example
tointernal/provider/providers/yourprovider
whereyourprovider
is the name of the DNS provider you want to add, in a single word without spaces, dashes or underscores. -
Modify the
internal/provider/providers/yourprovider/provider.go
file to fit the requirements of your DNS provider. There are many// TODO
comments you can follow and need to remove when done. -
Add the provider name constant to the
ProviderChoices
function ininternal/provider/constants/providers.go
. For example:func ProviderChoices() []models.Provider { return []models.Provider{ // ... Example, // ... } }
-
Add a case for your provider in the
switch
statement in theNew
function ininternal/provider/provider.go
. For example:case constants.Example: return example.New(data, domain, host, ipVersion, ipv6Suffix)
-
Copy the file
docs/example.md
todocs/yourprovider.md
and modify it to fit the configuration and domain setup of your DNS provider. There are a few<!-- ... -->
comments indicating what to change, please remove them when done. -
In the README.md:
- Add your provider name to the list of providers supported
- Your provider
- Add your provider name and link to its document to the second list:
- [Your provider](docs/yourprovider.md)
- Add your provider name to the list of providers supported
-
Make sure to run the actual program (in Docker or directly) and check it updates your DNS records as expected, of course 😉 You can do this by setting a record to
127.0.0.1
manually and then run the updater to see if the update succeeds. -
Profit 🎉 Don't forget to open a pull request
Contributions are released to the public under the open source license of this project.