capture: disable without cgo

This commit is contained in:
Johannes Kimmel 2023-03-07 01:10:18 +01:00
parent 20a248af16
commit 6836779a56
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,5 @@
//go:build cgo
package capture
import (

16
capture/netgo.go Normal file
View File

@ -0,0 +1,16 @@
//go:build !cgo
package capture
import "fmt"
import "inet.af/netaddr"
type nullReaderFromCloser interface {
ReadFrom(b []byte) (body []byte, src netaddr.IP, ifindex int, err error)
Close() error
}
func FromInterface(string) (nullReaderFromCloser, error) {
return nil, fmt.Errorf("packet capture disabled")
}