1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-22 07:25:23 +00:00

add comments to new added code

This commit is contained in:
vcptr 2019-12-24 01:06:01 +08:00
parent f54bbb903d
commit a36631357c
4 changed files with 10 additions and 0 deletions

View File

@ -2,12 +2,14 @@ package cmdarg
import "strings"
// Arg is used by flag to accept multiple argument.
type Arg []string
func (c *Arg) String() string {
return strings.Join([]string(*c), " ")
}
// Set is the method flag package calls
func (c *Arg) Set(value string) error {
*c = append(*c, value)
return nil

View File

@ -38,6 +38,8 @@ func findOffset(b []byte, o int) *offset {
return &offset{line: line, char: char}
}
// DecodeJSONConfig reads from reader and decode the config into *conf.Config
// syntax error could be detected.
func DecodeJSONConfig(reader io.Reader) (*conf.Config, error) {
jsonConfig := &conf.Config{}

View File

@ -13,12 +13,15 @@ import (
"v2ray.com/core/infra/conf/serial"
)
// ConfigCommand is the json to pb convert struct
type ConfigCommand struct{}
// Name for cmd usage
func (c *ConfigCommand) Name() string {
return "config"
}
// Description for help usage
func (c *ConfigCommand) Description() Description {
return Description{
Short: "merge multiple json config",
@ -26,6 +29,7 @@ func (c *ConfigCommand) Description() Description {
}
}
// Execute real work here.
func (c *ConfigCommand) Execute(args []string) error {
if len(args) < 1 {
return newError("empty config list")
@ -58,6 +62,7 @@ func (c *ConfigCommand) Execute(args []string) error {
return nil
}
// LoadArg loads one arg, maybe an remote url, or local file path
func (c *ConfigCommand) LoadArg(arg string) (out io.Reader, err error) {
var data []byte

View File

@ -37,6 +37,7 @@ func (c *FetchCommand) Execute(args []string) error {
return nil
}
// FetchHTTPContent dials https for remote content
func FetchHTTPContent(target string) ([]byte, error) {
parsedTarget, err := url.Parse(target)