MCPcopy
hub / github.com/txthinking/brook / NewDOHServer

Function NewDOHServer

dohserver.go:43–63  ·  view source on GitHub ↗
(addr, domain, path, to string, tcpTimeout, udpTimeout int)

Source from the content-addressed store, hash-verified

41}
42
43func NewDOHServer(addr, domain, path, to string, tcpTimeout, udpTimeout int) (*DOHServer, error) {
44 if err := limits.Raise(); err != nil {
45 Log(Error{"when": "try to raise system limits", "warning": err.Error()})
46 }
47 s := &DOHServer{
48 Addr: addr,
49 Domain: domain,
50 Path: path,
51 }
52 if !strings.HasPrefix(to, "https://") {
53 s.DNSClient = &DNSClient{Server: to}
54 }
55 if strings.HasPrefix(to, "https://") {
56 c, err := NewDOHClient(to)
57 if err != nil {
58 return nil, err
59 }
60 s.DOHClient = c
61 }
62 return s, nil
63}
64
65func (s *DOHServer) ListenAndServe() error {
66 r := mux.NewRouter()

Callers 1

mainFunction · 0.92

Calls 3

RaiseFunction · 0.92
NewDOHClientFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected