Add proxy routing and sing-box support

This commit is contained in:
Fabian Freund
2026-05-22 18:16:31 +02:00
parent 51289f1266
commit a5974617aa
262 changed files with 32003 additions and 3962 deletions
@@ -1,4 +1,4 @@
import BackgroundMain, { doNotProxy } from '../../src/background/BackgroundMain'
import BackgroundMain, { doNotProxy, emergencyBreak } from '../../src/background/BackgroundMain'
import { Store } from '../../src/store/Store'
import { expect } from 'chai'
@@ -41,6 +41,16 @@ describe('BackgroundMain', function () {
expect(result).to.be.not.empty
})
it('should block if an assigned proxy no longer exists', async () => {
const isolatedStore = new Store()
const isolatedBackgroundMain = new BackgroundMain({ store: isolatedStore })
isolatedStore.setContainerProxyRelation('general', 'missing-proxy')
const result = await isolatedBackgroundMain.onRequest({ cookieStoreId: 'firefox-default', url: 'https://google.com', tabId: 0 })
expect(result).to.be.deep.equal([emergencyBreak])
})
it('should remove doNotProxyLocal flag from proxy settings if proxy is set up', async () => {
await givenSomeProxyIsSetUpForContainer({ containerId: 'firefox-default', host: undefined, doNotProxyLocal: undefined })
@@ -163,6 +163,15 @@ describe('Store', () => {
expect(relations.container1).to.be.deep.equal(['proxy1'])
expect(relations.container2).to.be.deep.equal(['proxy2'])
})
it('should keep a missing proxy relation distinguishable from no relation', () => {
const isolatedStore = new Store()
isolatedStore.setContainerProxyRelation('container1', 'deleted-proxy')
const result = isolatedStore.getProxiesForContainer('container1')
expect(result).to.be.deep.equal([])
})
})
describe('wildcard site assignments', function () {