func (p *packetConn) SetBPF(filter []bpf.RawInstruction) error {
	prog := unix.SockFprog{
		Len:    uint16(len(filter)),
		Filter: (*unix.SockFilter)(unsafe.Pointer(&filter[0])),
	}

	err := p.s.SetSockoptSockFprog(
		unix.SOL_SOCKET,
		unix.SO_ATTACH_FILTER,
		&prog,
	)
	if err != nil {
		return os.NewSyscallError("setsockopt", err)
	}
	return nil
}
// SetBPF attaches an assembled BPF program to a raw net.PacketConn.
SetBPF attaches an assembled BPF program to a raw net.PacketConn.
// SetBPF attaches an assembled BPF program to a raw net . PacketConn .
func (p *packetConn) SetBPF(filter []bpf.RawInstruction) error {
	prog := unix.SockFprog{
		Len:    uint16(len(filter)),
		Filter: (*unix.SockFilter)(unsafe.Pointer(&filter[0])),
	}
	err := p.s.SetSockoptSockFprog(
		unix.SOL_SOCKET,
		unix.SO_ATTACH_FILTER,
		&prog,
	)
	if err != nil {
		return os.NewSyscallError("setsockopt", err)
	}
	return nil
}
func ( p * packetConn ) SetBPF ( filter [ ] bpf . RawInstruction ) error { prog := unix . SockFprog { Len : uint16 ( len ( filter ) ) , Filter : ( * unix . SockFilter ) ( unsafe . Pointer ( & filter [ 0 ] ) ) , } err := p . s . SetSockoptSockFprog ( unix . SOL_SOCKET , unix . SO_ATTACH_FILTER , & prog , ) if err != nil { return os . NewSyscallError ( " " , err ) } return nil }
SetBPF attaches an assembled BPF program to a raw net.PacketConn.
SetBPF attaches an assembled BPF program to a raw net . PacketConn .