Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: Revert inetaf/tcpproxy commit 2862066 #386

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/coreos/stream-metadata-go v0.4.4
github.com/dustin/go-humanize v1.0.1
github.com/google/gopacket v1.1.19
github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c
github.com/insomniacslk/dhcp v0.0.0-20240710054256-ddd8a41251c9
github.com/linuxkit/virtsock v0.0.0-20220523201153-1a23e78aa7a2
github.com/mdlayher/vsock v1.2.1
Expand All @@ -27,6 +26,7 @@ require (
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
gvisor.dev/gvisor v0.0.0-20231023213702-2691a8f9b1cf
inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0
)

require (
Expand All @@ -49,3 +49,5 @@ require (
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace inet.af/tcpproxy => github.com/inetaf/tcpproxy v0.0.0-20221017015627-91f861402626
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c h1:gYfYE403/nlrGNYj6BEOs9ucLCAGB9gstlSk92DttTg=
github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c/go.mod h1:Di7LXRyUcnvAcLicFhtM9/MlZl/TNgRSDHORM2c6CMI=
github.com/inetaf/tcpproxy v0.0.0-20221017015627-91f861402626 h1:oeu2cpk2bBlSgMQiSQIBJ8+FZsTqMG9fwdPez/weEbk=
github.com/inetaf/tcpproxy v0.0.0-20221017015627-91f861402626/go.mod h1:Tojt5kmHpDIR2jMojxzZK2w2ZR7OILODmUo2gaSwjrk=
github.com/insomniacslk/dhcp v0.0.0-20240710054256-ddd8a41251c9 h1:LZJWucZz7ztCqY6Jsu7N9g124iJ2kt/O62j3+UchZFg=
github.com/insomniacslk/dhcp v0.0.0-20240710054256-ddd8a41251c9/go.mod h1:KclMyHxX06VrVr0DJmeFSUb1ankt7xTfoOA35pCkoic=
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/forwarder/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import (

"github.com/containers/gvisor-tap-vsock/pkg/sshclient"
"github.com/containers/gvisor-tap-vsock/pkg/types"
"github.com/inetaf/tcpproxy"
log "github.com/sirupsen/logrus"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"gvisor.dev/gvisor/pkg/tcpip/stack"
"inet.af/tcpproxy"
)

type PortsForwarder struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/forwarder/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"net"
"sync"

"github.com/inetaf/tcpproxy"
log "github.com/sirupsen/logrus"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
"gvisor.dev/gvisor/pkg/tcpip/stack"
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
"gvisor.dev/gvisor/pkg/waiter"
"inet.af/tcpproxy"
)

const linkLocalSubnet = "169.254.0.0/16"
Expand Down
2 changes: 1 addition & 1 deletion pkg/virtualnetwork/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"strconv"

"github.com/containers/gvisor-tap-vsock/pkg/types"
"github.com/inetaf/tcpproxy"
log "github.com/sirupsen/logrus"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"inet.af/tcpproxy"
)

func (n *VirtualNetwork) Mux() *http.ServeMux {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# tcpproxy

For library usage, see https://pkg.go.dev/github.com/inetaf/tcpproxy/
For library usage, see https://godoc.org/inet.af/tcpproxy/

For CLI usage, see https://github.com/inetaf/tcpproxy/blob/master/cmd/tlsrouter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,30 +345,8 @@ func UnderlyingConn(c net.Conn) net.Conn {
return c
}

func tcpConn(c net.Conn) (t *net.TCPConn, ok bool) {
if c, ok := UnderlyingConn(c).(*net.TCPConn); ok {
return c, ok
}
if c, ok := c.(*net.TCPConn); ok {
return c, ok
}
return nil, false
}

func goCloseConn(c net.Conn) { go c.Close() }

func closeRead(c net.Conn) {
if c, ok := tcpConn(c); ok {
c.CloseRead()
}
}

func closeWrite(c net.Conn) {
if c, ok := tcpConn(c); ok {
c.CloseWrite()
}
}

// HandleConn implements the Target interface.
func (dp *DialProxy) HandleConn(src net.Conn) {
ctx := context.Background()
Expand All @@ -393,19 +371,20 @@ func (dp *DialProxy) HandleConn(src net.Conn) {
defer goCloseConn(src)

if ka := dp.keepAlivePeriod(); ka > 0 {
for _, c := range []net.Conn{src, dst} {
if c, ok := tcpConn(c); ok {
c.SetKeepAlive(true)
c.SetKeepAlivePeriod(ka)
}
if c, ok := UnderlyingConn(src).(*net.TCPConn); ok {
c.SetKeepAlive(true)
c.SetKeepAlivePeriod(ka)
}
if c, ok := dst.(*net.TCPConn); ok {
c.SetKeepAlive(true)
c.SetKeepAlivePeriod(ka)
}
}

errc := make(chan error, 2)
errc := make(chan error, 1)
go proxyCopy(errc, src, dst)
go proxyCopy(errc, dst, src)
<-errc
<-errc
}

func (dp *DialProxy) sendProxyHeader(w io.Writer, src net.Conn) error {
Expand Down Expand Up @@ -441,9 +420,6 @@ func (dp *DialProxy) sendProxyHeader(w io.Writer, src net.Conn) error {
// It's a named function instead of a func literal so users get
// named goroutines in debug goroutine stack dumps.
func proxyCopy(errc chan<- error, dst, src net.Conn) {
defer closeRead(src)
defer closeWrite(dst)

// Before we unwrap src and/or dst, copy any buffered data.
if wc, ok := src.(*Conn); ok && len(wc.Peeked) > 0 {
if _, err := dst.Write(wc.Peeked); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ github.com/google/go-cmp/cmp/internal/value
## explicit; go 1.12
github.com/google/gopacket
github.com/google/gopacket/layers
# github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c
## explicit; go 1.16
github.com/inetaf/tcpproxy
# github.com/insomniacslk/dhcp v0.0.0-20240710054256-ddd8a41251c9
## explicit; go 1.20
github.com/insomniacslk/dhcp/dhcpv4
Expand Down Expand Up @@ -272,3 +269,7 @@ gvisor.dev/gvisor/pkg/tcpip/transport/tcp
gvisor.dev/gvisor/pkg/tcpip/transport/tcpconntrack
gvisor.dev/gvisor/pkg/tcpip/transport/udp
gvisor.dev/gvisor/pkg/waiter
# inet.af/tcpproxy v0.0.0-20220326234310-be3ee21c9fa0 => github.com/inetaf/tcpproxy v0.0.0-20221017015627-91f861402626
## explicit; go 1.16
inet.af/tcpproxy
# inet.af/tcpproxy => github.com/inetaf/tcpproxy v0.0.0-20221017015627-91f861402626
Loading