Exemplo n.º 1
0
func main() {
	q := pqueue.New(0)
	q.Enqueue(&Task{"one", 10})
	q.Enqueue(&Task{"two", 2})
	q.Enqueue(&Task{"three", 5})
	q.Enqueue(&Task{"four", 7})

	for i := 0; i < 4; i += 1 {
		task := q.Dequeue()
		println(task.(*Task).Name)
	}
}
Exemplo n.º 2
0
func New(report_dir string) (c *Crawler, err error) {

	salts_needed := bloom.SaltsRequired(100000, 0.001)
	salts := make([]uint32, salts_needed)
	for i := uint(0); i < salts_needed; i++ {
		salts[i] = rand.Uint32()
	}

	b := bloom.NewBloomFilter(100000, 0.001, fnv.New32(), salts)

	c = &Crawler{
		report_dir: report_dir,
		domains:    make(map[string]bool),
		queue:      pqueue.New(0),
		known:      b,
		reporters:  make([]Reporter, 0),
	}
	return
}