add const ConfigFileName
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ConfigFileName = "tcp_listen_config.json"
|
||||||
|
|
||||||
type ConnErrorType int32
|
type ConnErrorType int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -135,13 +137,14 @@ func printHelpMessage() {
|
|||||||
if tcpListenConfigJSON, err := json.Marshal(tcpListenConfig); err == nil {
|
if tcpListenConfigJSON, err := json.Marshal(tcpListenConfig); err == nil {
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
if err := json.Indent(&out, tcpListenConfigJSON, "", " "); err == nil {
|
if err := json.Indent(&out, tcpListenConfigJSON, "", " "); err == nil {
|
||||||
fmt.Printf("[INFO] Sample JSON config [tcp_listen_config.json]:\n%s\n", string(out.Bytes()))
|
fmt.Printf("[INFO] Sample JSON config [%s]:\n%s\n", ConfigFileName, string(out.Bytes()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func readConfigFile() (*TcpListenConfig, error) {
|
func readConfigFile() (*TcpListenConfig, error) {
|
||||||
configFile, err := os.Open("tcp_listen_config.json")
|
fmt.Printf("[INFO] Load config: %s\n", ConfigFileName)
|
||||||
|
configFile, err := os.Open(ConfigFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user