config

package
v3.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	LedgerHost                              string `validate:"required"`
	LedgerPort                              uint16 `validate:"lt=65536"`
	LedgerPrivilegedPort                    uint16 `validate:"lt=65536"`
	CertHolderID                            string `validate:"required"`
	CertVersion                             int
	Cert                                    string `validate:"required"`
	PrivateKey                              string `validate:"required"`
	IsTLSEnabled                            bool
	TLSCaRootCert                           string `validate:"required_if=IsTLSEnabled true"`
	AuthorizationCredential                 string
	ClientMode                              string `validate:"required,oneof=CLIENT INTERMEDIARY"`
	ProxyServer                             string
	IsAuditorEnabled                        bool
	AuditorHost                             string `validate:"required_if=IsAuditorEnabled true"`
	AuditorPort                             uint16 `validate:"lt=65536"`
	AuditorPrivilegedPort                   uint16 `validate:"lt=65536"`
	IsAuditorTLSEnabled                     bool
	AuditorTLSCaRootCert                    string `validate:"required_if=IsAuditorTLSEnabled true"`
	IsAuditorLinearizableValidationEnabled  bool
	AuditorLinearizableValidationContractID string `validate:"required_if=IsAuditorLinearizableValidationEnabled true"`
}

ClientConfig defines the structure of the configurations that is used in ClientService. We can use NewClientConfigFromJavaProperties to create it from Java Properties, or use NewClientConfigFromJSON to create it from JSON.

func NewClientConfigFromJSON

func NewClientConfigFromJSON(json string) (ClientConfig, error)

NewClientConfigFromJSON parses the given JSON string to create ClientConfig according to correspoinding properties.

func NewClientConfigFromJavaProperties

func NewClientConfigFromJavaProperties(javaProperties string) (ClientConfig, error)

NewClientConfigFromJavaProperties parses the given Java Properties string to create ClientConfig according to correspoinding properties.

func NewClientConfigWithDefaultValues

func NewClientConfigWithDefaultValues() ClientConfig

NewClientConfigWithDefaultValues creates ClientConfig instance with following default values.

ClientConfig{
		LedgerHost:                              "localhost",
		LedgerPort:                              50051,
		LedgerPrivilegedPort:                    50052,
		CertVersion:                             1,
		IsTLSEnabled:                            false,
		IsAuditorEnabled:                        false,
		ClientMode:                              "CLIENT",
		AuditorHost:                             "localhost",
		AuditorPort:                             40051,
		AuditorPrivilegedPort:                   40052,
		IsAuditorTLSEnabled:                     false,
		IsAuditorLinearizableValidationEnabled:  false,
		AuditorLinearizableValidationContractID: "validate-ledger",
	}

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

Validate checks if mandatory fields are assign and well-formatted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL