mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
feat: Allows passing in base64-encoded configuration strings
This commit is contained in:
12
hub/hub.go
12
hub/hub.go
@@ -64,8 +64,16 @@ func applyRoute(cfg *config.Config) {
|
||||
}
|
||||
|
||||
// Parse call at the beginning of mihomo
|
||||
func Parse(options ...Option) error {
|
||||
cfg, err := executor.Parse()
|
||||
func Parse(configBytes []byte, options ...Option) error {
|
||||
var cfg *config.Config
|
||||
var err error
|
||||
|
||||
if len(configBytes) != 0 {
|
||||
cfg, err = executor.ParseWithBytes(configBytes)
|
||||
} else {
|
||||
cfg, err = executor.Parse()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user