-
Notifications
You must be signed in to change notification settings - Fork 8
/
nntp.go
45 lines (39 loc) · 976 Bytes
/
nntp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"time"
"github.com/Tensai75/nntpPool"
)
var (
pool nntpPool.ConnectionPool
)
func initNntpPool() error {
var err error
go func() {
for {
select {
case v := <-nntpPool.LogChan:
Log.Info("NNTPPool%v\n", v)
case w := <-nntpPool.WarnChan:
Log.Warn("NNTPPool%v\n", w.Error())
}
}
}()
pool, err = nntpPool.New(&nntpPool.Config{
Name: "",
Host: conf.Directsearch.Host,
Port: uint32(conf.Directsearch.Port),
SSL: conf.Directsearch.SSL,
SkipSSLCheck: true,
User: conf.Directsearch.Username,
Pass: conf.Directsearch.Password,
ConnWaitTime: time.Duration(10) * time.Second,
MaxConns: uint32(conf.Directsearch.Connections),
IdleTimeout: 30 * time.Second,
MaxConnErrors: 3,
MaxTooManyConnsErrors: 3,
}, 0)
if err != nil {
return err
}
return nil
}