summaryrefslogtreecommitdiffstats
path: root/pattern-specifications.md
blob: 34ede3726a96eadef6e08f82ccfffa9b026361e6 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# pseudo-code for proxy selection

## Suppose we have 6 proxy definitions + Default:

### Proxy foo1
  a. http proxy on 123.123.123.123:8080
	b. username/password auth
  b. whitelist pattern "*.google.com"
	c. blacklist pattern "foo.google.com"

### Proxy foo2
  a. socks proxy on 999.999.99.999:1080
	b. username/password auth
	c. whitelist pattern "*.facebook.com"

### Proxy foo3
  a. PAC at https://192.168.1.1/proxy.pac
	b. no username/password auth
	c. whitelist pattern "*.internalstuffs.zzz"   (intranet address)

### Proxy foo4
  a. PAC at https://192.168.1.2/proxy.pac
  b no username/password auth
  c. whitelist pattern "*.internalstuffs.yyy"   (intranet address)

### Proxy foo5
  a. System settings
  b. no username/password auth (no applicable for system settings anyway)
  c. whitelist pattern "*.bar.com"

### Proxy foo6
  a. WPAD (auto-detect, not supported by Firefox proxyAPI right now)
	b. no username/password auth (no applicable for system settings anyway)
  c. whitelist pattern "*.bar.com"

### Default
  a. Set to DIRECT (no proxy)
	b. no username/password auth
	c. no patterns -- not supported by FoxyProxy

## User sets mode to "patterns"


### Suppose URL about to be loaded by browser is https://www.google.com/

http proxy on 123.123.123.123:8080 is used to load the URL

```const proxySettings = {
  proxyType: "manual",
  http: "http://123.123.123.123:8080",
  httpProxyAll: true,
	autoLogin: true
};
proxy.settings.set(proxySettings)```

### Suppose URL about to be loaded by browser is https://foo.google.com/

This matches the blacklist pattern in proxy `foo1`. Blacklist patterns take precedence
over whitelist patterns. So `foo1` is not used to load this URL. The other proxy patterns
are checked. None match, so `Default` is used.

```const proxySettings = {
  proxyType: "none",
	autoLogin: true,
	httpProxyAll: true // I don't know if this is necessary but cannot hurt
};
proxy.settings.set(proxySettings)```

### Suppose URL about to be loaded by browser is https://www.facebook.com/index.html

socks proxy on 999.999.99.999:1080 is used to load the URL

### Suppose URL about to be loaded by browser is https://internalstuffs.zzz/payroll/my-paycheck.pdf

https://192.168.1.1/proxy.pac is used to load the URL. FoxyProxy doesn't know what this PAC
is doing. Maybe it has its own URL pattern matching, maybe not. Does not matter.

```const proxySettings = {
  autoConfigUrl: pacUrl that user specified
	autoLogin: true,
	httpProxyAll: true // I don't know if this is necessary but cannot hurt
};
proxy.settings.set(proxySettings)```