Unverified Commit 681f967f authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #16 from libp2p/fix/no-cgo

fix: build without CGO
parents 52957a02 d15798c5
module github.com/libp2p/go-sockaddr
require golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e
go 1.13
package sockaddr
import (
"unsafe"
sockaddrnet "github.com/libp2p/go-sockaddr/net"
)
import "C"
// Socklen is a type for the length of a sockaddr.
type Socklen uint
......@@ -22,13 +18,3 @@ func SockaddrToAny(sa sockaddrnet.Sockaddr) (*sockaddrnet.RawSockaddrAny, Sockle
func AnyToSockaddr(rsa *sockaddrnet.RawSockaddrAny) (sockaddrnet.Sockaddr, error) {
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