-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
386 lines (336 loc) · 30.9 KB
/
Copy pathindex.html
File metadata and controls
386 lines (336 loc) · 30.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- SEO Meta Tags (in English for better reach) -->
<title>Comprehensive IP Address Lists for Countries & Game Servers</title>
<meta name="description" content="An auto-updating repository providing fresh IP address lists for all countries and thousands of online game servers (like Steam). Ideal for firewalls, security research, and network applications.">
<meta name="keywords" content="ip address, ip list, country ip, game ip, steam ip, server ip, firewall rules, geolocation, cidr, ipv4, ipv6, networking, security">
<meta name="author" content="mo13ammad">
<meta property="og:title" content="Comprehensive IP Address Lists for Countries & Game Servers">
<meta property="og:description" content="Find and download up-to-date IPv4 and IPv6 CIDR lists for any country or online game server.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://mo13ammad.github.io/IPAddress/"> <!-- Replace with your GitHub Pages URL -->
<!-- Favicon (optional, but recommended) -->
<link rel="icon" href="https://github.githubassets.com/favicons/favicon.svg" type="image/svg+xml">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Tom Select for searchable dropdowns -->
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Vazirmatn:wght@400;500;700&display=swap" rel="stylesheet">
<!-- Custom Styles & Dark Mode Config -->
<style>
body {
font-family: 'Inter', 'Vazirmatn', sans-serif;
}
/* Custom scrollbar for better aesthetics */
textarea::-webkit-scrollbar { width: 8px; }
textarea::-webkit-scrollbar-track { background: #2d3748; }
textarea::-webkit-scrollbar-thumb { background-color: #4a5568; border-radius: 20px; border: 2px solid #2d3748; }
.rtl { direction: rtl; }
.ltr { direction: ltr; }
.loader {
border-top-color: #3498db;
-webkit-animation: spin 1s linear infinite;
animation: spin 1s linear infinite;
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Tom Select Dark Mode Styles */
.ts-control, .ts-control input, .ts-dropdown {
background-color: #4a5568 !important; /* dark:bg-gray-700 */
color: #e2e8f0 !important; /* dark:text-gray-200 */
border-color: transparent !important;
}
.ts-dropdown .option {
color: #e2e8f0 !important;
}
.ts-dropdown .option:hover, .ts-dropdown .active {
background-color: #2d3748 !important; /* dark:bg-gray-800 */
}
html.dark .ts-control, html.dark .ts-dropdown {
background: #374151 !important; /* dark:bg-gray-700 */
color: white !important;
}
html.dark .ts-control input::placeholder {
color: #9ca3af !important;
}
</style>
<script>
tailwind.config = {
darkMode: 'class',
theme: { extend: { fontFamily: { sans: ['Inter', 'Vazirmatn', 'sans-serif'] } } }
}
</script>
</head>
<body class="bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-gray-200 transition-colors duration-300">
<div class="container mx-auto p-4 md:p-8 max-w-5xl">
<!-- Header Section -->
<header class="text-center mb-10">
<h1 class="text-4xl md:text-5xl font-bold text-gray-900 dark:text-white mb-3">IP Address Finder</h1>
<p class="text-lg text-gray-600 dark:text-gray-400 mb-6 rtl">
آیپیهای بهروز کشورها و سرورهای بازی را به راحتی پیدا و کپی کنید. این پروژه به طور خودکار بهروز میشود.
</p>
<a href="https://github.com/mo13ammad/IPAddress" target="_blank" rel="noopener noreferrer" class="inline-flex items-center bg-gray-800 dark:bg-white text-white dark:text-black font-semibold py-2 px-4 rounded-lg shadow-lg hover:bg-gray-700 dark:hover:bg-gray-200 transition-all duration-300 transform hover:scale-105">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="mr-2"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.91 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
Star on GitHub
</a>
</header>
<main>
<!-- Country IP Section -->
<section class="bg-white dark:bg-gray-800 p-6 rounded-xl shadow-md mb-8">
<h2 class="text-2xl font-bold mb-4 rtl text-right">دریافت IP بر اساس کشور</h2>
<div class="grid md:grid-cols-3 gap-6 items-start rtl">
<div class="md:col-span-1">
<label for="country-select" class="block mb-2 font-semibold text-gray-700 dark:text-gray-300 text-right">کشور را جستجو یا انتخاب کنید:</label>
<select id="country-select" placeholder="در حال بارگذاری کشورها..."></select>
<div class="flex space-x-2 space-x-reverse mt-3">
<button id="select-ipv4" data-type="ipv4-countries" class="ip-type-btn-country flex-1 bg-blue-600 text-white py-2 px-4 rounded-md font-semibold">IPv4</button>
<button id="select-ipv6" data-type="ipv6-countries" class="ip-type-btn-country flex-1 bg-gray-200 dark:bg-gray-600 py-2 px-4 rounded-md font-semibold">IPv6</button>
</div>
</div>
<div class="md:col-span-2">
<div class="flex justify-between items-center mb-2 rtl">
<label for="country-ips" class="font-semibold text-gray-700 dark:text-gray-300">لیست IP ها:</label>
<button id="copy-country-ips" class="text-sm bg-gray-200 dark:bg-gray-600 hover:bg-gray-300 dark:hover:bg-gray-500 py-1 px-3 rounded-md transition-colors">کپی</button>
</div>
<div class="relative">
<textarea id="country-ips" rows="8" readonly class="w-full p-3 bg-gray-100 dark:bg-gray-700 rounded-lg focus:ring-0 border-2 border-transparent ltr" placeholder="Select a country and IP type to see the list..."></textarea>
<div id="country-loader" class="loader-container absolute inset-0 bg-gray-800 bg-opacity-70 flex items-center justify-center rounded-lg hidden">
<div class="loader h-12 w-12 rounded-full border-4 border-t-4 border-gray-200 ease-linear"></div>
</div>
</div>
<div id="country-links" class="mt-3 hidden">
<div class="flex justify-between items-center text-sm">
<a id="country-direct-link" href="#" target="_blank" rel="noopener noreferrer" class="font-semibold text-blue-500 hover:text-blue-400">لینک مستقیم فایل</a>
<div class="flex items-center space-x-3 rtl">
<span class="text-gray-500 dark:text-gray-400">اشتراکگذاری:</span>
<a id="country-share-telegram" href="#" target="_blank" class="text-gray-400 hover:text-blue-500"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.17.9-.502 1.2-.822 1.23-.696.062-1.22-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.03-.007-.06-.02-.08-.03-.04-.08-.02-.12-.02-.04 0-.1 0-.2-.04-.13-.03-.22-.05-.3-.06-.14-.04-.4-.12-.92-.12-.9 0-1.63.206-2.24.627a4.15 4.15 0 0 0-1.52 1.71c-.18.33-.36.68-.58 1.03-.04.06-.08.1-.12.14l-.42.24c-.04.02-.08.04-.12.06a.54.54 0 0 1-.1.04l-.1.02a.48.48 0 0 1-.15.02c-.14 0-.4-.06-.6-.12a.99.99 0 0 1-.4-.28c-.18-.17-.3-.48-.35-.7-.27-1.25-.03-2.35.28-3.23.23-.64.6-1.2 1-1.64.9-.93 2.1-1.4 3.4-1.52Z"/></svg></a>
<a id="country-share-whatsapp" href="#" target="_blank" class="text-gray-400 hover:text-green-500"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M12.04 2c-5.46 0-9.91 4.45-9.91 9.91 0 1.75.46 3.45 1.32 4.95L2 22l5.25-1.38c1.45.79 3.08 1.21 4.79 1.21 5.46 0 9.91-4.45 9.91-9.91S17.5 2 12.04 2zM12.04 20.12c-1.5 0-2.95-.4-4.23-1.14l-.3-.18-3.12.82.83-3.04-.2-.31a8.25 8.25 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.24-8.24 4.54 0 8.24 3.7 8.24 8.24S16.58 20.12 12.04 20.12zM16.56 14c-.22-.11-.59-.29-1.3-.6-1.2-.5-1.42-.34-1.62.24-.06.18-.32.4-.6.67-.45.45-1.03.71-1.28.48s-1.12-1.34-2.4-2.95c-.35-.43-.76-1.03.04-1.6.14-.1.3-.26.4-.38.1-.12.04-.3-.02-.42-.06-.12-.59-1.42-.81-1.95s-.42-.45-.59-.45c-.17 0-.34 0-.5 0-.17 0-.5.06-.64.38-.14.32-.5.98-.5 2.12s.5 2.45.58 2.62c.08.17 1.02 1.62 2.62 2.3s1.2.5 1.5.58c.45.1.84.08 1.14-.08.34-.17.98-.48 1.17-.92s.18-.84.12-.92c-.06-.08-.17-.13-.34-.24z"/></svg></a>
<a id="country-share-twitter" href="#" target="_blank" class="text-gray-400 hover:text-sky-400"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M22.46 6c-.77.35-1.6.58-2.46.67.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98-3.56-.18-6.73-1.89-8.84-4.48-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.22-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.94.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21c7.35 0 11.37-6.1 11.37-11.37 0-.17 0-.34-.01-.51.78-.57 1.45-1.28 1.98-2.08z"/></svg></a>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Game IP Section -->
<section class="bg-white dark:bg-gray-800 p-6 rounded-xl shadow-md">
<h2 class="text-2xl font-bold mb-4 rtl text-right">دریافت IP بر اساس بازی</h2>
<div class="grid md:grid-cols-3 gap-6 items-start rtl">
<div class="md:col-span-1">
<label for="game-select" class="block mb-2 font-semibold text-gray-700 dark:text-gray-300 text-right">بازی را جستجو یا انتخاب کنید:</label>
<select id="game-select" placeholder="در حال بارگذاری بازیها..."></select>
</div>
<div class="md:col-span-2">
<div class="flex justify-between items-center mb-2 rtl">
<label for="game-ips" class="font-semibold text-gray-700 dark:text-gray-300">لیست IP ها:</label>
<button id="copy-game-ips" class="text-sm bg-gray-200 dark:bg-gray-600 hover:bg-gray-300 dark:hover:bg-gray-500 py-1 px-3 rounded-md transition-colors">کپی</button>
</div>
<div class="relative">
<textarea id="game-ips" rows="8" readonly class="w-full p-3 bg-gray-100 dark:bg-gray-700 rounded-lg focus:ring-0 border-2 border-transparent ltr" placeholder="Select a game to see the server IP list..."></textarea>
<div id="game-loader" class="loader-container absolute inset-0 bg-gray-800 bg-opacity-70 flex items-center justify-center rounded-lg hidden">
<div class="loader h-12 w-12 rounded-full border-4 border-t-4 border-gray-200 ease-linear"></div>
</div>
</div>
<div id="game-links" class="mt-3 hidden">
<div class="flex justify-between items-center text-sm">
<a id="game-direct-link" href="#" target="_blank" rel="noopener noreferrer" class="font-semibold text-blue-500 hover:text-blue-400">لینک مستقیم فایل</a>
<div class="flex items-center space-x-3 rtl">
<span class="text-gray-500 dark:text-gray-400">اشتراکگذاری:</span>
<a id="game-share-telegram" href="#" target="_blank" class="text-gray-400 hover:text-blue-500"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.17.9-.502 1.2-.822 1.23-.696.062-1.22-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.03-.007-.06-.02-.08-.03-.04-.08-.02-.12-.02-.04 0-.1 0-.2-.04-.13-.03-.22-.05-.3-.06-.14-.04-.4-.12-.92-.12-.9 0-1.63.206-2.24.627a4.15 4.15 0 0 0-1.52 1.71c-.18.33-.36.68-.58 1.03-.04.06-.08.1-.12.14l-.42.24c-.04.02-.08.04-.12.06a.54.54 0 0 1-.1.04l-.1.02a.48.48 0 0 1-.15.02c-.14 0-.4-.06-.6-.12a.99.99 0 0 1-.4-.28c-.18-.17-.3-.48-.35-.7-.27-1.25-.03-2.35.28-3.23.23-.64.6-1.2 1-1.64.9-.93 2.1-1.4 3.4-1.52Z"/></svg></a>
<a id="game-share-whatsapp" href="#" target="_blank" class="text-gray-400 hover:text-green-500"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M12.04 2c-5.46 0-9.91 4.45-9.91 9.91 0 1.75.46 3.45 1.32 4.95L2 22l5.25-1.38c1.45.79 3.08 1.21 4.79 1.21 5.46 0 9.91-4.45 9.91-9.91S17.5 2 12.04 2zM12.04 20.12c-1.5 0-2.95-.4-4.23-1.14l-.3-.18-3.12.82.83-3.04-.2-.31a8.25 8.25 0 0 1-1.26-4.38c0-4.54 3.7-8.24 8.24-8.24 4.54 0 8.24 3.7 8.24 8.24S16.58 20.12 12.04 20.12zM16.56 14c-.22-.11-.59-.29-1.3-.6-1.2-.5-1.42-.34-1.62.24-.06.18-.32.4-.6.67-.45.45-1.03.71-1.28.48s-1.12-1.34-2.4-2.95c-.35-.43-.76-1.03.04-1.6.14-.1.3-.26.4-.38.1-.12.04-.3-.02-.42-.06-.12-.59-1.42-.81-1.95s-.42-.45-.59-.45c-.17 0-.34 0-.5 0-.17 0-.5.06-.64.38-.14.32-.5.98-.5 2.12s.5 2.45.58 2.62c.08.17 1.02 1.62 2.62 2.3s1.2.5 1.5.58c.45.1.84.08 1.14-.08.34-.17.98-.48 1.17-.92s.18-.84.12-.92c-.06-.08-.17-.13-.34-.24z"/></svg></a>
<a id="game-share-twitter" href="#" target="_blank" class="text-gray-400 hover:text-sky-400"><svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M22.46 6c-.77.35-1.6.58-2.46.67.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98-3.56-.18-6.73-1.89-8.84-4.48-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.22-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.94.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21c7.35 0 11.37-6.1 11.37-11.37 0-.17 0-.34-.01-.51.78-.57 1.45-1.28 1.98-2.08z"/></svg></a>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="text-center mt-10 pt-6 border-t border-gray-200 dark:border-gray-700">
<p class="text-gray-500 dark:text-gray-400">
Created by <a href="https://github.com/mo13ammad" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline">mo13ammad</a>.
IP data is updated automatically.
</p>
</footer>
</div>
<!-- Toast Notification -->
<div id="toast" class="fixed bottom-5 right-5 bg-green-500 text-white py-2 px-5 rounded-lg shadow-xl opacity-0 translate-y-10 transition-all duration-300">
کپی شد!
</div>
<!-- Tom Select JS -->
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const GITHUB_REPO = 'mo13ammad/IPAddress';
const GITHUB_BRANCH = 'main';
const countryIpsText = document.getElementById('country-ips');
const gameIpsText = document.getElementById('game-ips');
const countryLoader = document.getElementById('country-loader');
const gameLoader = document.getElementById('game-loader');
const copyCountryBtn = document.getElementById('copy-country-ips');
const copyGameBtn = document.getElementById('copy-game-ips');
const toast = document.getElementById('toast');
const countryLinks = document.getElementById('country-links');
const gameLinks = document.getElementById('game-links');
let selectedCountryIPType = 'ipv4-countries';
let countryTomSelect, gameTomSelect;
const countryCodeToName = { "AF": "Afghanistan", "AX": "Åland Islands", "AL": "Albania", "DZ": "Algeria", "AS": "American Samoa", "AD": "Andorra", "AO": "Angola", "AI": "Anguilla", "AQ": "Antarctica", "AG": "Antigua and Barbuda", "AR": "Argentina", "AM": "Armenia", "AW": "Aruba", "AU": "Australia", "AT": "Austria", "AZ": "Azerbaijan", "BS": "Bahamas", "BH": "Bahrain", "BD": "Bangladesh", "BB": "Barbados", "BY": "Belarus", "BE": "Belgium", "BZ": "Belize", "BJ": "Benin", "BM": "Bermuda", "BT": "Bhutan", "BO": "Bolivia", "BQ": "Bonaire, Sint Eustatius and Saba", "BA": "Bosnia and Herzegovina", "BW": "Botswana", "BV": "Bouvet Island", "BR": "Brazil", "IO": "British Indian Ocean Territory", "BN": "Brunei Darussalam", "BG": "Bulgaria", "BF": "Burkina Faso", "BI": "Burundi", "CV": "Cabo Verde", "KH": "Cambodia", "CM": "Cameroon", "CA": "Canada", "KY": "Cayman Islands", "CF": "Central African Republic", "TD": "Chad", "CL": "Chile", "CN": "China", "CX": "Christmas Island", "CC": "Cocos (Keeling) Islands", "CO": "Colombia", "KM": "Comoros", "CG": "Congo", "CD": "Congo (DRC)", "CK": "Cook Islands", "CR": "Costa Rica", "CI": "Côte d'Ivoire", "HR": "Croatia", "CU": "Cuba", "CW": "Curaçao", "CY": "Cyprus", "CZ": "Czechia", "DK": "Denmark", "DJ": "Djibouti", "DM": "Dominica", "DO": "Dominican Republic", "EC": "Ecuador", "EG": "Egypt", "SV": "El Salvador", "GQ": "Equatorial Guinea", "ER": "Eritrea", "EE": "Estonia", "SZ": "Eswatini", "ET": "Ethiopia", "FK": "Falkland Islands (Malvinas)", "FO": "Faroe Islands", "FJ": "Fiji", "FI": "Finland", "FR": "France", "GF": "French Guiana", "PF": "French Polynesia", "TF": "French Southern Territories", "GA": "Gabon", "GM": "Gambia", "GE": "Georgia", "DE": "Germany", "GH": "Ghana", "GI": "Gibraltar", "GR": "Greece", "GL": "Greenland", "GD": "Grenada", "GP": "Guadeloupe", "GU": "Guam", "GT": "Guatemala", "GG": "Guernsey", "GN": "Guinea", "GW": "Guinea-Bissau", "GY": "Guyana", "HT": "Haiti", "HM": "Heard Island and McDonald Islands", "VA": "Holy See", "HN": "Honduras", "HK": "Hong Kong", "HU": "Hungary", "IS": "Iceland", "IN": "India", "ID": "Indonesia", "IR": "Iran", "IQ": "Iraq", "IE": "Ireland", "IM": "Isle of Man", "IL": "Israel", "IT": "Italy", "JM": "Jamaica", "JP": "Japan", "JE": "Jersey", "JO": "Jordan", "KZ": "Kazakhstan", "KE": "Kenya", "KI": "Kiribati", "KP": "North Korea", "KR": "South Korea", "KW": "Kuwait", "KG": "Kyrgyzstan", "LA": "Laos", "LV": "Latvia", "LB": "Lebanon", "LS": "Lesotho", "LR": "Liberia", "LY": "Libya", "LI": "Liechtenstein", "LT": "Lithuania", "LU": "Luxembourg", "MO": "Macao", "MG": "Madagascar", "MW": "Malawi", "MY": "Malaysia", "MV": "Maldives", "ML": "Mali", "MT": "Malta", "MH": "Marshall Islands", "MQ": "Martinique", "MR": "Mauritania", "MU": "Mauritius", "YT": "Mayotte", "MX": "Mexico", "FM": "Micronesia", "MD": "Moldova", "MC": "Monaco", "MN": "Mongolia", "ME": "Montenegro", "MS": "Montserrat", "MA": "Morocco", "MZ": "Mozambique", "MM": "Myanmar", "NA": "Namibia", "NR": "Nauru", "NP": "Nepal", "NL": "Netherlands", "NC": "New Caledonia", "NZ": "New Zealand", "NI": "Nicaragua", "NE": "Niger", "NG": "Nigeria", "NU": "Niue", "NF": "Norfolk Island", "MK": "North Macedonia", "MP": "Northern Mariana Islands", "NO": "Norway", "OM": "Oman", "PK": "Pakistan", "PW": "Palau", "PS": "Palestine, State of", "PA": "Panama", "PG": "Papua New Guinea", "PY": "Paraguay", "PE": "Peru", "PH": "Philippines", "PN": "Pitcairn", "PL": "Poland", "PT": "Portugal", "PR": "Puerto Rico", "QA": "Qatar", "RE": "Réunion", "RO": "Romania", "RU": "Russian Federation", "RW": "Rwanda", "BL": "Saint Barthélemy", "SH": "Saint Helena", "KN": "Saint Kitts and Nevis", "LC": "Saint Lucia", "MF": "Saint Martin (French part)", "PM": "Saint Pierre and Miquelon", "VC": "Saint Vincent and the Grenadines", "WS": "Samoa", "SM": "San Marino", "ST": "Sao Tome and Principe", "SA": "Saudi Arabia", "SN": "Senegal", "RS": "Serbia", "SC": "Seychelles", "SL": "Sierra Leone", "SG": "Singapore", "SX": "Sint Maarten (Dutch part)", "SK": "Slovakia", "SI": "Slovenia", "SB": "Solomon Islands", "SO": "Somalia", "ZA": "South Africa", "GS": "South Georgia", "SS": "South Sudan", "ES": "Spain", "LK": "Sri Lanka", "SD": "Sudan", "SR": "Suriname", "SJ": "Svalbard and Jan Mayen", "SE": "Sweden", "CH": "Switzerland", "SY": "Syrian Arab Republic", "TW": "Taiwan", "TJ": "Tajikistan", "TZ": "Tanzania", "TH": "Thailand", "TL": "Timor-Leste", "TG": "Togo", "TK": "Tokelau", "TO": "Tonga", "TT": "Trinidad and Tobago", "TN": "Tunisia", "TR": "Turkey", "TM": "Turkmenistan", "TC": "Turks and Caicos Islands", "TV": "Tuvalu", "UG": "Uganda", "UA": "Ukraine", "AE": "United Arab Emirates", "GB": "United Kingdom", "US": "United States", "UY": "Uruguay", "UZ": "Uzbekistan", "VU": "Vanuatu", "VE": "Venezuela", "VN": "Viet Nam", "VG": "Virgin Islands (British)", "VI": "Virgin Islands (U.S.)", "WF": "Wallis and Futuna", "EH": "Western Sahara", "YE": "Yemen", "ZM": "Zambia", "ZW": "Zimbabwe" };
const showToast = (message, isError = false) => {
toast.textContent = message;
toast.classList.remove('opacity-0', 'translate-y-10');
toast.classList.toggle('bg-red-500', isError);
toast.classList.toggle('bg-green-500', !isError);
setTimeout(() => {
toast.classList.add('opacity-0', 'translate-y-10');
}, 2000);
};
const copyToClipboard = (text) => {
if (!text || text.startsWith("Error")) {
showToast('Nothing to copy!', true);
return;
}
navigator.clipboard.writeText(text).then(() => {
showToast('کپی شد!');
}).catch(err => {
console.error('Failed to copy: ', err);
showToast('Failed to copy!', true);
});
};
const fetchRepoDir = async (path) => {
try {
const response = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/contents/${path}?ref=${GITHUB_BRANCH}`);
if (!response.ok) throw new Error(`GitHub API error: ${response.status}`);
const data = await response.json();
return data.filter(item => item.type === 'file' && item.name.endsWith('.cidr')).map(item => item.name);
} catch (error) {
console.error(`Failed to fetch directory '${path}':`, error);
return [];
}
};
const fetchIPFile = async (filePath) => {
try {
const response = await fetch(`https://cdn.jsdelivr.net/gh/${GITHUB_REPO}@${GITHUB_BRANCH}/${filePath}`);
if (!response.ok) throw new Error(`jsDelivr error: ${response.status}`);
const text = await response.text();
return text.trim();
} catch (error) {
console.error(`Failed to fetch file '${filePath}':`, error);
return "Error loading IP list. Please try again.";
}
};
const initTomSelect = (id, placeholder) => {
return new TomSelect(id, {
create: false,
placeholder: placeholder,
sortField: { field: "text", direction: "asc" }
});
}
const populateCountries = async () => {
const files = await fetchRepoDir('ipv4-countries');
countryTomSelect.clear();
countryTomSelect.clearOptions();
const sortedCountries = files
.map(file => file.replace('.cidr', ''))
.map(code => ({ value: code, text: countryCodeToName[code] || code }))
.sort((a, b) => a.text.localeCompare(b.text));
countryTomSelect.addOptions(sortedCountries);
countryTomSelect.refreshOptions(false);
countryTomSelect.control_input.placeholder = 'یک کشور را انتخاب کنید...';
};
const populateGames = async () => {
const files = await fetchRepoDir('game-servers/steam');
gameTomSelect.clear();
gameTomSelect.clearOptions();
const sortedGames = files
.map(file => ({
value: file,
text: file.replace('.cidr', '').replace(/_/g, ' ')
}))
.sort((a, b) => a.text.localeCompare(b.text));
gameTomSelect.addOptions(sortedGames);
gameTomSelect.refreshOptions(false);
gameTomSelect.control_input.placeholder = 'یک بازی را انتخاب کنید...';
};
const handleCountrySelect = async (countryCode) => {
if (!countryCode) {
countryLinks.classList.add('hidden');
return;
}
countryLoader.classList.remove('hidden');
countryIpsText.value = '';
const filePath = `${selectedCountryIPType}/${countryCode}.cidr`;
const ips = await fetchIPFile(filePath);
countryIpsText.value = ips;
countryLoader.classList.add('hidden');
updateLinks('country', filePath, countryCodeToName[countryCode]);
};
const handleGameSelect = async (gameFile) => {
if (!gameFile) {
gameLinks.classList.add('hidden');
return;
}
gameLoader.classList.remove('hidden');
gameIpsText.value = '';
const filePath = `game-servers/steam/${gameFile}`;
const ips = await fetchIPFile(filePath);
gameIpsText.value = ips;
gameLoader.classList.add('hidden');
const gameName = gameFile.replace('.cidr', '').replace(/_/g, ' ');
updateLinks('game', filePath, gameName);
};
const updateLinks = (type, filePath, name) => {
const linksContainer = document.getElementById(`${type}-links`);
const directLink = document.getElementById(`${type}-direct-link`);
const shareTelegram = document.getElementById(`${type}-share-telegram`);
const shareWhatsapp = document.getElementById(`${type}-share-whatsapp`);
const shareTwitter = document.getElementById(`${type}-share-twitter`);
const fileUrl = `https://github.com/${GITHUB_REPO}/blob/${GITHUB_BRANCH}/${filePath}`;
const shareText = encodeURIComponent(`IP list for ${name}:`);
const shareUrl = encodeURIComponent(fileUrl);
directLink.href = fileUrl;
shareTelegram.href = `https://t.me/share/url?url=${shareUrl}&text=${shareText}`;
shareWhatsapp.href = `https://api.whatsapp.com/send?text=${shareText}%20${shareUrl}`;
shareTwitter.href = `https://twitter.com/intent/tweet?text=${shareText}&url=${shareUrl}`;
linksContainer.classList.remove('hidden');
};
const handleIPTypeSwitch = (e) => {
const selectedBtn = e.target;
if(selectedBtn.dataset.type === selectedCountryIPType) return;
document.querySelectorAll('.ip-type-btn-country').forEach(btn => {
btn.classList.remove('bg-blue-600', 'text-white');
btn.classList.add('bg-gray-200', 'dark:bg-gray-600');
});
selectedBtn.classList.add('bg-blue-600', 'text-white');
selectedBtn.classList.remove('bg-gray-200', 'dark:bg-gray-600');
selectedCountryIPType = selectedBtn.dataset.type;
handleCountrySelect(countryTomSelect.getValue());
};
// --- Initial Load & Event Listeners ---
countryTomSelect = initTomSelect('#country-select', 'در حال بارگذاری...');
gameTomSelect = initTomSelect('#game-select', 'در حال بارگذاری...');
populateCountries();
populateGames();
countryTomSelect.on('change', handleCountrySelect);
gameTomSelect.on('change', handleGameSelect);
document.querySelectorAll('.ip-type-btn-country').forEach(btn => {
btn.addEventListener('click', handleIPTypeSwitch);
});
copyCountryBtn.addEventListener('click', () => copyToClipboard(countryIpsText.value));
copyGameBtn.addEventListener('click', () => copyToClipboard(gameIpsText.value));
});
</script>
</body>
</html>