mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-30 23:37:44 +00:00
allow stdin as input source
This commit is contained in:
4 files changed
+34
-17
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package point
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"v2ray.com/core/app/dns"
|
||||
"v2ray.com/core/app/router"
|
||||
"v2ray.com/core/common"
|
||||
@@ -75,15 +77,15 @@ type Config struct {
|
||||
TransportConfig *transport.Config
|
||||
}
|
||||
|
||||
type ConfigLoader func(init string) (*Config, error)
|
||||
type ConfigLoader func(input io.Reader) (*Config, error)
|
||||
|
||||
var (
|
||||
configLoader ConfigLoader
|
||||
)
|
||||
|
||||
func LoadConfig(init string) (*Config, error) {
|
||||
func LoadConfig(input io.Reader) (*Config, error) {
|
||||
if configLoader == nil {
|
||||
return nil, common.ErrBadConfiguration
|
||||
}
|
||||
return configLoader(init)
|
||||
return configLoader(input)
|
||||
}
|
||||
Reference in new issue
Block a user