From 665732fc03b8030a9e9f438ab26e7885546865c0 Mon Sep 17 00:00:00 2001 From: bjd Date: Thu, 4 Feb 2021 15:19:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0codecov=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .codecov.yml | 4 ++++ .github/workflows/go.yml | 4 +++- handler/link_auth.go | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..ccbc73d --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,4 @@ +ignore: + - "conf" + - "down_files" + - "screenshot" \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 18248b1..e19ca82 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,7 +27,9 @@ jobs: go get -v -t -d ./... - name: Build - run: go build -v . + run: | + go build -v -o anylink -ldflags "-X main.COMMIT_ID=`git rev-parse HEAD`" + ./anylink -rev - name: Test coverage run: go test -race -coverprofile=coverage.txt -covermode=atomic -v ./... diff --git a/handler/link_auth.go b/handler/link_auth.go index 6701995..fecf78f 100644 --- a/handler/link_auth.go +++ b/handler/link_auth.go @@ -17,10 +17,10 @@ import ( func LinkAuth(w http.ResponseWriter, r *http.Request) { // 判断anyconnect客户端 userAgent := strings.ToLower(r.UserAgent()) - x_Aggregate_Auth := r.Header.Get("X-Aggregate-Auth") - x_Transcend_Version := r.Header.Get("X-Transcend-Version") + xAggregateAuth := r.Header.Get("X-Aggregate-Auth") + xTranscendVersion := r.Header.Get("X-Transcend-Version") if !(strings.Contains(userAgent, "anyconnect") && - x_Aggregate_Auth == "1" && x_Transcend_Version == "1") { + xAggregateAuth == "1" && xTranscendVersion == "1") { w.WriteHeader(http.StatusForbidden) fmt.Fprintf(w, "error request") return