diff options
author | zeripath <art27@cantab.net> | 2021-04-05 22:38:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 17:38:31 -0400 |
commit | 04196b7658d70a1dee22a25aeb26e3d1587c316f (patch) | |
tree | 9095331975714251797154d069ca01ead6f60999 /vendor/golang.org | |
parent | e10d028b039af5d63ef29f4c33fb04029da3d5a8 (diff) | |
download | gitea-04196b7658d70a1dee22a25aeb26e3d1587c316f.tar.gz gitea-04196b7658d70a1dee22a25aeb26e3d1587c316f.zip |
Update to bluemonday-1.0.6 (#15294)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'vendor/golang.org')
-rw-r--r-- | vendor/golang.org/x/net/internal/socket/rawconn.go | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/vendor/golang.org/x/net/internal/socket/rawconn.go b/vendor/golang.org/x/net/internal/socket/rawconn.go index b07b890050..87e81071c1 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn.go @@ -17,18 +17,45 @@ type Conn struct { c syscall.RawConn } +// tcpConn is an interface implemented by net.TCPConn. +// It can be used for interface assertions to check if a net.Conn is a TCP connection. +type tcpConn interface { + SyscallConn() (syscall.RawConn, error) + SetLinger(int) error +} + +var _ tcpConn = (*net.TCPConn)(nil) + +// udpConn is an interface implemented by net.UDPConn. +// It can be used for interface assertions to check if a net.Conn is a UDP connection. +type udpConn interface { + SyscallConn() (syscall.RawConn, error) + ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *net.UDPAddr, err error) +} + +var _ udpConn = (*net.UDPConn)(nil) + +// ipConn is an interface implemented by net.IPConn. +// It can be used for interface assertions to check if a net.Conn is an IP connection. +type ipConn interface { + SyscallConn() (syscall.RawConn, error) + ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *net.IPAddr, err error) +} + +var _ ipConn = (*net.IPConn)(nil) + // NewConn returns a new raw connection. func NewConn(c net.Conn) (*Conn, error) { var err error var cc Conn switch c := c.(type) { - case *net.TCPConn: + case tcpConn: cc.network = "tcp" cc.c, err = c.SyscallConn() - case *net.UDPConn: + case udpConn: cc.network = "udp" cc.c, err = c.SyscallConn() - case *net.IPConn: + case ipConn: cc.network = "ip" cc.c, err = c.SyscallConn() default: |