当前位置: 首页>>代码示例>>Golang>>正文


Golang syscall.Getsockopt函数代码示例

本文整理汇总了Golang中syscall.Getsockopt函数的典型用法代码示例。如果您正苦于以下问题:Golang Getsockopt函数的具体用法?Golang Getsockopt怎么用?Golang Getsockopt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Getsockopt函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ipv6MulticastLoopback

func ipv6MulticastLoopback(fd syscall.Handle) (bool, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, int32(ianaProtocolIPv6), int32(syscall.IPV6_MULTICAST_LOOP), (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return false, os.NewSyscallError("getsockopt", err)
	}
	return v == 1, nil
}
开发者ID:rocksolidlabs,项目名称:go.net,代码行数:8,代码来源:sockopt_rfc3493_windows.go

示例2: ipv6MulticastHopLimit

func ipv6MulticastHopLimit(fd syscall.Handle) (int, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, int32(ianaProtocolIPv6), int32(syscall.IPV6_MULTICAST_HOPS), (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(v), nil
}
开发者ID:rocksolidlabs,项目名称:go.net,代码行数:8,代码来源:sockopt_rfc3493_windows.go

示例3: ipv6HopLimit

func ipv6HopLimit(fd syscall.Handle) (int, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, ianaProtocolIPv6, sysSockoptUnicastHopLimit, (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(v), nil
}
开发者ID:Juraldinio,项目名称:vole,代码行数:8,代码来源:sockopt_rfc3493_windows.go

示例4: ipv4MulticastInterface

func ipv4MulticastInterface(fd syscall.Handle) (*net.Interface, error) {
	var v [4]byte
	l := int32(4)
	if err := syscall.Getsockopt(fd, ianaProtocolIP, syscall.IP_MULTICAST_IF, (*byte)(unsafe.Pointer(&v[0])), &l); err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	return netIP4ToInterface(net.IPv4(v[0], v[1], v[2], v[3]))
}
开发者ID:98pm,项目名称:docker,代码行数:8,代码来源:sockopt_windows.go

示例5: ipv4MulticastTTL

func ipv4MulticastTTL(fd syscall.Handle) (int, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, ianaProtocolIP, syscall.IP_MULTICAST_TTL, (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(v), nil
}
开发者ID:98pm,项目名称:docker,代码行数:8,代码来源:sockopt_windows.go

示例6: ipv4MulticastLoopback

func ipv4MulticastLoopback(fd syscall.Handle) (bool, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, ianaProtocolIP, sysSockoptMulticastLoopback, (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return false, os.NewSyscallError("getsockopt", err)
	}
	return v == 1, nil
}
开发者ID:Christopheraburns,项目名称:clive,代码行数:8,代码来源:sockopt_windows.go

示例7: ipv4TOS

func ipv4TOS(fd syscall.Handle) (int, error) {
	var v int32
	l := int32(4)
	err := syscall.Getsockopt(fd, ianaProtocolIP, syscall.IP_TOS, (*byte)(unsafe.Pointer(&v)), &l)
	if err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(v), nil
}
开发者ID:rocksolidlabs,项目名称:go.net,代码行数:9,代码来源:sockopt_windows.go

示例8: ipv4TTL

func ipv4TTL(fd syscall.Handle) (int, error) {
	var v int32
	l := int32(4)
	err := syscall.Getsockopt(fd, int32(syscall.IPPROTO_IP), int32(syscall.IP_TTL), (*byte)(unsafe.Pointer(&v)), &l)
	if err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(v), nil
}
开发者ID:Bobberino,项目名称:musings,代码行数:9,代码来源:sockopt_windows.go

示例9: ipv4MulticastInterface

func ipv4MulticastInterface(fd syscall.Handle) (*net.Interface, error) {
	var a [4]byte
	l := int32(4)
	err := syscall.Getsockopt(fd, int32(syscall.IPPROTO_IP), int32(syscall.IP_MULTICAST_IF), (*byte)(unsafe.Pointer(&a[0])), &l)
	if err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	return netIP4ToInterface(net.IPv4(a[0], a[1], a[2], a[3]))
}
开发者ID:Bobberino,项目名称:musings,代码行数:9,代码来源:sockopt_windows.go

示例10: getInt

func getInt(fd syscall.Handle, opt *sockOpt) (int, error) {
	if opt.name < 1 || opt.typ != ssoTypeInt {
		return 0, errOpNoSupport
	}
	var i int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, iana.ProtocolIP, int32(opt.name), (*byte)(unsafe.Pointer(&i)), &l); err != nil {
		return 0, os.NewSyscallError("getsockopt", err)
	}
	return int(i), nil
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:11,代码来源:sockopt_windows.go

示例11: ipv6MulticastInterface

func ipv6MulticastInterface(fd syscall.Handle) (*net.Interface, error) {
	var v int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, int32(ianaProtocolIPv6), int32(syscall.IPV6_MULTICAST_IF), (*byte)(unsafe.Pointer(&v)), &l); err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	if v == 0 {
		return nil, nil
	}
	ifi, err := net.InterfaceByIndex(int(v))
	if err != nil {
		return nil, err
	}
	return ifi, nil
}
开发者ID:rocksolidlabs,项目名称:go.net,代码行数:15,代码来源:sockopt_rfc3493_windows.go

示例12: getInterface

func getInterface(fd syscall.Handle, opt *sockOpt) (*net.Interface, error) {
	if opt.name < 1 || opt.typ != ssoTypeInterface {
		return nil, errOpNoSupport
	}
	var i int32
	l := int32(4)
	if err := syscall.Getsockopt(fd, int32(opt.level), int32(opt.name), (*byte)(unsafe.Pointer(&i)), &l); err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	if i == 0 {
		return nil, nil
	}
	ifi, err := net.InterfaceByIndex(int(i))
	if err != nil {
		return nil, err
	}
	return ifi, nil
}
开发者ID:xunmengfeng,项目名称:patchwork,代码行数:18,代码来源:sockopt_windows.go

示例13: getsockopt

func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error {
	return syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(v), (*int32)(unsafe.Pointer(l)))
}
开发者ID:Requilence,项目名称:integram,代码行数:3,代码来源:syscall_windows.go


注:本文中的syscall.Getsockopt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。