Skip to content

Commit 345755f

Browse files
committed
Added goreleaser
Signed-off-by: Vishal Rana <vr@labstack.com>
1 parent 4650671 commit 345755f

File tree

6 files changed

+80
-14
lines changed

6 files changed

+80
-14
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
build
21
dist

.goreleaser.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
build:
2+
main: cmd/tunnel/main.go
3+
binary: tunnel
4+
goos:
5+
- darwin
6+
- linux
7+
- windows
8+
goarch:
9+
- amd64
10+
- 386
11+
- arm
12+
- arm64
13+
goarm:
14+
- 6
15+
- 7
16+
17+
nfpm:
18+
formats:
19+
- deb
20+
- rpm
21+
replacements:
22+
amd64: 64-bit
23+
386: 32-bit
24+
vendor: "LabStack"
25+
homepage: "https://labstack.com/docs/diy/tunnel"
26+
maintainer: "Vishal Rana <vr@labstack.com>"
27+
description: "Tunnel lets you expose local servers to internet securely - ngrok alternative, compatible with SSH client."
28+
license: "MIT"
29+
30+
archive:
31+
format: tgz
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
replacements:
36+
amd64: 64-bit
37+
386: 32-bit
38+
darwin: macos
39+
files:
40+
- README.md
41+
- LICENSE
42+
43+
checksum:
44+
name_template: "{{ .ProjectName }}_checksum.txt"
45+
46+
release:
47+
draft: true

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
VERSION = 0.1.1
1+
VERSION = 0.1.2
22

3-
clean:
4-
rm -rf build
3+
build:
4+
git tag $(VERSION)
5+
git push origin --tags
6+
goreleaser --rm-dist
57

6-
build: clean
7-
xgo --targets=darwin-10.8/amd64,linux/amd64,linux/arm-6,linux/arm-7,linux/arm64,windows-8.0/amd64 --pkg cmd/tunnel -out build/tunnel-$(VERSION) github.com/labstack/tunnel
8-
9-
.PHONY: clean build
8+
.PHONY: build

cmd/name.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// nameCmd represents the name command
10+
var nameCmd = &cobra.Command{
11+
Use: "name",
12+
Short: "",
13+
Long: ``,
14+
Run: func(cmd *cobra.Command, args []string) {
15+
fmt.Println("name called")
16+
},
17+
}
18+
19+
func init() {
20+
rootCmd.AddCommand(nameCmd)
21+
}

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var (
1212
Short: "Print the version of Tunnel",
1313
// Long: ``,
1414
Run: func(cmd *cobra.Command, args []string) {
15-
fmt.Println("0.1.1")
15+
fmt.Println("0.1.2")
1616
},
1717
}
1818
)

tunnel.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ func (t *Tunnel) Create() {
4949
// Connect
5050
proxy := os.Getenv("http_proxy")
5151
if proxy != "" {
52-
proxyUrl, err := url.Parse(proxy)
52+
proxyURL, err := url.Parse(proxy)
5353
if err != nil {
5454
log.Fatalf("cannot open new session: %v\n", err)
5555
}
56-
tcp, err := net.Dial("tcp", proxyUrl.Host)
56+
tcp, err := net.Dial("tcp", proxyURL.Hostname())
5757
if err != nil {
5858
log.Fatalf("cannot open new session: %v\n", err)
5959
}
@@ -63,9 +63,9 @@ func (t *Tunnel) Create() {
6363
Host: hostport,
6464
Header: make(http.Header),
6565
}
66-
if proxyUrl.User != nil {
67-
if p, ok := proxyUrl.User.Password(); ok {
68-
connReq.SetBasicAuth(proxyUrl.User.Username(), p)
66+
if proxyURL.User != nil {
67+
if p, ok := proxyURL.User.Password(); ok {
68+
connReq.SetBasicAuth(proxyURL.User.Username(), p)
6969
}
7070
}
7171
connReq.Write(tcp)

0 commit comments

Comments
 (0)