diff --git a/net/config.go b/net/config.go index d1634d2c..64863419 100644 --- a/net/config.go +++ b/net/config.go @@ -5,16 +5,3 @@ import "errors" var ( ErrUnableToConnect = errors.New("unable to connect") ) - -type ConfigGetter interface { - GetNet() Config -} - -type Config struct { - Stream StreamConfig `yaml:"stream"` -} - -type StreamConfig struct { - TimeoutMilliseconds int `yaml:"timeoutMilliseconds"` - MaxMsgSizeMb int `yaml:"maxMsgSizeMb"` -} diff --git a/net/rpc/drpcconfig.go b/net/rpc/drpcconfig.go new file mode 100644 index 00000000..551313f6 --- /dev/null +++ b/net/rpc/drpcconfig.go @@ -0,0 +1,13 @@ +package rpc + +type ConfigGetter interface { + GetDrpc() Config +} + +type Config struct { + Stream StreamConfig `yaml:"stream"` +} + +type StreamConfig struct { + MaxMsgSizeMb int `yaml:"maxMsgSizeMb"` +} diff --git a/net/rpc/server/drpcserver.go b/net/rpc/server/drpcserver.go index 2b061515..48b3bfed 100644 --- a/net/rpc/server/drpcserver.go +++ b/net/rpc/server/drpcserver.go @@ -5,7 +5,7 @@ import ( "github.com/anyproto/any-sync/app" "github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/metric" - anyNet "github.com/anyproto/any-sync/net" + "github.com/anyproto/any-sync/net/rpc" "go.uber.org/zap" "net" "storj.io/drpc" @@ -32,7 +32,7 @@ type DRPCServer interface { type drpcServer struct { drpcServer *drpcserver.Server *drpcmux.Mux - config anyNet.Config + config rpc.Config metric metric.Metric } @@ -43,7 +43,7 @@ func (s *drpcServer) Name() (name string) { } func (s *drpcServer) Init(a *app.App) (err error) { - s.config = a.MustComponent("config").(anyNet.ConfigGetter).GetNet() + s.config = a.MustComponent("config").(rpc.ConfigGetter).GetDrpc() s.metric, _ = a.Component(metric.CName).(metric.Metric) s.Mux = drpcmux.New()