forked from TrueCloudLab/neoneo-go
rpc: move rpc.Config to pkg/config, remove pkg/rpc
Makes no sense keeping it as is and TLS can be reused in the future.
This commit is contained in:
parent
1e0750e3cd
commit
8e70cd3596
5 changed files with 12 additions and 15 deletions
|
@ -10,7 +10,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/urfave/cli"
|
||||
"go.uber.org/zap"
|
||||
|
@ -303,7 +302,7 @@ func TestConfigureAddresses(t *testing.T) {
|
|||
t.Run("custom RPC address", func(t *testing.T) {
|
||||
cfg := &config.ApplicationConfiguration{
|
||||
Address: defaultAddress,
|
||||
RPC: rpc.Config{
|
||||
RPC: config.RPC{
|
||||
Address: customAddress,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package config
|
|||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc"
|
||||
)
|
||||
|
||||
// ApplicationConfiguration config specific to the node.
|
||||
|
@ -22,7 +21,7 @@ type ApplicationConfiguration struct {
|
|||
Prometheus BasicService `yaml:"Prometheus"`
|
||||
ProtoTickInterval int64 `yaml:"ProtoTickInterval"`
|
||||
Relay bool `yaml:"Relay"`
|
||||
RPC rpc.Config `yaml:"RPC"`
|
||||
RPC RPC `yaml:"RPC"`
|
||||
UnlockWallet Wallet `yaml:"UnlockWallet"`
|
||||
Oracle OracleConfiguration `yaml:"Oracle"`
|
||||
P2PNotary P2PNotary `yaml:"P2PNotary"`
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
@ -58,7 +57,7 @@ func LoadFile(configPath string) (Config, error) {
|
|||
ApplicationConfiguration: ApplicationConfiguration{
|
||||
PingInterval: 30,
|
||||
PingTimeout: 90,
|
||||
RPC: rpc.Config{
|
||||
RPC: RPC{
|
||||
MaxIteratorResultItems: DefaultMaxIteratorResultItems,
|
||||
MaxFindResultItems: 100,
|
||||
MaxNEP11Tokens: 100,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package rpc
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
)
|
||||
|
||||
type (
|
||||
// Config is an RPC service configuration information.
|
||||
Config struct {
|
||||
// RPC is an RPC service configuration information.
|
||||
RPC struct {
|
||||
Address string `yaml:"Address"`
|
||||
Enabled bool `yaml:"Enabled"`
|
||||
EnableCORSWorkaround bool `yaml:"EnableCORSWorkaround"`
|
||||
|
@ -22,11 +22,11 @@ type (
|
|||
SessionBackedByMPT bool `yaml:"SessionBackedByMPT"`
|
||||
SessionPoolSize int `yaml:"SessionPoolSize"`
|
||||
StartWhenSynchronized bool `yaml:"StartWhenSynchronized"`
|
||||
TLSConfig TLSConfig `yaml:"TLSConfig"`
|
||||
TLSConfig TLS `yaml:"TLSConfig"`
|
||||
}
|
||||
|
||||
// TLSConfig describes SSL/TLS configuration.
|
||||
TLSConfig struct {
|
||||
// TLS describes SSL/TLS configuration.
|
||||
TLS struct {
|
||||
Address string `yaml:"Address"`
|
||||
CertFile string `yaml:"CertFile"`
|
||||
Enabled bool `yaml:"Enabled"`
|
|
@ -20,6 +20,7 @@ import (
|
|||
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config/limits"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core"
|
||||
|
@ -43,7 +44,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/neorpc/result/subscriptions"
|
||||
"github.com/nspcc-dev/neo-go/pkg/network"
|
||||
"github.com/nspcc-dev/neo-go/pkg/network/payload"
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc"
|
||||
"github.com/nspcc-dev/neo-go/pkg/services/oracle"
|
||||
"github.com/nspcc-dev/neo-go/pkg/services/oracle/broadcaster"
|
||||
"github.com/nspcc-dev/neo-go/pkg/services/rpcsrv/params"
|
||||
|
@ -62,7 +62,7 @@ type (
|
|||
Server struct {
|
||||
*http.Server
|
||||
chain blockchainer.Blockchainer
|
||||
config rpc.Config
|
||||
config config.RPC
|
||||
// wsReadLimit represents web-socket message limit for a receiving side.
|
||||
wsReadLimit int64
|
||||
network netmode.Magic
|
||||
|
@ -197,7 +197,7 @@ var invalidBlockHeightError = func(index int, height int) *neorpc.Error {
|
|||
var upgrader = websocket.Upgrader{}
|
||||
|
||||
// New creates a new Server struct.
|
||||
func New(chain blockchainer.Blockchainer, conf rpc.Config, coreServer *network.Server,
|
||||
func New(chain blockchainer.Blockchainer, conf config.RPC, coreServer *network.Server,
|
||||
orc *oracle.Oracle, log *zap.Logger, errChan chan error) Server {
|
||||
httpServer := &http.Server{
|
||||
Addr: conf.Address + ":" + strconv.FormatUint(uint64(conf.Port), 10),
|
||||
|
|
Loading…
Reference in a new issue