[cli] support UNIX domain socket
@@ -31,6 +31,7 @@ var (
cfgFile string
host string
port int32
+ sock string
crtFile string
cacrtFile string
@@ -83,6 +84,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&keyFile, "tlskey", "", "client key file for TLS ")
rootCmd.PersistentFlags().StringVarP(&host, "host", "H", "localhost", "Host address to aergo server")
rootCmd.PersistentFlags().Int32VarP(&port, "port", "p", 7845, "Port number to aergo server")
+ rootCmd.PersistentFlags().StringVarP(&sock, "sock", "s", "localhost", "Unix domain socket file path to connect an aergo server")
rootCmd.PersistentFlags().StringVar(&dataDir, "keystore", "$HOME/.aergo", "Path to keystore")
rootCmd.PersistentFlags().BoolVar(&remoteKeystore, "node-keystore", false, "use node keystore")
}
@@ -118,6 +120,9 @@ func Execute() {
// GetServerAddress return ip address and port of server
func GetServerAddress() string {
+ if len(sock) > 0 {
+ return fmt.Sprintf("unix:%s", sock)
+ }
return fmt.Sprintf("%s:%d", rootConfig.Host, rootConfig.Port)
}
