summaryrefslogtreecommitdiff
path: root/core/src/main/java/de/danoeh/antennapod/core/service/download/ProxyConfig.java
blob: 0d59a1b7e3679f722138649da6ee7d99e6973ffb (plain)
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
package de.danoeh.antennapod.core.service.download;

import androidx.annotation.Nullable;

import java.net.Proxy;

public class ProxyConfig {

    public final Proxy.Type type;
    @Nullable public final String host;
    public final int port;
    @Nullable public final String username;
    @Nullable public final String password;

    public static final int DEFAULT_PORT = 8080;

    public static ProxyConfig direct() {
        return new ProxyConfig(Proxy.Type.DIRECT, null, 0, null, null);
    }

    public static ProxyConfig http(String host, int port, String username, String password) {
        return new ProxyConfig(Proxy.Type.HTTP, host, port, username, password);
    }

    public static ProxyConfig socks(String host, int port, String username, String password) {
        return new ProxyConfig(Proxy.Type.SOCKS, host, port, username, password);
    }

    public ProxyConfig(Proxy.Type type, String host, int port, String username, String password) {
        this.type = type;
        this.host = host;
        this.port = port;
        this.username = username;
        this.password = password;
    }
}