diff options
author | Valery Piashchynski <[email protected]> | 2020-12-21 19:42:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-21 19:42:23 +0300 |
commit | ee8b4075c0f836d698d1ae505c87c17147de447a (patch) | |
tree | 531d980e5bfb94ee39b03952a97e0445f7955409 /plugins/rpc/config.go | |
parent | 0ad45031047bb479e06ce0a0f496c6db9b2641c9 (diff) |
Move plugins to the roadrunner-plugins repository
Diffstat (limited to 'plugins/rpc/config.go')
-rwxr-xr-x | plugins/rpc/config.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/plugins/rpc/config.go b/plugins/rpc/config.go deleted file mode 100755 index 719fd5e3..00000000 --- a/plugins/rpc/config.go +++ /dev/null @@ -1,49 +0,0 @@ -package rpc - -import ( - "errors" - "net" - "strings" - - "github.com/spiral/roadrunner/v2/util" -) - -// Config defines RPC service config. -type Config struct { - // Listen string - Listen string - - // Disabled disables RPC service. - Disabled bool -} - -// InitDefaults allows to init blank config with pre-defined set of default values. -func (c *Config) InitDefaults() { - if c.Listen == "" { - c.Listen = "tcp://127.0.0.1:6001" - } -} - -// Valid returns nil if config is valid. -func (c *Config) Valid() error { - if dsn := strings.Split(c.Listen, "://"); len(dsn) != 2 { - return errors.New("invalid socket DSN (tcp://:6001, unix://file.sock)") - } - - return nil -} - -// Listener creates new rpc socket Listener. -func (c *Config) Listener() (net.Listener, error) { - return util.CreateListener(c.Listen) -} - -// Dialer creates rpc socket Dialer. -func (c *Config) Dialer() (net.Conn, error) { - dsn := strings.Split(c.Listen, "://") - if len(dsn) != 2 { - return nil, errors.New("invalid socket DSN (tcp://:6001, unix://file.sock)") - } - - return net.Dial(dsn[0], dsn[1]) -} |