This commit is contained in:
Jason
2020-08-31 03:00:31 +08:00
parent 945daa2ee6
commit f5dbf4289a
2 changed files with 11 additions and 13 deletions

View File

@@ -18,11 +18,15 @@ var (
hijackDNS []string
)
// Register Monitor
func RegisterMonitor(m S.Monitor) {
monitor = m
}
func RegisterFakeDNS(d D.FakeDNS, h string) {
fakeDNS = d
hijackDNS = append(hijackDNS, strings.Split(h, ",")...)
}
// Session Operation
func addSession(key interface{}, session *S.Session) {
if monitor != nil {
@@ -36,12 +40,6 @@ func removeSession(key interface{}) {
}
}
// Register FakeDNS
func RegisterFakeDNS(d D.FakeDNS, h string) {
fakeDNS = d
hijackDNS = append(hijackDNS, strings.Split(h, ",")...)
}
// Check target if is hijacked address.
func isHijacked(target *net.UDPAddr) bool {
if fakeDNS == nil {