Compare commits

...

3 Commits

Author SHA1 Message Date
Medzik f9a954fbd3 feat: add UserAgent 2021-10-15 19:15:29 +00:00
Medzik d906c0d3b4 update workflows 2021-10-15 17:00:54 +00:00
Medzik 6629a3e1cc chore(deps): upgrade golang.org/x/oauth2 2021-10-15 16:56:04 +00:00
6 changed files with 17 additions and 7 deletions

View File

@ -13,7 +13,7 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout v1
- name: Repo clone (go mod tidy / gofmt)
if: github.event_name != 'pull_request'
uses: actions/checkout@v2
with:
@ -61,10 +61,10 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout v2
- name: Repo clone (build)
uses: actions/checkout@v2
with:
fetch-depth: '0'
fetch-depth: 0
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2

View File

@ -1,6 +1,11 @@
package config
import "time"
import (
"fmt"
"runtime"
"strings"
"time"
)
const GH_Repo = "MedzikUser/go-pingbot"
@ -8,4 +13,5 @@ var (
Version = "dev"
Build = ""
StartTime time.Time
UserAgent = fmt.Sprintf("PingBot/%s go/%s", Version, strings.Replace(runtime.Version(), "go", "", 1))
)

2
go.mod
View File

@ -28,7 +28,7 @@ require (
go.mongodb.org/mongo-driver v1.7.3
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e // indirect
golang.org/x/text v0.3.7 // indirect

4
go.sum
View File

@ -371,8 +371,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw=
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4TupZy7bf4sxFZnN2ZOcvUE=
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@ -24,6 +24,7 @@ type cmdOpts struct {
func main() {
log.Info("You're using verion: ", config.Version)
log.Info(config.UserAgent)
var wg sync.WaitGroup

View File

@ -6,6 +6,7 @@ import (
"time"
"github.com/MedzikUser/go-utils/common"
"gitlab.com/gaming0skar123/go/pingbot/config"
)
func ping() int {
@ -30,6 +31,8 @@ func loop(url string) {
return
}
req.Header.Set("User-Agent", config.UserAgent)
client := http.DefaultClient
r, err := client.Do(req)
if err != nil {