diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb695d3..c45a27d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ name: Build -on: [push] +on: [push, pull_request] jobs: build: @@ -10,17 +10,28 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Get Go version run: | echo "GO_VERSION=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | grep $(grep -P "go \d+\." go.mod | cut -d " " -f2) | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')" >> $GITHUB_ENV + - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION}} + - name: Test run: go test -v . + - name: Build - run: go build -v . + uses: goreleaser/goreleaser-action@v2 + if: "!startsWith(github.ref, 'refs/tags/')" + with: + version: latest + args: build --snapshot --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 84012f3..18a5821 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ on: env: DOCKERHUB_REPO: nadoo/glider GHCR_REPO: ghcr.io/nadoo/glider - PLATFORMS: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 + PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 jobs: publish: diff --git a/.goreleaser.yml b/.goreleaser.yml index d5c1c5e..dd1aeda 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,30 +1,11 @@ -# Make sure to check the documentation at http://goreleaser.com - -# release: -# git tag -a v0.1.0 -m "v0.1.0" -# git push origin v0.1.0 -# goreleaser release --skip-publish --rm-dist - -# #git tag -d v0.1.0 -# #git push origin --delete tag v0.1.0 - -# snapshot: -# goreleaser --snapshot --rm-dist - -# https://goreleaser.com/customization/ - before: hooks: - go mod tidy -# https://goreleaser.com/customization/build/ builds: - id: default env: - CGO_ENABLED=0 - # GOOS list to build for. - # For more info refer to: https://go.dev/doc/install/source#environment - # Defaults are darwin and linux. goos: - windows - linux @@ -47,7 +28,6 @@ builds: - hardfloat - softfloat -# https://goreleaser.com/customization/archive/ archives: - id: default builds: @@ -66,23 +46,18 @@ archives: - config/**/* - systemd/* -# https://goreleaser.com/customization/snapshots/ snapshot: name_template: '{{ incpatch .Version }}-dev' -# https://goreleaser.com/customization/checksum/ checksum: name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" -# https://goreleaser.com/customization/release/ release: prerelease: true draft: true -# https://goreleaser.com/customization/nfpm/ nfpms: - - - id: glider + - id: glider package_name: glider vendor: nadoo homepage: https://github.com/nadoo/glider diff --git a/README.md b/README.md index e2e92ac..1a70a8d 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ glider -h click to see details ```bash -glider 0.15.3 usage: +glider 0.16.0 usage: -check string check=tcp[://HOST:PORT]: tcp port connect check check=http://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE] @@ -132,6 +132,8 @@ glider 0.15.3 usage: maximum TTL value for entries in the CACHE(seconds) (default 1800) -dnsminttl int minimum TTL value for entries in the CACHE(seconds) + -dnsnoaaaa + disable AAAA query -dnsrecord value custom dns record, format: domain/ip -dnsserver value diff --git a/config/glider.conf.example b/config/glider.conf.example index bf3e9df..a17aeed 100644 --- a/config/glider.conf.example +++ b/config/glider.conf.example @@ -242,6 +242,9 @@ dnscachesize=4096 # show query log of dns cache dnscachelog=True +# disable AAAA queries +# dnsnoaaaa=True + # custom records dnsrecord=www.example.com/1.2.3.4 dnsrecord=www.example.com/2606:2800:220:1:248:1893:25c8:1946 diff --git a/config/rules.d/office.rule.example b/config/rules.d/office.rule.example index 4078060..16c59c1 100644 --- a/config/rules.d/office.rule.example +++ b/config/rules.d/office.rule.example @@ -26,6 +26,7 @@ dnsserver=208.67.222.222:53 # - add ip/cidrs in rule files on startup # - add resolved ips for domains in rule files by dns forwarding server # Usually used in transparent proxy mode on linux +# Note: this will create 2 ipsets, glider for ipv4 and glider6 for ipv6 ipset=glider # DESTINATIONS diff --git a/main.go b/main.go index a7086b1..e3d55cb 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( ) var ( - version = "0.15.3" + version = "0.16.0" config = parseConfig() ) diff --git a/rule/config.go b/rule/config.go index bc7c1c4..8eda6c3 100644 --- a/rule/config.go +++ b/rule/config.go @@ -54,7 +54,7 @@ func NewConfFromFile(ruleFile string) (*Config, error) { f.StringVar(&p.Strategy.IntFace, "interface", "", "source ip or source interface") f.StringSliceUniqVar(&p.DNSServers, "dnsserver", nil, "remote dns server") - f.StringVar(&p.IPSet, "ipset", "", "ipset name") + f.StringVar(&p.IPSet, "ipset", "", "ipset NAME, will create 2 sets: NAME for ipv4 and NAME6 for ipv6") f.StringSliceUniqVar(&p.Domain, "domain", nil, "domain") f.StringSliceUniqVar(&p.IP, "ip", nil, "ip")