Skip to content

Commit eae1ac4

Browse files
committed
chore: add LICENSE and update README
1 parent 36859ac commit eae1ac4

File tree

2 files changed

+53
-53
lines changed

2 files changed

+53
-53
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 邱敬幃 Pardn Chiu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# IP Guardian - IP 安全、限流與自動封鎖
1+
# (未完成) IP Guardian - IP 安全、限流與自動封鎖
2+
> IP Guardian 是一個高效能的 Go 語言 IP 安全防護系統,提供即時威脅偵測、動態風險評分、設備指紋識別等多層安全防護機制。系統採用 Redis 作為高速快取層,支援併發處理與自動化威脅回應。
23
3-
## 概述
4+
[![version](https://img.shields.io/github/v/tag/pardnchiu/golang-ip-guardian)](https://github.com/pardnchiu/golang-ip-guardian/releases)
45

5-
IP Guardian 是一個高效能的 Go 語言 IP 安全防護系統,提供即時威脅偵測、動態風險評分、設備指紋識別等多層安全防護機制。系統採用 Redis 作為高速快取層,支援併發處理與自動化威脅回應。
6+
## 待處理項目
7+
- AbuseIPDB 驗證
8+
- Geo 驗證
69

710
## 主要特色
811

@@ -421,56 +424,32 @@ graph TD
421424

422425
### 配置介紹
423426

427+
#### 可用參數
424428
```go
425-
config := &golangIPGuardian.Config{
426-
Redis: golangIPGuardian.Redis{
427-
Host: "redis-cluster.example.com",
428-
Port: 6379,
429-
Password: "your-redis-password",
430-
DB: 1,
431-
},
432-
Email: &golangIPGuardian.EmailConfig{
433-
Host: "smtp.gmail.com",
434-
Port: 587,
435-
Username: "your-email@example.com",
436-
Password: "your-app-password",
437-
From: "security@your-domain.com",
438-
To: []string{"admin@your-domain.com"},
439-
},
440-
Log: golangIPGuardian.LogConfig{
441-
Path: "/var/log/ipguardian",
442-
Stdout: false,
443-
MaxSize: 100 * 1024 * 1024, // 100MB
444-
},
445-
Parameter: golangIPGuardian.Parameter{
446-
// 阻擋策略
447-
BlockToBan: 5, // 5次阻擋後永久封鎖
448-
BlockTimeMin: 1800, // 30分鐘起始阻擋
449-
BlockTimeMax: 86400 * 7, // 7天最大阻擋
450-
451-
// 流量限制
452-
RateLimitNormal: 200, // 正常用戶 200 req/min
453-
RateLimitSuspicious: 50, // 可疑用戶 50 req/min
454-
RateLimitDangerous: 10, // 危險用戶 10 req/min
455-
456-
// 關聯限制
457-
SessionMultiIP: 3, // 單一 Session 最多 3 個 IP
458-
IPMultiDevice: 5, // 單一 IP 最多 5 個設備
459-
DeviceMultiIP: 2, // 單一設備最多 2 個 IP
460-
461-
// 風險評分
462-
ScoreNormal: 0,
463-
ScoreSuspicious: 40, // 降低可疑閾值
464-
ScoreDangerous: 70, // 降低危險閾值
465-
ScoreSessionMultiIP: 20,
466-
ScoreIPMultiDevice: 25,
467-
ScoreDeviceMultiIP: 15,
468-
ScoreFpMultiSession: 30,
469-
ScoreGeoHopping: 20,
470-
ScoreGeoFrequentSwitch: 25,
471-
ScoreGeoRapidChange: 30,
472-
ScoreLongConnection: 10,
473-
ScoreIntervalRequest: 15,
474-
},
429+
type Parameter struct {
430+
BlockToBan int `json:"block_to_ban"` // 封鎖到禁止的次數
431+
BlockTimeMin int `json:"block_time_min"` // 最小封鎖時間(秒)
432+
BlockTimeMax int `json:"block_time_max"` // 最大限制時間(秒)
433+
RateLimitNormal int `json:"rate_limit_normal"` // 正常請求速率限制
434+
RateLimitSuspicious int `json:"rate_limit_suspicious"` // 可疑請求速率限制
435+
RateLimitDangerous int `json:"rate_limit_dangerous"` // 危險請求速率限制
436+
SessionMultiIP int `json:"session_multi_ip"` // 單一 Session 允許的最大 IP 數
437+
IPMultiDevice int `json:"ip_multi_device"` // 單一 IP 允許的最大設備數
438+
DeviceMultiIP int `json:"device_multi_ip"` // 單一設備允許的最大 IP 數
439+
LoginFailure int `json:"login_failure"` // 單一 Session 允許的最大登入失敗次數
440+
NotFound404 int `json:"not_found_404"` // 單一 Session 允許的最大 404 請求數
441+
ScoreNormal int `json:"score_normal"` // 正常請求的風險分數
442+
ScoreSuspicious int `json:"score_suspicious"` // 可疑請求的風險分數
443+
ScoreDangerous int `json:"score_dangerous"` // 危險請求的風險分數
444+
ScoreSessionMultiIP int `json:"score_session_multi_ip"` // 單一 Session 允許的最大 IP 數可疑分數
445+
ScoreIPMultiDevice int `json:"score_ip_multi_device"` // 單一 IP 允許的最大設備數可疑分數
446+
ScoreDeviceMultiIP int `json:"score_device_multi_ip"` // 單一設備允許的最大 IP 數可疑分數
447+
ScoreFpMultiSession int `json:"score_fp_multi_session"` // 單一指紋允許的最大 Session 數可疑分數
448+
ScoreGeoHopping int `json:"score_geo_hopping"` // 地理位置跳躍可疑分數
449+
ScoreGeoFrequentSwitch int `json:"score_geo_frequent_switch"` // 地理位置頻繁切換可疑分數
450+
ScoreGeoRapidChange int `json:"score_geo_rapid_change"` // 地理位置快速變化可疑分數
451+
ScoreIntervalRequest int `json:"score_interval_request"` // 短時間內的請求數可疑分數
452+
ScoreFrequencyRequest int `json:"score_frequency_request"` // 請求頻率可疑分數
453+
ScoreLongConnection int `json:"score_long_connection"` // 長連接可疑分數
475454
}
476455
```

0 commit comments

Comments
 (0)