Skip to content

Commit

Permalink
feat(tunnel): move up the validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Jul 12, 2023
1 parent c5c3b12 commit 239ac4c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type Tunnel struct {
}

func NewTunnel(port int, dest, cfgPath, optFormat string) (*Tunnel, error) {
if dest == "" {
return nil, common.ErrDestAddressEmpty
}

dest = "http://" + dest
destURL, err := url.Parse(dest)
if err != nil {
Expand All @@ -26,10 +30,6 @@ func NewTunnel(port int, dest, cfgPath, optFormat string) (*Tunnel, error) {

var opt teler.Options

if dest == "" {
return nil, common.ErrDestAddressEmpty
}

tun := &Tunnel{}
tun.ReverseProxy = httputil.NewSingleHostReverseProxy(destURL)

Expand Down

0 comments on commit 239ac4c

Please sign in to comment.