-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
56 lines (51 loc) · 1.18 KB
/
index.html
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Proxy Detect</title>
<style>
body {
font-family: monospace;
}
</style>
</head>
<body>
<h2>Proxy Detect (TCP Win)</h2>
<div>
status: <span id="textProxy">...</span>
</div>
<script>
var buf = new Uint8Array(1024)
host = window.location.host;
var ws = new WebSocket("ws://" + host + "/echo")
console.log('connecting...')
var tid
ws.onopen = function() {
console.log('onopen')
}
ws.onmessage = function(e) {
console.log('onmessage. recv: %d bytes', e.data.length)
// console.log('start write:', performance.now())
// tid = setInterval(trace, 1)
for (let i = 0; i < 1024; i++) {
send()
}
setTimeout(function() {
textProxy.textContent = !ws.bufferedAmount
}, 1000)
}
ws.onclose = function() {
console.log('onclose')
// trace()
clearInterval(tid)
}
ws.onerror = function() {
console.log('onerror')
}
function send() {
ws.send(buf)
}
</script>
</body>
</html>