Browse Source

add comments to new added code

vcptr 6 years ago
parent
commit
a36631357c
4 changed files with 10 additions and 0 deletions
  1. 2 0
      common/cmdarg/cmdarg.go
  2. 2 0
      infra/conf/serial/loader.go
  3. 5 0
      infra/control/config.go
  4. 1 0
      infra/control/fetch.go

+ 2 - 0
common/cmdarg/cmdarg.go

@@ -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

+ 2 - 0
infra/conf/serial/loader.go

@@ -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{}
 

+ 5 - 0
infra/control/config.go

@@ -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

+ 1 - 0
infra/control/fetch.go

@@ -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)