mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Vendor dependencies
This commit is contained in:
committed by
Zlatko Čalušić
parent
2f0a16d8b7
commit
6054876201
37
vendor/golang.org/x/net/internal/netreflect/socket.go
generated
vendored
Normal file
37
vendor/golang.org/x/net/internal/netreflect/socket.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package netreflect implements run-time reflection for the
|
||||
// facilities of net package.
|
||||
package netreflect
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidType = errors.New("invalid type")
|
||||
errOpNoSupport = errors.New("operation not supported")
|
||||
)
|
||||
|
||||
// SocketOf returns the socket descriptor of c.
|
||||
func SocketOf(c net.Conn) (uintptr, error) {
|
||||
switch c.(type) {
|
||||
case *net.TCPConn, *net.UDPConn, *net.IPConn, *net.UnixConn:
|
||||
return socketOf(c)
|
||||
default:
|
||||
return 0, errInvalidType
|
||||
}
|
||||
}
|
||||
|
||||
// PacketSocketOf returns the socket descriptor of c.
|
||||
func PacketSocketOf(c net.PacketConn) (uintptr, error) {
|
||||
switch c.(type) {
|
||||
case *net.UDPConn, *net.IPConn, *net.UnixConn:
|
||||
return socketOf(c.(net.Conn))
|
||||
default:
|
||||
return 0, errInvalidType
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user