mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 17:35:40 +08:00
general: add github actions and remove travis
This commit is contained in:
parent
d36b8fa394
commit
c2425e67de
39
.github/workflows/build.yml
vendored
Normal file
39
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: Build
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Go 1.13
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.13
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test -v .
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [test]
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Go 1.13
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.13
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v .
|
27
.github/workflows/release.yml
vendored
Normal file
27
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
create:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release on GitHub
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Validates GO releaser config
|
||||||
|
uses: docker://goreleaser/goreleaser:latest
|
||||||
|
with:
|
||||||
|
args: check
|
||||||
|
|
||||||
|
- name: Create release on GitHub
|
||||||
|
uses: docker://goreleaser/goreleaser:latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
with:
|
||||||
|
args: release
|
||||||
|
if: success()
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,7 +19,6 @@
|
|||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
dist
|
dist
|
||||||
.goreleaser.yml
|
|
||||||
|
|
||||||
*.zip
|
*.zip
|
||||||
/*.conf
|
/*.conf
|
||||||
|
62
.goreleaser.yml
Normal file
62
.goreleaser.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Make sure to check the documentation at http://goreleaser.com
|
||||||
|
|
||||||
|
# release:
|
||||||
|
# git tag -a v0.1.0 -m "v0.1.0"
|
||||||
|
# git push origin v0.1.0
|
||||||
|
# goreleaser release --skip-publish --rm-dist
|
||||||
|
|
||||||
|
# snapshot:
|
||||||
|
# goreleaser --snapshot --rm-dist
|
||||||
|
|
||||||
|
# https://goreleaser.com/customization/
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
# https://goreleaser.com/build/
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
- darwin
|
||||||
|
goarch:
|
||||||
|
- 386
|
||||||
|
- amd64
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
- mips
|
||||||
|
- mipsle
|
||||||
|
- mips64
|
||||||
|
- mips64le
|
||||||
|
goarm:
|
||||||
|
- 6
|
||||||
|
- 7
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- goos: darwin
|
||||||
|
goarch: 386
|
||||||
|
|
||||||
|
# https://goreleaser.com/archive/
|
||||||
|
archive:
|
||||||
|
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
||||||
|
wrap_in_directory: true
|
||||||
|
format: tar.gz
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
files:
|
||||||
|
- LICENSE
|
||||||
|
- README.md
|
||||||
|
- config/**/*
|
||||||
|
- systemd/*
|
||||||
|
|
||||||
|
# https://goreleaser.com/snapshots/
|
||||||
|
snapshot:
|
||||||
|
name_template: "dev@{{.ShortCommit}}"
|
||||||
|
|
||||||
|
# https://goreleaser.com/checksum/
|
||||||
|
checksum:
|
||||||
|
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
|
@ -1,5 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- "1.13.x"
|
|
||||||
- master
|
|
@ -81,7 +81,7 @@ Binary:
|
|||||||
|
|
||||||
- [https://github.com/nadoo/glider/releases](https://github.com/nadoo/glider/releases)
|
- [https://github.com/nadoo/glider/releases](https://github.com/nadoo/glider/releases)
|
||||||
|
|
||||||
Go Get (requires **Go 1.12+** ):
|
Go Get (requires **Go 1.13+** ):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get -u github.com/nadoo/glider
|
go get -u github.com/nadoo/glider
|
||||||
|
2
conf.go
2
conf.go
@ -103,7 +103,7 @@ func confInit() {
|
|||||||
func usage() {
|
func usage() {
|
||||||
app := os.Args[0]
|
app := os.Args[0]
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
fmt.Fprintf(os.Stderr, "%s v%s usage:\n", app, VERSION)
|
fmt.Fprintf(os.Stderr, "%s v%s usage:\n", app, version)
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
|
|
||||||
|
6
main.go
6
main.go
@ -29,13 +29,9 @@ import (
|
|||||||
_ "github.com/nadoo/glider/proxy/ws"
|
_ "github.com/nadoo/glider/proxy/ws"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VERSION .
|
var version = "dev"
|
||||||
const VERSION = "0.7.1"
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// TODO: remove this line when Go1.13 is released.
|
|
||||||
os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
|
|
||||||
|
|
||||||
// read configs
|
// read configs
|
||||||
confInit()
|
confInit()
|
||||||
|
|
||||||
|
@ -310,22 +310,14 @@ func cleanHeaders(header textproto.MIMEHeader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writeFirstLine(buf *bytes.Buffer, s1, s2, s3 string) {
|
func writeFirstLine(buf *bytes.Buffer, s1, s2, s3 string) {
|
||||||
buf.Write([]byte(s1))
|
buf.WriteString(s1 + " " + s2 + " " + s3 + "\r\n")
|
||||||
buf.Write([]byte(" "))
|
|
||||||
buf.Write([]byte(s2))
|
|
||||||
buf.Write([]byte(" "))
|
|
||||||
buf.Write([]byte(s3))
|
|
||||||
buf.Write([]byte("\r\n"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeHeaders(buf *bytes.Buffer, header textproto.MIMEHeader) {
|
func writeHeaders(buf *bytes.Buffer, header textproto.MIMEHeader) {
|
||||||
for key, values := range header {
|
for key, values := range header {
|
||||||
for _, v := range values {
|
for _, v := range values {
|
||||||
buf.Write([]byte(key))
|
buf.WriteString(key + ": " + v + "\r\n")
|
||||||
buf.Write([]byte(": "))
|
|
||||||
buf.Write([]byte(v))
|
|
||||||
buf.Write([]byte("\r\n"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.Write([]byte("\r\n"))
|
buf.WriteString("\r\n")
|
||||||
}
|
}
|
||||||
|
@ -100,14 +100,14 @@ func (rd *Dialer) NextDialer(dstAddr string) proxy.Dialer {
|
|||||||
// Dial dials to targer addr and return a conn
|
// Dial dials to targer addr and return a conn
|
||||||
func (rd *Dialer) Dial(network, addr string) (net.Conn, error) {
|
func (rd *Dialer) Dial(network, addr string) (net.Conn, error) {
|
||||||
d := rd.NextDialer(addr)
|
d := rd.NextDialer(addr)
|
||||||
log.F("[Dial] %s => %s", addr, d.Addr())
|
log.F("[dial] %s => %s", addr, d.Addr())
|
||||||
return d.Dial(network, addr)
|
return d.Dial(network, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialUDP connects to the given address via the proxy
|
// DialUDP connects to the given address via the proxy
|
||||||
func (rd *Dialer) DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error) {
|
func (rd *Dialer) DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error) {
|
||||||
d := rd.NextDialer(addr)
|
d := rd.NextDialer(addr)
|
||||||
log.F("[DialUDP] %s => %s", addr, d.Addr())
|
log.F("[dial-udp] %s => %s", addr, d.Addr())
|
||||||
return d.DialUDP(network, addr)
|
return d.DialUDP(network, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user