TCP service fix for services that are not using TLS (different packages)

pull/604/head v0.90.42
hunterlong 2020-05-20 19:53:09 -07:00
parent 21b037ab8c
commit a8bae268ea
8 changed files with 72 additions and 174 deletions

View File

@ -298,7 +298,7 @@ jobs:
timeoutRequest: 15000
delayRequest: 500
build-linux:
build-binaries:
needs: compile
runs-on: ubuntu-latest
steps:
@ -307,6 +307,30 @@ jobs:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Install cross compiling libraries
run: |
sudo apt-get update
sudo apt-get install -y automake autogen build-essential ca-certificates libsqlite3-dev \
gcc-5-arm-linux-gnueabi g++-5-arm-linux-gnueabi libc6-dev-armel-cross linux-headers-generic \
gcc-5-arm-linux-gnueabihf g++-5-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-5-mips-linux-gnu g++-5-mips-linux-gnu libc6-dev-mips-cross \
gcc-5-mipsel-linux-gnu g++-5-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-5-mips64-linux-gnuabi64 g++-5-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-5-mips64el-linux-gnuabi64 g++-5-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-5-multilib g++-5-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
gcc-6-arm-linux-gnueabi g++-6-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-6-arm-linux-gnueabihf g++-6-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-6-aarch64-linux-gnu g++-6-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-6-mips-linux-gnu g++-6-mips-linux-gnu libc6-dev-mips-cross \
gcc-6-mipsel-linux-gnu g++-6-mipsel-linux-gnu libc6-dev-mipsel-cross \
gcc-6-mips64-linux-gnuabi64 g++-6-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
gcc-6-mips64el-linux-gnuabi64 g++-6-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \
gcc-6-multilib gcc-7-multilib g++-6-multilib gcc-mingw-w64 g++-mingw-w64 clang llvm-dev \
libtool libxml2-dev uuid-dev libssl-dev swig openjdk-8-jdk pkg-config patch \
make xz-utils cpio wget zip unzip p7zip git mercurial bzr texinfo help2man cmake --no-install-recommends
sudo ln -s /usr/include/asm-generic/ /usr/include/asm
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
@ -324,134 +348,20 @@ jobs:
name: static-rice-box
path: ./source
- name: Build Linux XGO
uses: crazy-max/ghaction-xgo@v1
with:
xgo_version: latest
go_version: 1.14.2
dest: build
prefix: statping
pkg: cmd
targets: linux/386,linux/amd64
v: true
x: false
buildmode: default
ldflags: -s -w -X main.VERSION=$VERSION
- name: Build Linux ARM XGO
uses: crazy-max/ghaction-xgo@v1
with:
xgo_version: latest
go_version: 1.14.2
dest: build
prefix: statping
pkg: cmd
targets: linux/arm-7,linux/arm64
v: true
x: false
buildmode: default
ldflags: -s -w -extldflags -static -X main.VERSION=$VERSION
- name: Build Binaries
env:
VERSION: ${{ env.VERSION }}
COMMIT: $GITHUB_SHA
run: make build-folders build-linux build-linux-arm build-darwin build-win compress-folders
- name: Upload Builds
uses: actions/upload-artifact@v1
with:
name: builds-linux
path: ./build
build-windows:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Go mods
run: |
make test-deps
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Build Windows XGO
uses: crazy-max/ghaction-xgo@v1
with:
xgo_version: latest
go_version: 1.14.2
dest: build
prefix: statping
pkg: cmd
targets: windows-6.0/386,windows-6.0/amd64
v: true
x: false
buildmode: default
ldflags: -s -w -X main.VERSION=$VERSION
- name: Upload Builds
uses: actions/upload-artifact@v1
with:
name: builds-windows
path: ./build
build-mac:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Setting ENV's
run: |
echo "::add-path::$(go env GOPATH)/bin"
echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin"
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Go mods
run: |
make test-deps
- name: Download Compiled Frontend (rice-box.go)
uses: actions/download-artifact@v1
with:
name: static-rice-box
path: ./source
- name: Build MacOSX XGO
uses: crazy-max/ghaction-xgo@v1
with:
xgo_version: latest
go_version: 1.14.2
dest: build
prefix: statping
pkg: cmd
targets: darwin/386,darwin/amd64
v: true
x: false
buildmode: default
ldflags: -s -w -X main.VERSION=$VERSION
- name: Upload Builds
uses: actions/upload-artifact@v1
with:
name: builds-mac
name: builds
path: ./build
upload-release:
needs: [test, test-postman-sqlite, test-postman-mysql, test-postman-postgres, build-linux, build-windows, build-mac]
needs: [test, test-postman-sqlite, test-postman-mysql, test-postman-postgres, build-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -463,22 +373,10 @@ jobs:
echo ::set-env name=VERSION::$(cat version.txt)
shell: bash
- name: Download Linux Builds
- name: Download Builds
uses: actions/download-artifact@v1
with:
name: builds-linux
path: ./builds
- name: Download Windows Builds
uses: actions/download-artifact@v1
with:
name: builds-windows
path: ./builds
- name: Download MacOSX Builds
uses: actions/download-artifact@v1
with:
name: builds-mac
name: builds
path: ./builds
- name: Upload Releases

View File

@ -1,3 +1,6 @@
# 0.90.42 (05-20-2020)
- Fixed TCP services that dont use TLS.
# 0.90.41 (05-20-2020)
- Added TLS Client Cert/Key feature for HTTP and TCP/UDP services
- Replaced environment variable ADMIN_PASS to ADMIN_PASSWORD.

View File

@ -50,14 +50,13 @@ cypress: clean
test-api:
DB_CONN=sqlite DB_HOST=localhost DB_DATABASE=sqlite DB_PASS=none DB_USER=none statping &
sleep 5000 && newman run dev/postman.json -e dev/postman_environment_sqlite.json --delay-request 500
sleep 5000 && newman run source/tmpl/postman.json -e dev/postman_environment.json --delay-request 500
test-deps:
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get github.com/GeertJohan/go.rice/rice
go get github.com/mattn/go-sqlite3
go get github.com/crazy-max/xgo
go install github.com/mattn/go-sqlite3
deps:
@ -157,29 +156,25 @@ generate:
build-all: clean compile build-folders build-linux build-linux-arm build-darwin build-win compress-folders
build-win:
xgo --go=1.14.2 --dest=build --targets="windows-6.0/386,windows-6.0/amd64" -out statping -ldflags="-s -w -extldflags -static -X main.VERSION=${VERSION}" --pkg cmd /home/runner/work/statping/statping
# CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GO111MODULE="on" GOOS=windows GOARCH=amd64 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-amd64/statping.exe ./cmd
# CGO_ENABLED=1 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GO111MODULE="on" GOOS=windows GOARCH=386 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-386/statping.exe ./cmd
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix GO111MODULE="on" GOOS=windows GOARCH=amd64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-amd64/statping.exe ./cmd
CGO_ENABLED=1 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix GO111MODULE="on" GOOS=windows GOARCH=386 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-386/statping.exe ./cmd
build-darwin:
xgo --go=1.14.2 --dest=build --targets="darwin/386,darwin/amd64" -out statping -ldflags="-s -w -X main.VERSION=${VERSION}" --pkg cmd /home/runner/work/statping/statping
# GO111MODULE="on" GOOS=darwin GOARCH=amd64 go build -a -ldflags "-s -w -X main.VERSION=${VERSION}" -o releases/statping-darwin-amd64/statping --tags "darwin" ./cmd
GO111MODULE="on" GOOS=darwin GOARCH=amd64 go build -a -ldflags "-s -w -X main.VERSION=${VERSION}" -o releases/statping-darwin-amd64/statping --tags "darwin" ./cmd
build-linux:
xgo --go=1.14.2 --dest=build --targets="linux/386,linux/amd64" -out statping -ldflags="-s -w -extldflags -static -X main.VERSION=${VERSION}" --pkg cmd /home/runner/work/statping/statping
# CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=amd64 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-amd64/statping --tags "linux" ./cmd
# CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=386 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-386/statping --tags "linux" ./cmd
CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=amd64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-amd64/statping --tags "linux" ./cmd
CGO_ENABLED=1 GO111MODULE="on" GOOS=linux GOARCH=386 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-386/statping --tags "linux" ./cmd
build-linux-arm:
xgo --go=1.14.2 --dest=build --targets="linux/arm-7,linux/arm64" -out statping -ldflags="-s -w -extldflags -static -X main.VERSION=${VERSION}" --pkg cmd /home/runner/work/statping/statping
# CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=7 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm/statping ./cmd
# CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-6 CXX=aarch64-linux-gnu-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm64 \
# go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm64/statping ./cmd
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc-6 CXX=arm-linux-gnueabihf-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=7 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm/statping ./cmd
CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc-6 CXX=aarch64-linux-gnu-g++-6 GO111MODULE="on" GOOS=linux GOARCH=arm64 \
go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm64/statping ./cmd
build-folders:
mkdir build || true

View File

@ -7,14 +7,13 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<meta name="description" content="{{CoreApp.Description}}">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<base href="{{BasePath}}">
{{if USE_CDN}}
<link rel="shortcut icon" type="image/x-icon" href="https://assets.statping.com/favicon.ico">
<link rel="stylesheet" href="https://assets.statping.com/vendor.css">
<link rel="stylesheet" href="https://assets.statping.com/style.css">
<link rel="stylesheet" href="https://assets.statping.com/main.css">
{{else}}
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
{{if USING_ASSETS}}
<link href="css/vendor.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
<base href="/">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<title>Statping</title>
</head>
<body>

View File

@ -188,24 +188,26 @@ func CheckTcp(s *Service, record bool) *Service {
log.Errorln(err)
}
dialer := &net.Dialer{
KeepAlive: time.Duration(s.Timeout) * time.Second,
Timeout: time.Duration(s.Timeout) * time.Second,
if s.TLSCert.String == "" {
conn, err := net.Dial(s.Type, domain)
if err != nil {
if record {
recordFailure(s, fmt.Sprintf("Dial Error: %v", err))
}
return s
}
defer conn.Close()
} else {
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: time.Duration(s.Timeout) * time.Second}, s.Type, domain, tlsConfig)
if err != nil {
if record {
recordFailure(s, fmt.Sprintf("Dial Error: %v", err))
}
return s
}
defer conn.Close()
}
conn, err := tls.DialWithDialer(dialer, s.Type, domain, tlsConfig)
if err != nil {
if record {
recordFailure(s, fmt.Sprintf("Dial Error %v", err))
}
return s
}
if err := conn.Close(); err != nil {
if record {
recordFailure(s, fmt.Sprintf("%v Socket Close Error %v", strings.ToUpper(s.Type), err))
}
return s
}
t2 := utils.Now()
s.Latency = t2.Sub(t1).Microseconds()
s.LastResponse = ""

View File

@ -1 +1 @@
0.90.41
0.90.42