Version added / sha256sums added

This commit is contained in:
Jesko Anschütz 2025-10-20 14:33:53 +02:00
parent 158a7efb72
commit 7819727a58
9 changed files with 26 additions and 2 deletions

BIN
az-dns Executable file

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
0f0f273907c5e5c8f6dccdc2fb078c84feb85bece36a0219e1c77a61c742da18 binaries/az-dns_arm64

Binary file not shown.

View file

@ -0,0 +1 @@
d2d2fd99f1e06d2f3328cda7642dec6451691689731f08a88c361b1ea34f4dc2 binaries/az-dns_linux_amd64

Binary file not shown.

View file

@ -0,0 +1 @@
0df7054ec2be650a275972e6df27b260a346a4fd84a6aff971897a00abd1ff72 binaries/az-dns_windows_amd64

View file

@ -1,4 +1,10 @@
#!/bin/bash #!/bin/bash
go build -o binaries/az-dns_arm64 go build -o binaries/az-dns_arm64
sha256sum binaries/az-dns_arm64 > binaries/az-dns_arm64.sha256
GOOS=linux GOARCH=amd64 go build -o binaries/az-dns_linux_amd64 GOOS=linux GOARCH=amd64 go build -o binaries/az-dns_linux_amd64
GOOS=windows GOARCH=amd64 go build -o binaries/az-dns_windows_amd64 sha256sum binaries/az-dns_linux_amd64 > binaries/az-dns_linux_amd64.sha256
GOOS=windows GOARCH=amd64 go build -o binaries/az-dns_windows_amd64
sha256sum binaries/az-dns_windows_amd64 > binaries/az-dns_windows_amd64.sha256

17
main.go
View file

@ -21,6 +21,7 @@ const (
hetznerAPIBase = "https://api.hetzner.cloud/v1" hetznerAPIBase = "https://api.hetzner.cloud/v1"
ipv4DiscoverURL = "https://api.ipify.org" ipv4DiscoverURL = "https://api.ipify.org"
ipv6DiscoverURL = "https://api6.ipify.org" ipv6DiscoverURL = "https://api6.ipify.org"
version = "1.0.0"
) )
type logLevel int type logLevel int
@ -68,9 +69,13 @@ type rrsetsResponse struct {
} }
func main() { func main() {
if showHelp(os.Args[1:]) { switch {
case showHelp(os.Args[1:]):
printHelp() printHelp()
return return
case showVersion(os.Args[1:]):
fmt.Println(version)
return
} }
cfg, err := loadConfig() cfg, err := loadConfig()
@ -551,6 +556,15 @@ func showHelp(args []string) bool {
return false return false
} }
func showVersion(args []string) bool {
for _, a := range args {
if a == "-v" || a == "--version" {
return true
}
}
return false
}
func printHelp() { func printHelp() {
fmt.Println(`Usage: az-dns [options] fmt.Println(`Usage: az-dns [options]
@ -566,5 +580,6 @@ Optionale Environment-Variablen:
Optionen: Optionen:
-h, --help Diese Hilfe anzeigen -h, --help Diese Hilfe anzeigen
-v, --version Version ausgeben
`) `)
} }