simplify connection handling for the client

This commit is contained in:
Marten Seemann
2023-04-25 13:48:57 +02:00
parent 7a0ef5f867
commit 5544f0f9a1
5 changed files with 34 additions and 70 deletions

View File

@@ -22,7 +22,7 @@ type sconn struct {
var _ sendConn = &sconn{}
func newSendConn(c rawConn, remote net.Addr, info *packetInfo) sendConn {
func newSendConn(c rawConn, remote net.Addr, info *packetInfo) *sconn {
return &sconn{
rawConn: c,
remoteAddr: remote,
@@ -51,24 +51,3 @@ func (c *sconn) LocalAddr() net.Addr {
}
return addr
}
type spconn struct {
net.PacketConn
remoteAddr net.Addr
}
var _ sendConn = &spconn{}
func newSendPconn(c net.PacketConn, remote net.Addr) sendConn {
return &spconn{PacketConn: c, remoteAddr: remote}
}
func (c *spconn) Write(p []byte) error {
_, err := c.WriteTo(p, c.remoteAddr)
return err
}
func (c *spconn) RemoteAddr() net.Addr {
return c.remoteAddr
}