diff --git a/.gitignore b/.gitignore index f1c181e..2919a54 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ # Test binary, build with `go test -c` *.test +dist/ +dist/* # Output of the go coverage tool, specifically when used with LiteIDE -*.out +*.out \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..142fc4f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,26 @@ +env: + - GO111MODULE=on + - GOPROXY=https://gocenter.io +before: + hooks: + - go mod tidy +builds: +- env: + - CGO_ENABLED=0 +archives: +- replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/README.md b/README.md index 3f961d8..399e05e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,22 @@ # tftp-proxy A TFTP server that proxies request to an HTTP backend if a file is not found. -# How to build +# Building + go build +or for linux: + + env GOOS=linux GOARCH=amd64 go build + # How to run ./tftp-proxy -url=http://example.com -dir=/var/lib/tftpboot & + +or for linux: + + scp tftp-proxy.service tftp-proxy destination-host: + ssh destination-host + sudo mv tftp-proxy.service /etc/systemd/system/ + sudo mv tftp-proxy /usr/bin/tftp-proxy + sudo vi /etc/systemd/system/tftp-proxy.service + systemctl enable tftp-proxy \ No newline at end of file diff --git a/go.mod b/go.mod index e38e16c..e1eefbd 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module tftp-proxy require github.com/pin/tftp v2.1.0+incompatible + +go 1.13 diff --git a/tftp-proxy.service b/tftp-proxy.service new file mode 100644 index 0000000..fc904bc --- /dev/null +++ b/tftp-proxy.service @@ -0,0 +1,8 @@ +[Unit] +Description=tftp-proxy + +[Service] +ExecStart=/usr/bin/tftp-proxy -url=http://zerotouch.example.com + +[Install] +WantedBy=multi-user.target \ No newline at end of file