-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
227 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
module Deadpool | ||
|
||
go 1.20 | ||
go 1.21.0 | ||
|
||
require github.com/BurntSushi/toml v1.4.0 | ||
toolchain go1.23.0 | ||
|
||
require ( | ||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 | ||
github.com/pelletier/go-toml/v2 v2.2.3 | ||
) | ||
|
||
require golang.org/x/net v0.29.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= | ||
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= | ||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= | ||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= | ||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | ||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= | ||
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package utils | ||
|
||
import ( | ||
"os" | ||
|
||
toml "github.com/pelletier/go-toml/v2" | ||
) | ||
|
||
type Config struct { | ||
Listener ListenerConfig `toml:"listener"` | ||
CheckSocks CheckSocksConfig `toml:"checkSocks"` | ||
FOFA FOFAConfig `toml:"FOFA"` | ||
QUAKE QUAKEConfig `toml:"QUAKE"` | ||
HUNTER HUNTERConfig `toml:"HUNTER"` | ||
} | ||
|
||
type ListenerConfig struct { | ||
IP string `toml:"IP"` | ||
Port int `toml:"PORT"` | ||
UserName string `toml:"userName"` | ||
Password string `toml:"password"` | ||
} | ||
|
||
type CheckSocksConfig struct { | ||
CheckURL string `toml:"checkURL"` | ||
CheckRspKeywords string `toml:"checkRspKeywords"` | ||
MaxConcurrentReq int `toml:"maxConcurrentReq"` | ||
Timeout int `toml:"timeout"` | ||
CheckGeolocate CheckGeolocateConfig `toml:"checkGeolocate"` | ||
} | ||
|
||
type CheckGeolocateConfig struct { | ||
Switch string `toml:"switch"` | ||
CheckURL string `toml:"checkURL"` | ||
ExcludeKeywords []string `toml:"excludeKeywords"` | ||
IncludeKeywords []string `toml:"includeKeywords"` | ||
} | ||
|
||
type FOFAConfig struct { | ||
Switch string `toml:"switch"` | ||
APIURL string `toml:"apiUrl"` | ||
Email string `toml:"email"` | ||
Key string `toml:"key"` | ||
QueryString string `toml:"queryString"` | ||
ResultSize int `toml:"resultSize"` | ||
} | ||
|
||
type QUAKEConfig struct { | ||
Switch string `toml:"switch"` | ||
APIURL string `toml:"apiUrl"` | ||
Key string `toml:"key"` | ||
QueryString string `toml:"queryString"` | ||
ResultSize int `toml:"resultSize"` | ||
} | ||
|
||
type HUNTERConfig struct { | ||
Switch string `toml:"switch"` | ||
APIURL string `toml:"apiUrl"` | ||
Key string `toml:"key"` | ||
QueryString string `toml:"queryString"` | ||
ResultSize int `toml:"resultSize"` | ||
} | ||
|
||
func LoadConfig(path string) (Config, error) { | ||
var config Config | ||
// 读取并解析 TOML 文件 | ||
data, err := os.ReadFile(path) | ||
if err != nil { | ||
return config, err | ||
} | ||
|
||
err = toml.Unmarshal(data, &config) | ||
|
||
return config, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.