-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
25 lines (22 loc) · 846 Bytes
/
main.go
File metadata and controls
25 lines (22 loc) · 846 Bytes
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
package main
import (
"time"
"tls-dns-proxy/pkg/domain/proxy"
"tls-dns-proxy/pkg/gateway/cache"
"tls-dns-proxy/pkg/gateway/logger"
"tls-dns-proxy/pkg/gateway/resolver"
"tls-dns-proxy/pkg/helpers"
"tls-dns-proxy/pkg/presenter/socket"
)
func main() {
config := GetConfig()
stdCacheLogger := logger.NewSTDLogger("CACHE")
cache := cache.NewMemoryCache(time.Duration(config.CACHE_TLL)*time.Second, stdCacheLogger)
go cache.AutoPurge()
resolver := resolver.NewCloudFlareResolver("1.1.1.1", 853, config.RESOLVER_READ_TO)
parser := helpers.NewMsgParser()
stdProxyLogger := logger.NewSTDLogger("PROXY")
proxy := proxy.NewDNSProxy(resolver, parser, cache, stdProxyLogger)
go socket.StarUDPtServer(proxy, config.UDP_PORT, "0.0.0.0")
socket.StartTCPServer(proxy, config.TCP_PORT, "0.0.0.0", config.TCP_DIRECT, config.TCP_MAX_CONN_POOL)
}