SmokeProxy.kt 1.88 KB
Newer Older
Daniel Wolf's avatar
Daniel Wolf committed
1
2
package com.frostnerd.smokescreen.util.proxy

3
import com.frostnerd.dnstunnelproxy.*
Daniel Wolf's avatar
Daniel Wolf committed
4
import com.frostnerd.dnstunnelproxy.QueryListener
Daniel Wolf's avatar
Daniel Wolf committed
5
import java.net.InetAddress
Daniel Wolf's avatar
Daniel Wolf committed
6

Daniel Wolf's avatar
Daniel Wolf committed
7
8
/*
 * Copyright (C) 2019 Daniel Wolf (Ch4t4r)
Daniel Wolf's avatar
Daniel Wolf committed
9
 *
Daniel Wolf's avatar
Daniel Wolf committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * You can contact the developer at daniel.wolf@frostnerd.com.
Daniel Wolf's avatar
Daniel Wolf committed
24
25
 */

26
class SmokeProxy(
Daniel Wolf's avatar
Daniel Wolf committed
27
    dnsHandle: DnsHandle,
28
    proxyBypassHandles: List<DnsHandle>,
29
    val cache: SimpleDnsCache?,
30
31
    queryListener: QueryListener?,
    localResolver: LocalResolver?
32
) :
33
    DnsPacketProxy(
34
        proxyBypassHandles.toMutableList().let {
35
36
37
            it.add(dnsHandle)
            it
        }.toList(),
Daniel Wolf's avatar
Daniel Wolf committed
38
        null,
39
        cache,
40
41
        queryListener = queryListener,
        localResolver = localResolver
Daniel Wolf's avatar
Daniel Wolf committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    )

class NonIPSmokeProxy(
    dnsHandle: DnsHandle,
    proxyBypassHandles: List<DnsHandle>,
    val cache: SimpleDnsCache?,
    queryListener: QueryListener?,
    localResolver: LocalResolver?,
    bindAddress:InetAddress,
    bindPort:Int
) :
    NonIPDnsPacketProxy(
        proxyBypassHandles.toMutableList().let {
            it.add(dnsHandle)
            it
        }.toList(),
        null,
        cache,
        queryListener = queryListener,
        localResolver = localResolver,
        localAddress = bindAddress,
        localPort = bindPort
Daniel Wolf's avatar
Daniel Wolf committed
64
    )