Commit d15798c5 authored by Steven Allen's avatar Steven Allen

fix: build without CGO

parent 52957a02
module github.com/libp2p/go-sockaddr module github.com/libp2p/go-sockaddr
require golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e require golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e
go 1.13
package sockaddr package sockaddr
import ( import (
"unsafe"
sockaddrnet "github.com/libp2p/go-sockaddr/net" sockaddrnet "github.com/libp2p/go-sockaddr/net"
) )
import "C"
// Socklen is a type for the length of a sockaddr. // Socklen is a type for the length of a sockaddr.
type Socklen uint type Socklen uint
...@@ -22,13 +18,3 @@ func SockaddrToAny(sa sockaddrnet.Sockaddr) (*sockaddrnet.RawSockaddrAny, Sockle ...@@ -22,13 +18,3 @@ func SockaddrToAny(sa sockaddrnet.Sockaddr) (*sockaddrnet.RawSockaddrAny, Sockle
func AnyToSockaddr(rsa *sockaddrnet.RawSockaddrAny) (sockaddrnet.Sockaddr, error) { func AnyToSockaddr(rsa *sockaddrnet.RawSockaddrAny) (sockaddrnet.Sockaddr, error) {
return anyToSockaddr(rsa) return anyToSockaddr(rsa)
} }
// AnyToCAny casts a *RawSockaddrAny to a *C.struct_sockaddr_any
func AnyToCAny(a *sockaddrnet.RawSockaddrAny) *C.struct_sockaddr_any {
return (*C.struct_sockaddr_any)(unsafe.Pointer(a))
}
// CAnyToAny casts a *C.struct_sockaddr_any to a *RawSockaddrAny
func CAnyToAny(a *C.struct_sockaddr_any) *sockaddrnet.RawSockaddrAny {
return (*sockaddrnet.RawSockaddrAny)(unsafe.Pointer(a))
}
package sockaddr
import (
"C"
"unsafe"
sockaddrnet "github.com/libp2p/go-sockaddr/net"
)
// AnyToCAny casts a *RawSockaddrAny to a *C.struct_sockaddr_any
func AnyToCAny(a *sockaddrnet.RawSockaddrAny) *C.struct_sockaddr_any {
return (*C.struct_sockaddr_any)(unsafe.Pointer(a))
}
// CAnyToAny casts a *C.struct_sockaddr_any to a *RawSockaddrAny
func CAnyToAny(a *C.struct_sockaddr_any) *sockaddrnet.RawSockaddrAny {
return (*sockaddrnet.RawSockaddrAny)(unsafe.Pointer(a))
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment