Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .devcontainer/http-proxy-test/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"dependsOn": [
"npm: pac-server:run",
"npm: proxy-1:access-log",
"npm: proxy-2:access-log"
],
"group": {
"kind": "build",
"isDefault": true
},
"runOptions": {
"runOn": "folderOpen"
}
},
{
"type": "npm",
"script": "pac-server:run",
"group": "build",
"isBackground": true,
"label": "npm: pac-server:run",
"presentation": {
"group": "watch"
}
},
{
"type": "npm",
"script": "proxy-1:access-log",
"group": "build",
"isBackground": true,
"label": "npm: proxy-1:access-log",
"presentation": {
"group": "watch"
}
},
{
"type": "npm",
"script": "proxy-2:access-log",
"group": "build",
"isBackground": true,
"label": "npm: proxy-2:access-log",
"presentation": {
"group": "watch"
}
}
]
}
16 changes: 16 additions & 0 deletions .devcontainer/http-proxy-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## HTTP Proxy Test

Use this dev container configuration with a different VS Code install than you want to test (e.g., use VS Code stable if you want to test VS Code Insiders).
- `Dev Containers: Reopen in Container` > `HTTP Proxy Test`.
- The dev container should show 3 log terminals: 1 for the proxy config (PAC), 2 for 2 proxies (no authentication).
- Locally start VS Code to test with the PAC file's URL, e.g.: `code-insiders --proxy-pac-url=http://localhost:4444`.
- Connections to *.github.com go through 127.0.0.1:3144.
- Connections to *.githubcopilot.com go through 127.0.0.1:3144.
- All other connections go through 127.0.0.1:3155.
- Install GitHub Copilot Chat and use `Developer: GitHub Copilot Chat Diagnostics` to test connections.
- Verify in the log terminals of the dev container that the PAC file and the proxies are being used.

Optional (from other test passes):
- To further check extension support install https://marketplace.visualstudio.com/items?itemName=chrmarti.network-proxy-test.
- Update `test.pac` to apply the proxies to different domains, e.g., `https://example.com` and `https://marketplace.visualstudio.com`.
- Use `Network Proxy Test: Test Network Connection` to test.
9 changes: 9 additions & 0 deletions .devcontainer/http-proxy-test/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "1.5.0",
"resolved": "ghcr.io/devcontainers/features/docker-outside-of-docker@sha256:20761bd733511c1995ee955682cc2778b0a2e556abf88e9b88490c3be3c80bbc",
"integrity": "sha256:20761bd733511c1995ee955682cc2778b0a2e556abf88e9b88490c3be3c80bbc"
}
}
}
10 changes: 10 additions & 0 deletions .devcontainer/http-proxy-test/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "HTTP Proxy Test",
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/.devcontainer/http-proxy-test",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"overrideCommand": true
}
23 changes: 23 additions & 0 deletions .devcontainer/http-proxy-test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3.4'

services:
devcontainer:
image: mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm
volumes:
- ../../..:/workspaces
ports:
- "127.0.0.1:4444:4444"
http-proxy-1:
restart: always
build:
context: http-proxy
dockerfile: Dockerfile
ports:
- "127.0.0.1:3144:3128"
http-proxy-2:
restart: always
build:
context: http-proxy
dockerfile: Dockerfile
ports:
- "127.0.0.1:3155:3128"
4 changes: 4 additions & 0 deletions .devcontainer/http-proxy-test/http-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ubuntu/squid:latest

COPY open.conf /etc/squid/conf.d/squid.acl.conf
RUN sed -e '/^http_access/ s/^#*/#/' -i /etc/squid/conf.d/debian.conf
1 change: 1 addition & 0 deletions .devcontainer/http-proxy-test/http-proxy/open.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http_access allow all
21 changes: 21 additions & 0 deletions .devcontainer/http-proxy-test/pac-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const http = require('http');
const fs = require('fs');
const path = require('path');

const server = http.createServer((req, res) => {
console.log('Sending pac file...');
const filePath = path.join(__dirname, 'test.pac');
const stat = fs.statSync(filePath);

res.writeHead(200, {
'Content-Type': 'application/x-ns-proxy-autoconfig',
'Content-Length': stat.size
});

const readStream = fs.createReadStream(filePath);
readStream.pipe(res);
});

server.listen(4444, () => {
console.log('Server is running on port 4444');
});
7 changes: 7 additions & 0 deletions .devcontainer/http-proxy-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"scripts": {
"pac-server:run": "node pac-server.js",
"proxy-1:access-log": "while true; do docker exec -it http-proxy-test-http-proxy-1-1 tail -F /var/log/squid/access.log ; sleep 1 ; done",
"proxy-2:access-log": "while true; do docker exec -it http-proxy-test-http-proxy-2-1 tail -F /var/log/squid/access.log ; sleep 1 ; done"
}
}
7 changes: 7 additions & 0 deletions .devcontainer/http-proxy-test/test.pac
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, "github.com"))
return "PROXY 127.0.0.1:3144";
if (dnsDomainIs(host, "githubcopilot.com"))
return "PROXY 127.0.0.1:3144";
return "PROXY 127.0.0.1:3155";
}
Loading