mirror of
https://github.com/SukkaW/Surge.git
synced 2026-10-27 16:10:53 +08:00
Update AI Hosts/IPs
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import path from 'node:path';
|
||||
import { fastIpVersion } from 'foxts/fast-ip-version';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { SOURCE_DIR } from './constants/dir';
|
||||
import { $$fetch } from './lib/fetch-retry';
|
||||
import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
import { RulesetOutput } from './lib/rules/ruleset';
|
||||
import { SpanCategory, task } from './trace';
|
||||
|
||||
const OPENAI_VOICE_IP_URL = 'https://openai.com/chatgpt-voice.json';
|
||||
|
||||
const localAIIPRulesetPromise = readFileIntoProcessedArray(path.join(SOURCE_DIR, 'ip/ai.conf'));
|
||||
|
||||
function parseOpenAIVoiceJSON(data: unknown) {
|
||||
if (
|
||||
data === null
|
||||
@@ -70,14 +75,15 @@ export const buildAICIDR = task(require.main === module, __filename)(async (span
|
||||
}, SpanCategory.Network);
|
||||
|
||||
return new RulesetOutput(span, 'ai', 'ip')
|
||||
.withTitle('Sukka\'s Ruleset - ChatGPT Voice IP CIDR')
|
||||
.withTitle('Sukka\'s Ruleset - AI IP CIDR')
|
||||
.appendDescription(
|
||||
SHARED_DESCRIPTION,
|
||||
'',
|
||||
'This file contains IP ranges used by ChatGPT Voice.'
|
||||
'This file contains IP ranges used by AI services, including ChatGPT Voice.'
|
||||
)
|
||||
.withDate(lastUpdated)
|
||||
// .withDate(lastUpdated) // With local source, we no longer use the upstream date for file date
|
||||
.appendDataSource(`${OPENAI_VOICE_IP_URL} (last updated: ${lastUpdated.toISOString()})`)
|
||||
.addFromRuleset(localAIIPRulesetPromise)
|
||||
.bulkAddCIDR4NoResolve(cidr4)
|
||||
.bulkAddCIDR6NoResolve(cidr6)
|
||||
.write();
|
||||
|
||||
9
Source/ip/ai.conf
Normal file
9
Source/ip/ai.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# $ custom_build_script
|
||||
# Merged with the ChatGPT Voice IP ranges fetched in Build/build-ai-cidr.ts
|
||||
|
||||
# Add AI service IP rules below, e.g.
|
||||
# IP-CIDR,192.0.2.0/24,no-resolve
|
||||
# IP-CIDR6,2001:db8::/32,no-resolve
|
||||
|
||||
# >> Anthropic / Claude
|
||||
IP-ASN,399358
|
||||
@@ -28,10 +28,13 @@ DOMAIN-KEYWORD,openai
|
||||
# >> Perplexity
|
||||
DOMAIN-SUFFIX,perplexity.ai
|
||||
|
||||
# >> Claude
|
||||
# >> Anthropic / Claude
|
||||
DOMAIN-SUFFIX,anthropic.com
|
||||
DOMAIN-SUFFIX,claude.ai
|
||||
DOMAIN-SUFFIX,claude.com
|
||||
# For the record, I don't believe Claude will use Short URLs to geo blocking.
|
||||
# However, since there is some conspiracy theories surrounding it, I will include it.
|
||||
DOMAIN-SUFFIX,clau.de
|
||||
|
||||
# >> Google
|
||||
# Gemini
|
||||
|
||||
Reference in New Issue
Block a user