refactor: Update S3 file paths in server.js to use a new directory structure for better organization
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 5m45s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 5m45s
This commit is contained in:
+10
-10
@@ -24,7 +24,7 @@ const s3 = new AWS.S3({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const BUCKET_NAME = process.env.S3_BUCKET_NAME;
|
const BUCKET_NAME = process.env.S3_BUCKET_NAME;
|
||||||
const FILE_KEY = 'domains.txt';
|
const FILE_KEY = 'bgp_data/domains.txt';
|
||||||
|
|
||||||
// Get domains from S3
|
// Get domains from S3
|
||||||
app.get('/api/domains', async (req, res) => {
|
app.get('/api/domains', async (req, res) => {
|
||||||
@@ -82,7 +82,7 @@ app.post('/api/domains', async (req, res) => {
|
|||||||
app.get('/api/asns', async (req, res) => {
|
app.get('/api/asns', async (req, res) => {
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'asns.txt',
|
Key: 'bgp_data/asns.txt',
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -112,7 +112,7 @@ app.post('/api/asns', async (req, res) => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'asns.txt',
|
Key: 'bgp_data/asns.txt',
|
||||||
Body: fileContent,
|
Body: fileContent,
|
||||||
ContentType: 'text/plain',
|
ContentType: 'text/plain',
|
||||||
};
|
};
|
||||||
@@ -132,7 +132,7 @@ app.post('/api/asns', async (req, res) => {
|
|||||||
app.get('/api/domains-new', async (req, res) => {
|
app.get('/api/domains-new', async (req, res) => {
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'domains_comunity.txt',
|
Key: 'bgp_data/domains_comunity.txt',
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -162,7 +162,7 @@ app.post('/api/domains-new', async (req, res) => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'domains_comunity.txt',
|
Key: 'bgp_data/domains_comunity.txt',
|
||||||
Body: fileContent,
|
Body: fileContent,
|
||||||
ContentType: 'text/plain',
|
ContentType: 'text/plain',
|
||||||
};
|
};
|
||||||
@@ -182,7 +182,7 @@ app.post('/api/domains-new', async (req, res) => {
|
|||||||
app.get('/api/ip-ranges', async (req, res) => {
|
app.get('/api/ip-ranges', async (req, res) => {
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'domains/ips.txt',
|
Key: 'bgp_data/ips.txt',
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -212,7 +212,7 @@ app.post('/api/ip-ranges', async (req, res) => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
Bucket: BUCKET_NAME,
|
Bucket: BUCKET_NAME,
|
||||||
Key: 'domains/ips.txt',
|
Key: 'bgp_data/ips.txt',
|
||||||
Body: fileContent,
|
Body: fileContent,
|
||||||
ContentType: 'text/plain',
|
ContentType: 'text/plain',
|
||||||
};
|
};
|
||||||
@@ -368,9 +368,9 @@ app.post('/api/filters', async (req, res) => {
|
|||||||
app.get('/api/s3/last-modified', async (req, res) => {
|
app.get('/api/s3/last-modified', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const [domainsHead, domainsNewHead, asnsHead, serversHead, filtersHead] = await Promise.all([
|
const [domainsHead, domainsNewHead, asnsHead, serversHead, filtersHead] = await Promise.all([
|
||||||
s3.headObject({ Bucket: BUCKET_NAME, Key: 'domains.txt' }).promise(),
|
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/domains.txt' }).promise(),
|
||||||
s3.headObject({ Bucket: BUCKET_NAME, Key: 'domains_comunity.txt' }).promise(),
|
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/domains_comunity.txt' }).promise(),
|
||||||
s3.headObject({ Bucket: BUCKET_NAME, Key: 'asns.txt' }).promise(),
|
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/asns.txt' }).promise(),
|
||||||
s3.headObject({ Bucket: BUCKET_NAME, Key: 'servers.json' }).promise(),
|
s3.headObject({ Bucket: BUCKET_NAME, Key: 'servers.json' }).promise(),
|
||||||
s3.headObject({ Bucket: BUCKET_NAME, Key: 'filters.json' }).promise()
|
s3.headObject({ Bucket: BUCKET_NAME, Key: 'filters.json' }).promise()
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# BGP Data Files
|
||||||
|
|
||||||
|
Эта папка содержит файлы данных для BGP-маршрутизации:
|
||||||
|
|
||||||
|
## Структура файлов
|
||||||
|
|
||||||
|
### domains.txt
|
||||||
|
Файл с доменами и их типами (старый формат):
|
||||||
|
```
|
||||||
|
example.com 100
|
||||||
|
google.com 101
|
||||||
|
facebook.com 102
|
||||||
|
```
|
||||||
|
|
||||||
|
### domains_comunity.txt
|
||||||
|
Файл с доменами и их community (новый формат):
|
||||||
|
```
|
||||||
|
example.com 100
|
||||||
|
google.com 101
|
||||||
|
facebook.com 102
|
||||||
|
```
|
||||||
|
|
||||||
|
### asns.txt
|
||||||
|
Файл с номерами AS и их community:
|
||||||
|
```
|
||||||
|
12345 112
|
||||||
|
4545 113
|
||||||
|
6789 114
|
||||||
|
```
|
||||||
|
|
||||||
|
### ips.txt
|
||||||
|
Файл с IP-диапазонами и их community:
|
||||||
|
```
|
||||||
|
192.168.1.0/24 100
|
||||||
|
10.0.0.0/8 101
|
||||||
|
172.16.0.0/12 102
|
||||||
|
```
|
||||||
|
|
||||||
|
## Формат файлов
|
||||||
|
|
||||||
|
Все файлы имеют текстовый формат с разделителем пробел между значениями.
|
||||||
|
Каждая строка содержит два поля:
|
||||||
|
- Первое поле: домен/AS/IP-диапазон
|
||||||
|
- Второе поле: community/тип
|
||||||
|
|
||||||
|
Пустые строки игнорируются при обработке.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
12345 112
|
||||||
|
4545 113
|
||||||
|
6789 114
|
||||||
|
1011 115
|
||||||
|
1213 116
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
example.com 100
|
||||||
|
google.com 101
|
||||||
|
facebook.com 102
|
||||||
|
youtube.com 103
|
||||||
|
github.com 104
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
example.com 100
|
||||||
|
google.com 101
|
||||||
|
facebook.com 102
|
||||||
|
youtube.com 103
|
||||||
|
github.com 104
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
192.168.1.0/24 100
|
||||||
|
10.0.0.0/8 101
|
||||||
|
172.16.0.0/12 102
|
||||||
|
8.8.8.0/24 103
|
||||||
|
1.1.1.0/24 104
|
||||||
Reference in New Issue
Block a user