allow stdin as input source

This commit is contained in:
Darien Raymond committed 2016-10-03 11:18:24 +02:00
1 parent 1ee76d31fa
commit fd50e8e12b
4 files changed
+34 -17

No files matched your search

+5 -3
View File
@@ -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)
}