mirror of https://github.com/MedzikUser/go-pingbot
update
This commit is contained in:
parent
29d326a29c
commit
a1b863984c
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
# Cache
|
# Cache
|
||||||
.cache
|
.cache
|
||||||
|
tmp/
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
*.exe
|
*.exe
|
||||||
|
|
|
@ -14,8 +14,8 @@ builds:
|
||||||
|
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w
|
- -s -w
|
||||||
- -X gitlab.com/MedzikUser/go/pingbot/config.Version={{.RawVersion}}
|
- -X github.com/medzikuser/go-pingbot/config.Version={{ .RawVersion }}
|
||||||
- -X gitlab.com/MedzikUser/go/pingbot/config.Build={{.Date}}
|
- -X github.com/medzikuser/go-pingbot/config.Build={{ .Date }}
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.xz
|
- format: tar.xz
|
||||||
|
@ -28,9 +28,9 @@ archives:
|
||||||
- start.sh
|
- start.sh
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'md5_checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
|
|
||||||
algorithm: md5
|
algorithm: sha256
|
||||||
|
|
||||||
dockers:
|
dockers:
|
||||||
- id: amd64
|
- id: amd64
|
||||||
|
@ -42,21 +42,21 @@ dockers:
|
||||||
goarm: ''
|
goarm: ''
|
||||||
|
|
||||||
image_templates:
|
image_templates:
|
||||||
- "medzik/pingbot:latest"
|
- "medzik/pingbot:latest"
|
||||||
- "medzik/pingbot:{{ .Tag }}"
|
- "medzik/pingbot:{{ .Tag }}"
|
||||||
- "medzik/pingbot:v{{ .Major }}"
|
- "medzik/pingbot:v{{ .Major }}"
|
||||||
- "medzik/pingbot:v{{ .Major }}.{{ .Minor }}"
|
- "medzik/pingbot:v{{ .Major }}.{{ .Minor }}"
|
||||||
|
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
||||||
use: docker
|
use: docker
|
||||||
|
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
- "--pull"
|
- "--pull"
|
||||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||||
|
|
||||||
extra_files:
|
extra_files:
|
||||||
- start.sh
|
- start.sh
|
||||||
|
|
|
@ -7,14 +7,14 @@ repos:
|
||||||
#
|
#
|
||||||
# Go Build
|
# Go Build
|
||||||
#
|
#
|
||||||
- id: go-build-mod
|
- id: go-build-mod
|
||||||
#
|
#
|
||||||
# Go Mod Tidy
|
# Go Mod Tidy
|
||||||
#
|
#
|
||||||
- id: go-mod-tidy
|
- id: go-mod-tidy
|
||||||
- id: go-mod-tidy-repo
|
- id: go-mod-tidy-repo
|
||||||
#
|
#
|
||||||
# Formatters
|
# Formatters
|
||||||
#
|
#
|
||||||
- id: go-fmt
|
- id: go-fmt
|
||||||
- id: go-fmt-repo
|
- id: go-fmt-repo
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -8,6 +8,7 @@ GORELEASER := goreleaser
|
||||||
BUILD_FLAGS :=
|
BUILD_FLAGS :=
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
$(GO) mod tidy
|
||||||
$(GO) build $(BUILD_FLAGS) -o $(BINARY_NAME)
|
$(GO) build $(BUILD_FLAGS) -o $(BINARY_NAME)
|
||||||
|
|
||||||
snapshot:
|
snapshot:
|
||||||
|
|
27
README.md
27
README.md
|
@ -1,14 +1,14 @@
|
||||||
# [Pingbot](https://pingbot.cf/) - Backend
|
# [Pingbot](https://pingbot.cf/) - Backend
|
||||||
|
|
||||||
[![Repo Size](https://img.shields.io/github/repo-size/MedzikUser/go-pingbot)](https://github.com/MedzikUser/go-pingbot)
|
[![Repo Size](https://img.shields.io/github/repo-size/MedzikUser/go-pingbot)](https://github.com/medzikuser/go-pingbot)
|
||||||
[![Build](https://img.shields.io/github/workflow/status/MedzikUser/go-pingbot/release/main)](https://github.com/MedzikUser/go-pingbot/actions/workflows/release.yml)
|
[![Build](https://img.shields.io/github/workflow/status/MedzikUser/go-pingbot/release/main)](https://github.com/medzikuser/go-pingbot/actions/workflows/release.yml)
|
||||||
|
|
||||||
This application "pings" websites every few minutes (to be set in config). It can be used to keep the application alive on e.g. [glitch.me](https://glitch.com/) or [repl.it](https://replit.com/).
|
This application "pings" websites every few minutes (to be set in config). It can be used to keep the application alive on e.g. [glitch.me](https://glitch.com/) or [repl.it](https://replit.com/).
|
||||||
|
|
||||||
## ⚡ Install Pre-Compile binary
|
## ⚡ Install Pre-Compile binary
|
||||||
|
|
||||||
* 💻 Linux amd64
|
* 💻 Linux amd64
|
||||||
* [Download](https://github.com/MedzikUser/go-pingbot/releases) latest version
|
* [Download](https://github.com/medzikuser/go-pingbot/releases) latest version
|
||||||
* Unpack file `tar xf pingbot_*_linux_amd64.tar.xz`
|
* Unpack file `tar xf pingbot_*_linux_amd64.tar.xz`
|
||||||
* Done your binary is `pingbot.out`
|
* Done your binary is `pingbot.out`
|
||||||
|
|
||||||
|
@ -21,10 +21,27 @@ This application "pings" websites every few minutes (to be set in config). It ca
|
||||||
|
|
||||||
### ⭐ Compile
|
### ⭐ Compile
|
||||||
|
|
||||||
* Download source code `git clone https://github.com/MedzikUser/go-pingbot.git --depth 1`
|
Method 2:
|
||||||
|
* `go install github.com/medzikuser/go-pingbot@latest`
|
||||||
|
* Output binary path
|
||||||
|
* Check GOPATH `go env GOPATH`
|
||||||
|
* Go to GOPATH and binary name is `pingbot`
|
||||||
|
|
||||||
|
Method 2:
|
||||||
|
* Download source code `git clone https://github.com/medzikuser/go-pingbot.git --depth 1`
|
||||||
* Go to folder with source code `cd go-pingbot`
|
* Go to folder with source code `cd go-pingbot`
|
||||||
* Build `make` or `go build -o pingbot.out`
|
* Build `make` or `go build -o pingbot.out`
|
||||||
* Done your compiled binary is `pingbot.out`
|
* Done your compiled binary name is `pingbot.out`
|
||||||
|
|
||||||
|
### ⭐ Cross Compile
|
||||||
|
|
||||||
|
> [Check supported OS and ARCH](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63)
|
||||||
|
|
||||||
|
* Download source code `git clone https://github.com/medzikuser/go-pingbot.git --depth 1`
|
||||||
|
* Go to folder with source code `cd go-pingbot`
|
||||||
|
* Build `make GOOS=os GOARCH=arch`
|
||||||
|
* e.g. `make GOOS=openbsd GOARCH=arm64 `
|
||||||
|
* Done your cross compiled binary name is `pingbot.out`
|
||||||
|
|
||||||
## ⚙️ Configurate
|
## ⚙️ Configurate
|
||||||
|
|
||||||
|
|
|
@ -48,16 +48,8 @@ var Toml tomlConfig
|
||||||
func init() {
|
func init() {
|
||||||
_, err := toml.DecodeFile("./config.toml", &Toml)
|
_, err := toml.DecodeFile("./config.toml", &Toml)
|
||||||
|
|
||||||
if common.CheckErr(err, "decode toml config") {
|
if err != nil {
|
||||||
if err.Error() == "open ./config.toml: no such file or directory" {
|
common.Log.Error("decode toml config: ", err)
|
||||||
err := DownloadFile("config.toml", "https://github.com/"+GH_Repo+"/raw/main/config.schema.toml")
|
|
||||||
|
|
||||||
if !common.CheckErr(err, "download default config") {
|
|
||||||
_, err = toml.DecodeFile("./config.toml", &Toml)
|
|
||||||
common.CheckErr(err, "decode toml config")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
"go.mongodb.org/mongo-driver/mongo/readpref"
|
"go.mongodb.org/mongo-driver/mongo/readpref"
|
||||||
|
|
10
go.mod
10
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module gitlab.com/MedzikUser/go/pingbot
|
module github.com/medzikuser/go-pingbot
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ require (
|
||||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
||||||
go.mongodb.org/mongo-driver v1.7.4
|
go.mongodb.org/mongo-driver v1.7.4
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
|
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa // indirect
|
||||||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
|
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 // indirect
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||||
golang.org/x/sys v0.0.0-20211031064116-611d5d643895 // indirect
|
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3 // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
|
|
16
go.sum
16
go.sum
|
@ -303,8 +303,8 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
|
@ -363,16 +363,16 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
|
||||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM=
|
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508 h1:v3NKo+t/Kc3EASxaKZ82lwK6mCf4ZeObQBduYFZHo7c=
|
||||||
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
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-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-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 h1:v79phzBz03tsVCUTbvTBmmC3CUXF5mKYt7DA4ZVldpM=
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
|
||||||
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/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-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-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
@ -423,8 +423,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211031064116-611d5d643895 h1:iaNpwpnrgL5jzWS0vCNnfa8HqzxveCFpFx3uC/X4Tps=
|
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3 h1:T6tyxxvHMj2L1R2kZg0uNMpS8ZhB9lRa9XRGTCSA65w=
|
||||||
golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
|
17
main.go
17
main.go
|
@ -10,10 +10,10 @@ import (
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"github.com/MedzikUser/go-utils/updater"
|
"github.com/MedzikUser/go-utils/updater"
|
||||||
"github.com/jpillora/opts"
|
"github.com/jpillora/opts"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/database/mongo"
|
"github.com/medzikuser/go-pingbot/database/mongo"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/ping"
|
"github.com/medzikuser/go-pingbot/ping"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/website"
|
"github.com/medzikuser/go-pingbot/website"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = common.Log
|
var log = common.Log
|
||||||
|
@ -54,7 +54,7 @@ func main() {
|
||||||
reader := bufio.NewReader((os.Stdin))
|
reader := bufio.NewReader((os.Stdin))
|
||||||
char, _, err := reader.ReadRune()
|
char, _, err := reader.ReadRune()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch char {
|
switch char {
|
||||||
|
@ -63,6 +63,7 @@ func main() {
|
||||||
err := client.Update()
|
err := client.Update()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,18 +72,22 @@ func main() {
|
||||||
err := client.Update()
|
err := client.Update()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.Warn("Canceled!")
|
log.Warn("Canceled!")
|
||||||
|
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
} else {
|
} else {
|
||||||
log.Info("You're using latest version!")
|
log.Info("You're using latest version!")
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,6 +136,7 @@ func main() {
|
||||||
|
|
||||||
if config.Toml.HTTP.Enabled {
|
if config.Toml.HTTP.Enabled {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
go website.Server()
|
go website.Server()
|
||||||
} else {
|
} else {
|
||||||
log.Warn("HTTP Server -> Disabled")
|
log.Warn("HTTP Server -> Disabled")
|
||||||
|
@ -138,6 +144,7 @@ func main() {
|
||||||
|
|
||||||
if config.Toml.Backend.Enabled {
|
if config.Toml.Backend.Enabled {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
go ping.Ticker()
|
go ping.Ticker()
|
||||||
} else {
|
} else {
|
||||||
log.Warn("Backend -> Disabled")
|
log.Warn("Backend -> Disabled")
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"systemParams": "linux-x64-102",
|
||||||
|
"modulesFolders": [],
|
||||||
|
"flags": [],
|
||||||
|
"linkedModules": [],
|
||||||
|
"topLevelPatterns": [],
|
||||||
|
"lockfileEntries": {},
|
||||||
|
"files": [],
|
||||||
|
"artifacts": {}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/database/mongo"
|
"github.com/medzikuser/go-pingbot/database/mongo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var CacheURL []string
|
var CacheURL []string
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ping() int {
|
func ping() int {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = common.Log
|
var log = common.Log
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ping
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Ticker() {
|
func Ticker() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/ping"
|
"github.com/medzikuser/go-pingbot/ping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAll(c *gin.Context) {
|
func GetAll(c *gin.Context) {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"github.com/MedzikUser/go-utils/stats"
|
"github.com/MedzikUser/go-utils/stats"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/ping"
|
"github.com/medzikuser/go-pingbot/ping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Status(c *gin.Context) {
|
func Status(c *gin.Context) {
|
||||||
|
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"github.com/MedzikUser/go-utils/common"
|
"github.com/MedzikUser/go-utils/common"
|
||||||
"github.com/gin-contrib/cors"
|
"github.com/gin-contrib/cors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/config"
|
"github.com/medzikuser/go-pingbot/config"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/website/routes"
|
"github.com/medzikuser/go-pingbot/website/routes"
|
||||||
"gitlab.com/MedzikUser/go/pingbot/website/routes/api"
|
"github.com/medzikuser/go-pingbot/website/routes/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
var router *gin.Engine
|
var router *gin.Engine
|
||||||
|
|
Loading…
Reference in New Issue