projectdiscovery / fastdialer

Dialer with DNS Cache + Dial History

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple stderr messages with current date and path

michael1026 opened this issue · comments

Hello,

I found that when I try using this library in my own projects, my stderr gets flooded with multiple messages. I'm unsure if I'm doing something wrong to cause these errors messages, but no error seems to be returned during initialization and everything runs fine.

stderr

2021/06/12 01:36:09 /tmp/hm928258121
2021/06/12 01:36:09 /tmp/hm341994260
2021/06/12 01:36:09 /tmp/hm957686115
2021/06/12 01:36:09 /tmp/hm497662310
2021/06/12 01:36:09 /tmp/hm236611981
2021/06/12 01:36:09 /tmp/hm279069576
2021/06/12 01:36:09 /tmp/hm406964039
2021/06/12 01:36:09 /tmp/hm423496186
2021/06/12 01:36:09 /tmp/hm279549201
2021/06/12 01:36:09 /tmp/hm890850108
2021/06/12 01:36:09 /tmp/hm536011627
2021/06/12 01:36:09 /tmp/hm160537038

How I use fastdialer

func buildHttpClient() (c *http.Client) {
	fastdialerOpts := fastdialer.DefaultOptions
	fastdialerOpts.EnableFallback = true
	dialer, err := fastdialer.NewDialer(fastdialerOpts)
	if err != nil {
		fmt.Printf("Error initializing dialer: %s\n", err)
		return
	}

	transport := &http.Transport{
		MaxIdleConns:      -1,
		IdleConnTimeout:   time.Second,
		TLSClientConfig:   &tls.Config{InsecureSkipVerify: true},
		DisableKeepAlives: true,
		DialContext:       dialer.Dial,
	}

	re := func(req *http.Request, via []*http.Request) error {
		return http.ErrUseLastResponse
	}

	client := &http.Client{
		Transport:     transport,
		CheckRedirect: re,
		Timeout:       time.Second * 10,
	}

	return client
}

I should note, this only happens when using fastdialer. I switched over a couple of projects to use the library and had these messages pop up on all of them.

@michael1026 Thanks for reporting this! Looks like I'm the one to blame as I forgot to remove this instruction used while debugging locally https://github.com/projectdiscovery/hmap/blob/5587bf39705c37b2ba9ec1e6612b549189bbb71e/store/hybrid/hybrid.go#L94

It should be fixed in PR #15

Thanks :)