添加codecov配置文件

This commit is contained in:
bjd 2021-02-04 15:19:51 +08:00
parent edb0fe2dc9
commit 665732fc03
3 changed files with 10 additions and 4 deletions

4
.codecov.yml Normal file
View File

@ -0,0 +1,4 @@
ignore:
- "conf"
- "down_files"
- "screenshot"

View File

@ -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 ./...

View File

@ -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