Skip to content

Commit 6beb7de

Browse files
committed
Bumped v0.5.14
Signed-off-by: Vishal Rana <[email protected]>
1 parent 61958b6 commit 6beb7de

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IMAGE = labstack/tunnel
2-
VERSION = 0.5.13
2+
VERSION = 0.5.14
33

44
publish:
55
git tag v$(VERSION)

cmd/root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ func initialize() {
8585
viper.Set("daemon_pid", filepath.Join(root, "daemon.pid"))
8686
viper.Set("daemon_addr", filepath.Join(root, "daemon.addr"))
8787
viper.Set("hostname", "labstack.me")
88+
viper.Set("port", 22)
89+
viper.Set("remote_port", 80)
8890
viper.Set("api_url", "https://tunnel.labstack.com/api/v1")
8991
if dev := viper.GetString("DC") == "dev"; dev {
90-
viper.Set("host", "labstack.d:22")
92+
viper.Set("hostname", "labstack.d")
93+
viper.Set("port", 2200)
94+
viper.Set("remote_port", 8000)
9195
viper.Set("api_url", "http://tunnel.labstack.d/api/v1")
9296
viper.SetConfigName("config.dev")
9397
} else {

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
const (
10-
version = "v0.5.13"
10+
version = "v0.5.14"
1111
)
1212

1313
var versionCmd = &cobra.Command{

daemon/connection.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
type (
22-
Header struct {
22+
User struct {
2323
ID string `json:"id"`
2424
Protocol Protocol `json:"protocol"`
2525
Target string `json:"target"`
@@ -45,15 +45,14 @@ type (
4545
started bool
4646
stopped bool
4747
retries time.Duration
48-
Header *Header
48+
user *User
4949
ID string `json:"id"`
5050
Name string `json:"name"`
5151
Random bool `json:"random"`
5252
Hostname string `json:"hostname"`
5353
Port int `json:"port"`
5454
TargetAddress string `json:"target_address"`
55-
RemoteHost string
56-
RemotePort int
55+
RemotePort string
5756
RemoteURI string `json:"remote_uri"`
5857
Status ConnectionStatus `json:"status"`
5958
ConnectedAt time.Time `json:"connected_at"`
@@ -82,7 +81,7 @@ func (c *Connection) Host() (host string) {
8281
} else if c.Hostname != "" {
8382
h = c.Hostname
8483
}
85-
return net.JoinHostPort(h, "22")
84+
return net.JoinHostPort(h, viper.GetString("port"))
8685
}
8786

8887
func (s *Server) newConnection(req *ConnectRequest) (c *Connection, err error) {
@@ -95,8 +94,6 @@ func (s *Server) newConnection(req *ConnectRequest) (c *Connection, err error) {
9594
stopChan: make(chan bool),
9695
ID: id,
9796
TargetAddress: req.Address,
98-
RemoteHost: "0.0.0.0",
99-
RemotePort: 80,
10097
Configuration: new(Configuration),
10198
}
10299

@@ -115,11 +112,12 @@ func (s *Server) newConnection(req *ConnectRequest) (c *Connection, err error) {
115112
c.Name = req.Configuration
116113
req.Protocol = c.Configuration.Protocol
117114
}
115+
c.RemotePort = viper.GetString("remote_port")
118116
if req.Protocol != ProtocolHTTP {
119-
c.RemotePort = 0
117+
c.RemotePort = "0"
120118
}
121119

122-
c.Header = &Header{
120+
c.user = &User{
123121
ID: id,
124122
Protocol: req.Protocol,
125123
Target: req.Address,
@@ -145,7 +143,7 @@ RECONNECT:
145143
c.startChan <- fmt.Errorf("failed to parse host key: %v", err)
146144
return
147145
}
148-
user, _ := json.Marshal(c.Header)
146+
user, _ := json.Marshal(c.user)
149147
config := &ssh.ClientConfig{
150148
User: string(user),
151149
Auth: []ssh.AuthMethod{
@@ -210,7 +208,7 @@ RECONNECT:
210208
}()
211209

212210
// Remote listener
213-
l, err := sc.Listen("tcp", fmt.Sprintf("%s:%d", c.RemoteHost, c.RemotePort))
211+
l, err := sc.Listen("tcp", fmt.Sprintf("0.0.0.0:%s", c.RemotePort))
214212
if err != nil {
215213
c.startChan <- fmt.Errorf("failed to listen on remote host: %v", err)
216214
return

0 commit comments

Comments
 (0)