Skip to content

Commit

Permalink
Fix golint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Feb 28, 2020
1 parent b73fc0e commit c1d654e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.13

require (
github.com/nknorg/nkn-sdk-go v1.1.0-beta.9.0.20200211004101-1242f1254c7a
github.com/nknorg/nkn-tuna-session v0.0.0-20200216043929-8e041f8ce8f4
github.com/nknorg/nkn-tuna-session v0.0.0-20200228235606-17275c9faf32
)
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ github.com/nknorg/nkn v1.1.3-beta h1:x1HXZ9rc1ICfWeAkYFlVNt9SULSbxbQDpn1CxU0rDBU
github.com/nknorg/nkn v1.1.3-beta/go.mod h1:Lt8gawlj+t/KhoDg6qigC+XQHnVV2tRn3V+aX7NSkY4=
github.com/nknorg/nkn-sdk-go v1.1.0-beta.9.0.20200211004101-1242f1254c7a h1:iA2E56CPcN+Jzm4gH0RiVEHUE5cvfFwE8/2ZlL3B3UU=
github.com/nknorg/nkn-sdk-go v1.1.0-beta.9.0.20200211004101-1242f1254c7a/go.mod h1:Vyfh1B8rsVAwqs0WlWXtwJVWiQR4I+iU/WO3P2lILUA=
github.com/nknorg/nkn-tuna-session v0.0.0-20200216043929-8e041f8ce8f4 h1:sODR/f0BQfzSl+mb6dvrQuadWBkFXuNWUS6XdjrxLsA=
github.com/nknorg/nkn-tuna-session v0.0.0-20200216043929-8e041f8ce8f4/go.mod h1:1mPswFuaO5fFFm4M9FLfiyhwNakzZPcG39VQB78VTOI=
github.com/nknorg/nkn-tuna-session v0.0.0-20200228235606-17275c9faf32 h1:AQO+5p3yRHOiwWE1Wz55P4bsLIKzJ3VjgYr6qxui+Dw=
github.com/nknorg/nkn-tuna-session v0.0.0-20200228235606-17275c9faf32/go.mod h1:x7AK+KNrykeS2P7XDYtygegNMZkA21rUP1Tev3bj4zc=
github.com/nknorg/nnet v0.0.0-20190915192011-8917c10a07e0 h1:9vdBzjDe86z0+LaoBb8Le9Ue7YsjHGDGWYORntr2dOY=
github.com/nknorg/nnet v0.0.0-20190915192011-8917c10a07e0/go.mod h1:XG+yLiMrl01iwez333VO2c/I0w5cy851c4STmR2/V1w=
github.com/nknorg/nnet v0.0.0-20191227203626-cd40f91ceda2 h1:3giMkKR8f6FkryS/cL/S1+VsOkXBKi85SI2QwymY80o=
github.com/nknorg/nnet v0.0.0-20191227203626-cd40f91ceda2/go.mod h1:XG+yLiMrl01iwez333VO2c/I0w5cy851c4STmR2/V1w=
github.com/nknorg/tuna v0.0.0-20200216043814-4c6276667580 h1:/Zm/3dfC2W28XV8G64PJhoO7XiAhJcB5SMEqUuZ9xCk=
github.com/nknorg/tuna v0.0.0-20200216043814-4c6276667580/go.mod h1:S0lQKDgFTiFt9HHZBwtK7OoIvzo0aNKoFSaWaRFJNMk=
github.com/nknorg/tuna v0.0.0-20200228010645-5dcd173fe55c h1:eia/wWewhgF/6Y0Y0ZrQnPfiKv0QgJVGzB/KebLf/t4=
github.com/nknorg/tuna v0.0.0-20200228010645-5dcd173fe55c/go.mod h1:S0lQKDgFTiFt9HHZBwtK7OoIvzo0aNKoFSaWaRFJNMk=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down Expand Up @@ -145,6 +145,8 @@ github.com/tjfoc/gmsm v1.0.1 h1:R11HlqhXkDospckjZEihx9SW/2VW0RgdwrykyWMFOQU=
github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc=
github.com/tjfoc/gmsm v1.2.0 h1:oTXUFetR8GphwGmUUxWFxrRZJTaDcZo1Lt2mRxlVzEI=
github.com/tjfoc/gmsm v1.2.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
github.com/tjfoc/gmsm v1.3.0 h1:i7c6Za/IlgBvnGxYpfD7L3TGuaS+v6oGcgq+J9/ecEA=
github.com/tjfoc/gmsm v1.3.0/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
github.com/trueinsider/smux v1.3.5-metadata h1:+5g+oFutqA7aAVEuSJZYehFWOYCPsXljDPJzyB7o3uo=
github.com/trueinsider/smux v1.3.5-metadata/go.mod h1:mL7/XFztFsqWyRBJDQqgKrpdECDnp/y/utBdIgFMeFk=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
Expand Down Expand Up @@ -173,8 +175,8 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678 h1:wCWoJcFExDgyYx2m2hpHgwz8W3+FPdfldvIgzqDIhyg=
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6 h1:Sy5bstxEqwwbYs6n0/pBuxKENqOeZUgD45Gp3Q3pqLg=
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -185,6 +187,8 @@ golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+ar
golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -194,8 +198,8 @@ golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7 h1:wYqz/tQaWUgGKyx+B/rssSE6w
golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 h1:sfkvUWPNGwSV+8/fNqctR5lS2AqCSqYwXdrjCxp/dXo=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand Down
6 changes: 4 additions & 2 deletions tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type nknDialer interface {
Dial(addr string) (net.Conn, error)
}

// Tunnel is the tunnel client struct.
type Tunnel struct {
from string
to string
Expand All @@ -26,6 +27,7 @@ type Tunnel struct {
verbose bool
}

// NewTunnel creates a Tunnel client with given options.
func NewTunnel(numClients int, seed []byte, identifier, from, to string, tuna, verbose bool) (*Tunnel, error) {
fromNKN := strings.ToLower(from) == "nkn"
toNKN := !strings.Contains(to, ":")
Expand Down Expand Up @@ -103,11 +105,11 @@ func NewTunnel(numClients int, seed []byte, identifier, from, to string, tuna, v
func (t *Tunnel) dial(addr string) (net.Conn, error) {
if t.toNKN {
return t.nknDialer.Dial(addr)
} else {
return net.Dial("tcp", addr)
}
return net.Dial("tcp", addr)
}

// Start starts the tunnel and will return on error.
func (t *Tunnel) Start() error {
for {
fromConn, err := t.listener.Accept()
Expand Down

0 comments on commit c1d654e

Please sign in to comment.