示例#1
0
func initClamAV() *clamav.Engine {
	engine := clamav.New()
	sigs, err := engine.Load(clamav.DBDir(), clamav.DbStdopt)
	if err != nil {
		log.Fatalf("can not initialize ClamAV engine: %v", err)
	}
	if *debug {
		log.Printf("loaded %d signatures", sigs)
	}
	engine.Compile()

	return engine
}
示例#2
0
文件: main.go 项目: wxdublin/clamav
func initClamAV() *clamav.Engine {
	clamav.Init(clamav.InitDefault)
	engine := clamav.New()
	sigs, err := engine.Load(*db, clamav.DbStdopt)
	if err != nil {
		log.Fatalf("can not initialize ClamAV engine: %v", err)
	}
	if *debug {
		log.Printf("loaded %d signatures", sigs)
	}

	engine.SetPreCacheCallback(PreCacheCb)
	engine.SetPreScanCallback(PreScanCb)
	engine.SetPostScanCallback(PostScanCb)
	engine.SetHashCallback(HashCb)

	engine.Compile()

	return engine
}