ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.
()
| 595 | // ValidateBasic performs basic validation (checking param bounds, etc.) and |
| 596 | // returns an error if any check fails. |
| 597 | func (cfg *RPCConfig) ValidateBasic() error { |
| 598 | if cfg.GRPCMaxOpenConnections < 0 { |
| 599 | return errors.New("grpc-max-open-connections can't be negative") |
| 600 | } |
| 601 | if cfg.MaxOpenConnections < 0 { |
| 602 | return errors.New("max-open-connections can't be negative") |
| 603 | } |
| 604 | if cfg.MaxSubscriptionClients < 0 { |
| 605 | return errors.New("max-subscription-clients can't be negative") |
| 606 | } |
| 607 | if cfg.MaxSubscriptionsPerClient < 0 { |
| 608 | return errors.New("max-subscriptions-per-client can't be negative") |
| 609 | } |
| 610 | if cfg.SubscriptionBufferSize < minSubscriptionBufferSize { |
| 611 | return fmt.Errorf( |
| 612 | "experimental-subscription-buffer-size must be >= %d", |
| 613 | minSubscriptionBufferSize, |
| 614 | ) |
| 615 | } |
| 616 | if cfg.WebSocketWriteBufferSize < cfg.SubscriptionBufferSize { |
| 617 | return fmt.Errorf( |
| 618 | "experimental-websocket-write-buffer-size must be >= experimental-subscription-buffer-size (%d)", |
| 619 | cfg.SubscriptionBufferSize, |
| 620 | ) |
| 621 | } |
| 622 | if cfg.TimeoutBroadcastTxCommit < 0 { |
| 623 | return errors.New("timeout-broadcast-tx-commit can't be negative") |
| 624 | } |
| 625 | if cfg.MaxBodyBytes < 0 { |
| 626 | return errors.New("max-body-bytes can't be negative") |
| 627 | } |
| 628 | if cfg.MaxHeaderBytes < 0 { |
| 629 | return errors.New("max-header-bytes can't be negative") |
| 630 | } |
| 631 | return nil |
| 632 | } |
| 633 | |
| 634 | // IsCorsEnabled returns true if cross-origin resource sharing is enabled. |
| 635 | func (cfg *RPCConfig) IsCorsEnabled() bool { |
nothing calls this directly
no outgoing calls
no test coverage detected