Skip to content

Commit

Permalink
improve /health endpoint informations (#244)
Browse files Browse the repository at this point in the history
* update skywire-utilities@develop

* fix github action workflows

* go mod vendor

* fix workflow for darwin and windows

* upgrade golang on docker to 1.21

* go mod tidy | go mod vendor

* update [email protected]

* improve graceful shutdown process

* fix make check error

* add dmsgweb to release packages

* update CHANGELOG.md

* update CHANGELOG.md

* update CHANGELOG.md by script

* update go version on release stage for mac and windows to 1.21.*
  • Loading branch information
mrpalide committed Dec 10, 2023
1 parent e12c29a commit ee0160c
Show file tree
Hide file tree
Showing 317 changed files with 18,610 additions and 17,766 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -46,7 +46,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
shell: pwsh
Expand All @@ -57,4 +57,4 @@ jobs:
- name: Releasing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make github-release-windows
run: make github-release-windows
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1
go mod vendor
- name: Checking Format and Testing
run: make check
Expand All @@ -23,11 +23,11 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1
go mod vendor
- name: Checking Format and Testing
run: make check
Expand All @@ -40,12 +40,12 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
choco install make
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.1
go mod vendor
- name: Testing
run: |
Expand Down
13 changes: 13 additions & 0 deletions .goreleaser-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ builds:
main: ./cmd/dmsgpty-cli/
ldflags: -s -w -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb
binary: dmsgweb
goos:
- darwin
goarch:
- arm64
- amd64
env:
- CGO_ENABLED=0
main: ./cmd/dmsgweb/
ldflags: -s -w -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

archives:
- id: archive
format: tar.gz
Expand All @@ -100,6 +112,7 @@ archives:
- dmsgpty-host
- dmsgcurl
- dmsgpty-cli
- dmsgweb
allow_different_binary_count: true

checksum:
Expand Down
56 changes: 56 additions & 0 deletions .goreleaser-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,58 @@ builds:
main: ./cmd/dmsgpty-host/
ldflags: -s -w -linkmode external -extldflags '-static' -buildid= -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb-amd64
binary: dmsgweb
goos:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=1
- CC=/home/runner/work/dmsg/dmsg/musl-data/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc
main: ./cmd/dmsgweb/
ldflags: -s -w -linkmode external -extldflags '-static' -buildid= -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb-arm64
binary: dmsgweb
goos:
- linux
goarch:
- arm64
env:
- CGO_ENABLED=1
- CC=/home/runner/work/dmsg/dmsg/musl-data/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
main: ./cmd/dmsgweb/
ldflags: -s -w -linkmode external -extldflags '-static' -buildid= -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb-arm
binary: dmsgweb
goos:
- linux
goarch:
- arm
goarm:
- 6
env:
- CGO_ENABLED=1
- CC=/home/runner/work/dmsg/dmsg/musl-data/arm-linux-musleabi-cross/bin/arm-linux-musleabi-gcc
main: ./cmd/dmsgweb/
ldflags: -s -w -linkmode external -extldflags '-static' -buildid= -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb-armhf
binary: dmsgweb
goos:
- linux
goarch:
- arm
goarm:
- 7
env:
- CGO_ENABLED=1
- CC=/home/runner/work/dmsg/dmsg/musl-data/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc
main: ./cmd/dmsgweb/
ldflags: -s -w -linkmode external -extldflags '-static' -buildid= -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

archives:
- id: amd64
format: tar.gz
Expand All @@ -341,6 +393,7 @@ archives:
- dmsgpty-cli-amd64
- dmsgcurl-amd64
- dmsgpty-host-amd64
- dmsgweb-amd64

- id: arm64
format: tar.gz
Expand All @@ -353,6 +406,7 @@ archives:
- dmsgpty-cli-arm64
- dmsgcurl-arm64
- dmsgpty-host-arm64
- dmsgweb-arm64

- id: arm
format: tar.gz
Expand All @@ -365,6 +419,7 @@ archives:
- dmsgpty-cli-arm
- dmsgcurl-arm
- dmsgpty-host-arm
- dmsgweb-arm

- id: armhf
format: tar.gz
Expand All @@ -377,6 +432,7 @@ archives:
- dmsgpty-cli-armhf
- dmsgcurl-armhf
- dmsgpty-host-armhf
- dmsgweb-armhf

checksum:
name_template: 'checksums.txt'
Expand Down
12 changes: 12 additions & 0 deletions .goreleaser-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ builds:
main: ./cmd/dmsgpty-host/
ldflags: -s -w -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

- id: dmsgweb
binary: dmsgweb
goos:
- windows
goarch:
- amd64
- 386
env:
- CGO_ENABLED=0
main: ./cmd/dmsgweb/
ldflags: -s -w -X github.com/skycoin/skywire-utilities/pkg/buildinfo.version=v{{.Version}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.commit={{.ShortCommit}} -X github.com/skycoin/skywire-utilities/pkg/buildinfo.date={{.Date}}

archives:
- id: archive
format: zip
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

updates may be generated with scripts/changelog.sh <PR#lowest> <PR#highest>

## 1.3.14

### Added
- add `dmsgweb` as new tools to release

### Changed
- change `dmsgget` to `dmsgcurl` with new functionalities

### Commits
- update skywire-utilities [#244](https://github.com/skycoin/dmsg/pull/244)
- add ConnectedServersPK method [#243](https://github.com/skycoin/dmsg/pull/243)
- improve logic on save file dmsgcurl [#242](https://github.com/skycoin/dmsg/pull/242)
- dmsgcurl [#238](https://github.com/skycoin/dmsg/pull/238)
- dmsg client using socks5 proxy basic example [#237](https://github.com/skycoin/dmsg/pull/237)
- Bump Go images for Docker to 1.20-alpine [#235](https://github.com/skycoin/dmsg/pull/235)
- Export RootCmds [#234](https://github.com/skycoin/dmsg/pull/234)
- Dmsgweb [#229](https://github.com/skycoin/dmsg/pull/229)


## 1.3.0

Expand All @@ -12,4 +32,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- add `gen` command to generate config, with two flag `-o` for output file and `-t` for using test env values

### Changed
- switch from AppVeyor to Github Action in CI process
- switch from AppVeyor to Github Action in CI process
7 changes: 7 additions & 0 deletions cmd/dmsg-discovery/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ var RootCmd = &cobra.Command{

defer closeDmsgDC()

go func() {
for {
a.DmsgServers = dmsgDC.ConnectedServersPK()
time.Sleep(time.Second)
}
}()

go updateServers(ctx, a, dClient, dmsgDC, log)

go func() {
Expand Down
27 changes: 7 additions & 20 deletions cmd/dmsgweb/commands/dmsgweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (r *customResolver) Resolve(ctx context.Context, name string) (context.Cont

var (
httpC http.Client
httpClient http.Client
dmsgDisc string
dmsgSessions int
filterDomainSuffix string
Expand Down Expand Up @@ -140,27 +139,19 @@ var RootCmd = &cobra.Command{
pk, sk = cipher.GenerateKeyPair()
}

if addProxy != "" {
// Configure SOCKS5 proxy dialer
dialer, err := proxy.SOCKS5("tcp", addProxy, nil, proxy.Direct)
if err != nil {
log.Fatalf("Error creating SOCKS5 dialer: %v", err)
}
// Configure custom HTTP transport with SOCKS5 proxy
// Configure HTTP client with custom transport
httpClient = http.Client{
Transport: &http.Transport{
Dial: dialer.Dial,
},
}
}

dmsgC, closeDmsg, err := startDmsg(ctx, pk, sk)
if err != nil {
dmsgWebLog.WithError(err).Fatal("failed to start dmsg")
}
defer closeDmsg()

go func() {
<-ctx.Done()
cancel()
closeDmsg()
os.Exit(0) //this should not be necessary
}()

httpC = http.Client{Transport: dmsghttp.MakeHTTPTransport(ctx, dmsgC)}

// Create a SOCKS5 server with custom name resolution
Expand Down Expand Up @@ -262,10 +253,6 @@ var RootCmd = &cobra.Command{
wg.Done()
}()
wg.Wait()
os.Exit(0) //this should not be necessary
// <-ctx.Done()
cancel()
closeDmsg()
},
}

Expand Down
2 changes: 1 addition & 1 deletion docker/images/dmsg-discovery/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine AS builder
FROM golang:1.21-alpine AS builder
ARG CGO_ENABLED=0

ENV CGO_ENABLED=${CGO_ENABLED} \
Expand Down
2 changes: 1 addition & 1 deletion docker/images/dmsg-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine AS builder
FROM golang:1.21-alpine AS builder
ARG CGO_ENABLED=0

ENV CGO_ENABLED=${CGO_ENABLED} \
Expand Down
8 changes: 5 additions & 3 deletions examples/proxified/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package main
import (
"context"

"time"
"net/http"
"github.com/skycoin/skywire-utilities/pkg/skyenv"
"time"

"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire-utilities/pkg/skyenv"

"github.com/skycoin/skywire-utilities/pkg/cipher"
"golang.org/x/net/proxy"

"github.com/skycoin/dmsg/pkg/disc"
dmsg "github.com/skycoin/dmsg/pkg/dmsg"
"golang.org/x/net/proxy"
)

func main() {
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/skycoin/dmsg

go 1.18
go 1.21

toolchain go1.21.3

require (
github.com/ActiveState/termtest/conpty v0.5.0
Expand All @@ -17,7 +19,7 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6
github.com/skycoin/skycoin v0.27.1
github.com/skycoin/skywire-utilities v0.0.0-20231120175000-12be4345eb26
github.com/skycoin/skywire-utilities v1.3.14
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.8.3
golang.org/x/net v0.10.0
Expand Down
Loading

0 comments on commit ee0160c

Please sign in to comment.