Esempio n. 1
0
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")
}
Esempio n. 2
0
	// 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
}