Compare commits

...

3 commits

Author SHA1 Message Date
56f909d229 Add .drone-ci file
All checks were successful
continuous-integration/drone/push Build is passing
Ref #1

Add the configuration file for the CI
2023-01-05 19:04:58 +01:00
bd9bba54ba Create initial Go module
Ref #1

Create an initial Go module with a simple unit test and a makefile. This
can be tested using a CI pipeline, which will ensure that the following
commits don't break anything.
2023-01-05 18:51:53 +01:00
0e1f5f15de Write initial README file 2023-01-05 18:51:39 +01:00
7 changed files with 77 additions and 2 deletions

16
.drone.yml Normal file
View file

@ -0,0 +1,16 @@
kind: pipeline
type: docker
name: Tests
steps:
- name: test
image: golang
commands:
- cd tracker
- make build
- make test
trigger:
event:
- push
- tag

3
.gitignore vendored
View file

@ -15,6 +15,9 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# build directory
tracker/build
# Dependency directories (remove the comment below to include it)
# vendor/

View file

@ -1,3 +1,29 @@
# public-ip-tracker
# Public IP tracker
Simple Go project to track current public IP and notify changes to a telegram bot
[![Build Status](https://drone.faercol.me/api/badges/faercol/public-ip-tracker/status.svg)](https://drone.faercol.me/faercol/public-ip-tracker)
Telegram bot that detects changes to the device's public IP. This is particularily useful when
the device is handled by an ISP that does not provide a static public IP, such as a home device.
## Features
### Automatic public IP detection and monitoring
Upon startup, the current public IP is detected, and a status message is sent to a specific Telegram
channel with the relevant information.
> Insert example message here
When running as a daemon, the program automatically monitors the current public IP adress for changes.
If the IP changes for some reason, then the new updated adress is sent to the specific Telegram
channel.
> Insert example message here
### On-demand public IP
The relevant channel is monitored during the program execution. This allows the user to send a
command to the bot in order to get the current public IP on-demand.
> Insert example here

7
tracker/Makefile Normal file
View file

@ -0,0 +1,7 @@
.PHONY: build test
build:
go build -o build/
test:
go test -v ./...

3
tracker/go.mod Normal file
View file

@ -0,0 +1,3 @@
module git.faercol.me/faercol/public-ip-tracker/tracker
go 1.16

11
tracker/main.go Normal file
View file

@ -0,0 +1,11 @@
package main
import "fmt"
func testMethod(a int) int {
return a + 2
}
func main() {
fmt.Println("public ip tracker")
}

9
tracker/main_test.go Normal file
View file

@ -0,0 +1,9 @@
package main
import "testing"
func TestTestMethod(t *testing.T) {
if testMethod(12) != 14 {
t.Fatalf("Unexpected result %d", testMethod((12)))
}
}