aurora-develop / aurora

free
MIT License
2.23k stars 727 forks source link

功能申请:指定请求IP。 #220

Closed dallascao closed 3 months ago

dallascao commented 4 months ago

当 VPS有多个 IP时,能否增加向 openai 发出请求时指定IP的功能?

目前支持ipv6的 VPS可添加的 IP数量接近无限,这个功能应该还是很有用的。将多个IPV6都添加到 vps上,请求openai时轮换使用。

附 1 axios 指定IP样例:

const axios = require('axios');
const http = require('http');
const https = require('https');

// Create an HTTP agent
const httpAgent = new http.Agent({
  localAddress: '192.168.1.100'  // Your local IP here
});

// Optionally, create an HTTPS agent if needed
const httpsAgent = new https.Agent({
  localAddress: '192.168.1.100'  // Your local IP here
});

// Use Axios to make a request
axios.get('http://example.com', {
  httpAgent: httpAgent,
  httpsAgent: httpsAgent
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error('Request failed:', error);
});
  1. 使用curl 时指定请求 ip
curl --interface ip_address http://example.com
baby9 commented 4 months ago

你是不是想要这个功能 https://github.com/XTLS/Xray-core/pull/3169

dallascao commented 4 months ago

是的。

另外最好还可给模仿官方的 api 增加个参数,允许用户自己指定 ip

xiaozhou26 commented 4 months ago

目前不考虑

zbronya commented 4 months ago

https://github.com/zbronya/v6-proxy 可以试试这个,可以实现你的需求,而且更通用一些