コード例 #1
0
ファイル: tcp_test.go プロジェクト: jarpy/beats
func init() {
	new := func(_ bool, _ publish.Transactions, _ *ucfg.Config) (protos.Plugin, error) {
		return &TestProtocol{}, nil
	}

	protos.Register("httpTest", new)
	protos.Register("mysqlTest", new)
	protos.Register("redisTest", new)

	httpProtocol = protos.Lookup("httpTest")
	redisProtocol = protos.Lookup("redisTest")
	mysqlProtocol = protos.Lookup("mysqlTest")
}
コード例 #2
0
ファイル: udp_test.go プロジェクト: ChongFeng/beats
	// import plugins for testing
	_ "github.com/elastic/beats/packetbeat/protos/http"
	_ "github.com/elastic/beats/packetbeat/protos/mysql"
	_ "github.com/elastic/beats/packetbeat/protos/redis"

	"github.com/stretchr/testify/assert"
)

// Protocol ID and port number used by TestProtocol in various tests.
const (
	PROTO = protos.Protocol(1)
	PORT  = 1234
)

var (
	httpProtocol  = protos.Lookup("http")
	mysqlProtocol = protos.Lookup("mysql")
	redisProtocol = protos.Lookup("redis")
)

type TestProtocols struct {
	udp map[protos.Protocol]protos.UdpPlugin
}

func (p TestProtocols) BpfFilter(with_vlans bool, with_icmp bool) string {
	return "mock bpf filter"
}

func (p TestProtocols) GetTcp(proto protos.Protocol) protos.TcpPlugin {
	return nil
}