Skip to content

Commit

Permalink
Merge pull request fatedier#2018 from fatedier/dev
Browse files Browse the repository at this point in the history
bump version to v0.34.1
  • Loading branch information
fatedier authored Sep 30, 2020
2 parents 813c45f + e52dfc4 commit e0c45a1
Show file tree
Hide file tree
Showing 118 changed files with 388 additions and 230 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Build Image and Publish to Dockerhub & GPR

on:
release:
types: [ created ]
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'test'
jobs:
binary:
name: Build Golang project
runs-on: ubuntu-latest
steps:
-
name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.15
-
run: go version
-
name: Check out code into the Go module directory
uses: actions/checkout@v2
-
name: Build
run: make build
-
name: Archive artifacts for frpc
uses: actions/upload-artifact@v1
with:
name: frpc
path: bin/frpc
-
name: Archive artifacts for frps
uses: actions/upload-artifact@v1
with:
name: frps
path: bin/frps

image:
name: Build Image from Dockerfile and binaries
runs-on: ubuntu-latest
needs: binary
steps:
# environment
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# download binaries of frpc and frps
-
name: Download binary of frpc
uses: actions/download-artifact@v2
with:
name: frpc
path: bin/frpc
-
name: Download binary of frps
uses: actions/download-artifact@v2
with:
name: frps
path: bin/frps
# get image tag name
-
name: Get Image Tag Name
run: |
if [ x${{ github.event.inputs.tag }} == x"" ]; then
echo ::set-env name=TAG_NAME::${GITHUB_REF#refs/*/}
else
echo ::set-env name=TAG_NAME::${{ github.event.inputs.tag }}
fi
# prepare image tags
-
name: Prepare Image Tags
run: |
echo ::set-env name=DOCKERFILE_FRPC_PATH::dockerfiles/Dockerfile-for-frpc
echo ::set-env name=DOCKERFILE_FRPS_PATH::dockerfiles/Dockerfile-for-frps
echo ::set-env name=TAG_FRPC::fatedier/frpc:$TAG_NAME
echo ::set-env name=TAG_FRPS::fatedier/frps:$TAG_NAME
echo ::set-env name=TAG_FRPC_GPR::ghcr.io/fatedier/frpc:$TAG_NAME
echo ::set-env name=TAG_FRPS_GPR::ghcr.io/fatedier/frps:$TAG_NAME
# build images
-
name: Build Images
run: |
# for Docker hub
docker build --file $DOCKERFILE_FRPC_PATH --tag $TAG_FRPC .
docker build --file $DOCKERFILE_FRPS_PATH --tag $TAG_FRPS .
# for GPR
docker build --file $DOCKERFILE_FRPC_PATH --tag $TAG_FRPC_GPR .
docker build --file $DOCKERFILE_FRPS_PATH --tag $TAG_FRPS_GPR .
# push to dockerhub
-
name: Publish to Dockerhub
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker push $TAG_FRPC
docker push $TAG_FRPS
# push to gpr
-
name: Publish to GPR
run: |
echo ${{ secrets.GPR_TOKEN }} | docker login ghcr.io --username ${{ github.repository_owner }} --password-stdin
docker push $TAG_FRPC_GPR
docker push $TAG_FRPS_GPR
26 changes: 26 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Close stale issues"
on:
schedule:
- cron: "20 0 * * *"
workflow_dispatch:
inputs:
debug-only:
description: 'In debug mod'
required: false
default: 'false'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.'
stale-pr-message: 'Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.'
stale-issue-label: 'lifecycle/stale'
exempt-issue-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
stale-pr-label: 'lifecycle/stale'
exempt-pr-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
days-before-stale: 45
days-before-close: 10
debug-only: ${{ github.event.inputs.debug-only }}
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export PATH := $(GOPATH)/bin:$(PATH)
export GO111MODULE=on
LDFLAGS := -s -w

all: fmt build

Expand All @@ -19,20 +20,19 @@ fmt:
go fmt ./...

frps:
go build -o bin/frps ./cmd/frps
env CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o bin/frps ./cmd/frps

frpc:
go build -o bin/frpc ./cmd/frpc
env CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o bin/frpc ./cmd/frpc

test: gotest

gotest:
go test -v --cover ./assets/...
go test -v --cover ./client/...
go test -v --cover ./cmd/...
go test -v --cover ./models/...
go test -v --cover ./client/...
go test -v --cover ./server/...
go test -v --cover ./utils/...
go test -v --cover ./pkg/...

ci:
go test -count=1 -p=1 -v ./tests/...
Expand Down
2 changes: 1 addition & 1 deletion client/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/fatedier/frp/assets"
frpNet "github.com/fatedier/frp/utils/net"
frpNet "github.com/fatedier/frp/pkg/util/net"

"github.com/gorilla/mux"
)
Expand Down
4 changes: 2 additions & 2 deletions client/admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"strings"

"github.com/fatedier/frp/client/proxy"
"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/utils/log"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/util/log"
)

type GeneralResponse struct {
Expand Down
17 changes: 9 additions & 8 deletions client/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"time"

"github.com/fatedier/frp/client/proxy"
"github.com/fatedier/frp/models/auth"
"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/models/transport"
frpNet "github.com/fatedier/frp/utils/net"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/auth"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
"github.com/fatedier/frp/pkg/transport"
frpNet "github.com/fatedier/frp/pkg/util/net"
"github.com/fatedier/frp/pkg/util/xlog"

"github.com/fatedier/golib/control/shutdown"
"github.com/fatedier/golib/crypto"
Expand Down Expand Up @@ -211,10 +211,11 @@ func (ctl *Control) connectServer() (conn net.Conn, err error) {
var tlsConfig *tls.Config

if ctl.clientCfg.TLSEnable {
tlsConfig, err = transport.NewServerTLSConfig(
tlsConfig, err = transport.NewClientTLSConfig(
ctl.clientCfg.TLSCertFile,
ctl.clientCfg.TLSKeyFile,
ctl.clientCfg.TLSTrustedCaFile)
ctl.clientCfg.TLSTrustedCaFile,
ctl.clientCfg.ServerAddr)

if err != nil {
xl.Warn("fail to build tls configuration when connecting to server, err: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion client/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package event
import (
"errors"

"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/pkg/msg"
)

type Type int
Expand Down
2 changes: 1 addition & 1 deletion client/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"net/http"
"time"

"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/util/xlog"
)

var (
Expand Down
14 changes: 7 additions & 7 deletions client/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
"sync"
"time"

"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
plugin "github.com/fatedier/frp/models/plugin/client"
"github.com/fatedier/frp/models/proto/udp"
"github.com/fatedier/frp/utils/limit"
frpNet "github.com/fatedier/frp/utils/net"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
plugin "github.com/fatedier/frp/pkg/plugin/client"
"github.com/fatedier/frp/pkg/proto/udp"
"github.com/fatedier/frp/pkg/util/limit"
frpNet "github.com/fatedier/frp/pkg/util/net"
"github.com/fatedier/frp/pkg/util/xlog"

"github.com/fatedier/golib/errors"
frpIo "github.com/fatedier/golib/io"
Expand Down
6 changes: 3 additions & 3 deletions client/proxy/proxy_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"sync"

"github.com/fatedier/frp/client/event"
"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
"github.com/fatedier/frp/pkg/util/xlog"

"github.com/fatedier/golib/errors"
)
Expand Down
6 changes: 3 additions & 3 deletions client/proxy/proxy_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/fatedier/frp/client/event"
"github.com/fatedier/frp/client/health"
"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
"github.com/fatedier/frp/pkg/util/xlog"

"github.com/fatedier/golib/errors"
)
Expand Down
16 changes: 8 additions & 8 deletions client/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"crypto/tls"
"fmt"
"github.com/fatedier/frp/models/transport"
"io/ioutil"
"net"
"runtime"
Expand All @@ -27,13 +26,14 @@ import (
"time"

"github.com/fatedier/frp/assets"
"github.com/fatedier/frp/models/auth"
"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/utils/log"
frpNet "github.com/fatedier/frp/utils/net"
"github.com/fatedier/frp/utils/version"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/auth"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
"github.com/fatedier/frp/pkg/transport"
"github.com/fatedier/frp/pkg/util/log"
frpNet "github.com/fatedier/frp/pkg/util/net"
"github.com/fatedier/frp/pkg/util/version"
"github.com/fatedier/frp/pkg/util/xlog"

fmux "github.com/hashicorp/yamux"
)
Expand Down
12 changes: 6 additions & 6 deletions client/visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
"sync"
"time"

"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/msg"
"github.com/fatedier/frp/models/proto/udp"
frpNet "github.com/fatedier/frp/utils/net"
"github.com/fatedier/frp/utils/util"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/msg"
"github.com/fatedier/frp/pkg/proto/udp"
frpNet "github.com/fatedier/frp/pkg/util/net"
"github.com/fatedier/frp/pkg/util/util"
"github.com/fatedier/frp/pkg/util/xlog"

"github.com/fatedier/golib/errors"
frpIo "github.com/fatedier/golib/io"
Expand Down
4 changes: 2 additions & 2 deletions client/visitor_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"sync"
"time"

"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/utils/xlog"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/util/xlog"
)

type VisitorManager struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/frpc/sub/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"os"
"strings"

"github.com/spf13/cobra"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/consts"

"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/consts"
"github.com/spf13/cobra"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/frpc/sub/https.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/spf13/cobra"

"github.com/fatedier/frp/models/config"
"github.com/fatedier/frp/models/consts"
"github.com/fatedier/frp/pkg/config"
"github.com/fatedier/frp/pkg/consts"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/frpc/sub/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"os"
"strings"

"github.com/spf13/cobra"
"github.com/fatedier/frp/pkg/config"

"github.com/fatedier/frp/models/config"
"github.com/spf13/cobra"
)

func init() {
Expand Down
Loading

0 comments on commit e0c45a1

Please sign in to comment.