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

@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package ipv6
import (
"net"
"runtime"
"unsafe"
"golang.org/x/net/bpf"
@ -37,7 +38,7 @@ func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) {
return nil, err
}
if n != sizeofICMPv6Filter {
return nil, errOpNoSupport
return nil, errNotImplemented
}
return (*ICMPFilter)(unsafe.Pointer(&b[0])), nil
}
@ -54,10 +55,11 @@ func (so *sockOpt) getMTUInfo(c *socket.Conn) (*net.Interface, int, error) {
return nil, 0, err
}
if n != sizeofIPv6Mtuinfo {
return nil, 0, errOpNoSupport
return nil, 0, errNotImplemented
}
mi := (*ipv6Mtuinfo)(unsafe.Pointer(&b[0]))
if mi.Addr.Scope_id == 0 {
if mi.Addr.Scope_id == 0 || runtime.GOOS == "aix" {
// AIX kernel might return a wrong address.
return nil, int(mi.Mtu), nil
}
ifi, err := net.InterfaceByIndex(int(mi.Addr.Scope_id))
@ -74,7 +76,7 @@ func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) erro
case ssoTypeGroupReq:
return so.setGroupReq(c, ifi, grp)
default:
return errOpNoSupport
return errNotImplemented
}
}