1
0
Fork 0

Use h2c from x/net to handle h2c requests

Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
Julien Salleyron 2019-07-01 15:08:04 +02:00 committed by Traefiker Bot
parent c7d336f958
commit 4360ca14c1
224 changed files with 22414 additions and 11768 deletions

View file

@ -6,7 +6,6 @@ package ipv6
import (
"net"
"syscall"
"time"
"golang.org/x/net/internal/socket"
@ -34,11 +33,11 @@ func (c *genericOpt) ok() bool { return c != nil && c.Conn != nil }
// with the endpoint.
func (c *Conn) PathMTU() (int, error) {
if !c.ok() {
return 0, syscall.EINVAL
return 0, errInvalidConn
}
so, ok := sockOpts[ssoPathMTU]
if !ok {
return 0, errOpNoSupport
return 0, errNotImplemented
}
_, mtu, err := so.getMTUInfo(c.Conn)
if err != nil {
@ -76,7 +75,7 @@ func (c *dgramOpt) ok() bool { return c != nil && c.Conn != nil }
// socket options.
func (c *PacketConn) SetControlMessage(cf ControlFlags, on bool) error {
if !c.payloadHandler.ok() {
return syscall.EINVAL
return errInvalidConn
}
return setControlMessage(c.dgramOpt.Conn, &c.payloadHandler.rawOpt, cf, on)
}
@ -85,7 +84,7 @@ func (c *PacketConn) SetControlMessage(cf ControlFlags, on bool) error {
// endpoint.
func (c *PacketConn) SetDeadline(t time.Time) error {
if !c.payloadHandler.ok() {
return syscall.EINVAL
return errInvalidConn
}
return c.payloadHandler.SetDeadline(t)
}
@ -94,7 +93,7 @@ func (c *PacketConn) SetDeadline(t time.Time) error {
// endpoint.
func (c *PacketConn) SetReadDeadline(t time.Time) error {
if !c.payloadHandler.ok() {
return syscall.EINVAL
return errInvalidConn
}
return c.payloadHandler.SetReadDeadline(t)
}
@ -103,7 +102,7 @@ func (c *PacketConn) SetReadDeadline(t time.Time) error {
// endpoint.
func (c *PacketConn) SetWriteDeadline(t time.Time) error {
if !c.payloadHandler.ok() {
return syscall.EINVAL
return errInvalidConn
}
return c.payloadHandler.SetWriteDeadline(t)
}
@ -111,7 +110,7 @@ func (c *PacketConn) SetWriteDeadline(t time.Time) error {
// Close closes the endpoint.
func (c *PacketConn) Close() error {
if !c.payloadHandler.ok() {
return syscall.EINVAL
return errInvalidConn
}
return c.payloadHandler.Close()
}