mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-17 18:06:15 -05:00
21 lines
546 B
Go
21 lines
546 B
Go
|
package containers
|
||
|
|
||
|
func TryAllParsers(rawConfig []byte, prioritizedParser string) (*Container, error) {
|
||
|
if prioritizedParser != "" {
|
||
|
if parser, found := knownParsers[prioritizedParser]; found {
|
||
|
container, err := parser.ParseSubscriptionContainerDocument(rawConfig)
|
||
|
if err == nil {
|
||
|
return container, nil
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for _, parser := range knownParsers {
|
||
|
container, err := parser.ParseSubscriptionContainerDocument(rawConfig)
|
||
|
if err == nil {
|
||
|
return container, nil
|
||
|
}
|
||
|
}
|
||
|
return nil, newError("no parser found for config")
|
||
|
}
|