瀏覽代碼

bpf: add Setter interface

This interface can be implemented by types which are capable of
attaching compiled BPF filters to themselves, such as
x/net/ipv{4,6}.PacketConn.

Fixes golang/go#19912

Change-Id: I4674c3e312c173d5a7a3beb3cd53704f8c08e29b
Reviewed-on: https://go-review.googlesource.com/44972
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Matt Layher 8 年之前
父節點
當前提交
9c9a3f3e9f
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      bpf/setter.go

+ 10 - 0
bpf/setter.go

@@ -0,0 +1,10 @@
+// Copyright 2017 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 bpf
+
+// A Setter is a type which can attach a compiled BPF filter to itself.
+type Setter interface {
+	SetBPF(filter []RawInstruction) error
+}