Skip to content

Commit

Permalink
Run gofmt -w -s .
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Feb 28, 2021
1 parent 321809b commit 10d017e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/tcp_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (conn *tcpConn) Write(data []byte) (int, error) {
lwipMutex.Unlock()
return totalWritten, err
}
data = data[written:len(data)]
data = data[written:]
}
lwipMutex.Unlock()
if len(data) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion proxy/socks/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (h *udpHandler) connectInternal(conn core.UDPConn, dest string) error {
}

c.Write(append([]byte{5, socks5UDPAssociate, 0}, []byte{1, 0, 0, 0, 0, 0, 0}...))

// read VER REP RSV ATYP BND.ADDR BND.PORT
if _, err := io.ReadFull(c, buf[:3]); err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Get(routes, excludeRoutes, addr, gw, mask string) (net.IP, []*net.IPNet, er
for _, cidr := range strings.FieldsFunc(routes, splitFunc) {
if v := net.ParseIP(cidr).To4(); v != nil {
res.InsertNet(getNet(v))
log.Debugf("including %s (%s) to routes", cidr, v)
log.Debugf("including %s to routes", v)
continue
}

Expand All @@ -53,7 +53,7 @@ func Get(routes, excludeRoutes, addr, gw, mask string) (net.IP, []*net.IPNet, er
}
return nil, nil, fmt.Errorf("failed to parse %s CIDR: %v", cidr, err)
}
log.Debugf("including %s (%s) to routes", cidr, v)
log.Debugf("including %s to routes", v)
res.InsertNet(v)
}

Expand Down Expand Up @@ -124,6 +124,6 @@ func ParseAddresses(addr, gw, mask string) ([]*net.IPNet, error) {

return []*net.IPNet{
getNet(local),
&net.IPNet{IP: remote, Mask: net.IPMask(remoteMask.To4())},
{IP: remote, Mask: net.IPMask(remoteMask.To4())},
}, nil
}
8 changes: 4 additions & 4 deletions tun/tun_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func setInterface(name, addr, gw, mask string, mtu int, tun *tun.NativeTun) erro
if err != nil {
return fmt.Errorf("failed to set ip addr: %s: %s: %s", args, v, err)
}
args = []string{
name,
"up",
}
args = []string{
name,
"up",
}
v, err = exec.Command("ifconfig", args...).CombinedOutput()
if err != nil {
return fmt.Errorf("failed to bring up interface: %s: %s: %s", args, v, err)
Expand Down

0 comments on commit 10d017e

Please sign in to comment.