Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ const ProxySettings = ({ collection }) => {
/>
SOCKS5
</label>
<label className="flex items-center ml-4" title="SOCKS5 with hostname resolution performed by the proxy (remote DNS)">
<input
type="radio"
name="protocol"
value="socks5h"
checked={(currentProxyConfig.config?.protocol || 'http') === 'socks5h'}
onChange={handleProtocolChange}
className="mr-1"
/>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
SOCKS5h
</label>
</div>
</div>
<div className="mb-3 flex items-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ProxySettings = ({ close }) => {
.nullable()
}).optional(),
config: Yup.object({
protocol: Yup.string().required().oneOf(['http', 'https', 'socks4', 'socks5']),
protocol: Yup.string().required().oneOf(['http', 'https', 'socks4', 'socks5', 'socks5h']),
hostname: Yup.string().max(1024),
port: Yup.number()
.min(1)
Expand Down Expand Up @@ -257,6 +257,17 @@ const ProxySettings = ({ close }) => {
/>
SOCKS5
</label>
<label className="flex items-center ml-4" title="SOCKS5 with hostname resolution performed by the proxy (remote DNS)">
<input
type="radio"
name="config.protocol"
value="socks5h"
checked={formik.values.config.protocol === 'socks5h'}
onChange={formik.handleChange}
className="mr-1"
/>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
SOCKS5h
</label>
</div>
</div>
<div className="mb-3 flex items-center">
Expand Down
2 changes: 1 addition & 1 deletion packages/bruno-electron/src/store/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const preferencesSchema = Yup.object().shape({
source: Yup.string().optional().max(2048).nullable()
}).optional(),
config: Yup.object({
protocol: Yup.string().oneOf(['http', 'https', 'socks4', 'socks5']),
protocol: Yup.string().oneOf(['http', 'https', 'socks4', 'socks5', 'socks5h']),
hostname: Yup.string().max(1024),
port: Yup.number().min(1).max(65535).nullable(),
auth: Yup.object({
Expand Down
31 changes: 31 additions & 0 deletions packages/bruno-electron/test/proxy-util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,37 @@ describe('proxy-util', () => {
);
});

test('setupProxyAgents: manual socks5h proxy routes through socks agent and preserves the socks5h scheme', async () => {
setupMocks();
const { setupProxyAgents } = require('../src/utils/proxy-util');
const { SocksProxyAgent } = require('socks-proxy-agent');
const { getOrCreateHttpsAgent } = require('@usebruno/requests');

// https request → only the https agent should be set
const requestConfig = { url: 'https://example.com/resource' };
const timeline = [];

await setupProxyAgents({
requestConfig,
proxyMode: 'on',
proxyConfig: {
protocol: 'socks5h',
hostname: 'socks.example',
port: 1080,
auth: { disabled: true }
},
httpsAgentRequestFields: {},
interpolationOptions: {},
timeline
});

// The socks5h scheme must reach socks-proxy-agent verbatim — that scheme is what
// tells the agent to resolve the target hostname on the proxy side (remote DNS).
expect(getOrCreateHttpsAgent).toHaveBeenCalledWith(
expect.objectContaining({ AgentClass: SocksProxyAgent, proxyUri: 'socks5h://socks.example:1080' })
);
});

test('setupProxyAgents: PAC resolution error logs to timeline and falls back to direct agent', async () => {
jest.doMock('../src/store/preferences', () => ({
preferencesUtil: { isSslSessionCachingEnabled: () => false }
Expand Down