factory

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChfDefaultTLSKeyLogPath       = "./log/chfsslkey.log"
	ChfDefaultTLSPemPath          = "./cert/chf.pem"
	ChfDefaultTLSKeyPath          = "./cert/chf.key"
	ChfDefaultConfigPath          = "./config/chfcfg.yaml"
	ChfSbiDefaultIPv4             = "127.0.0.113"
	ChfSbiDefaultPort             = 8000
	ChfSbiDefaultScheme           = "https"
	ChfDefaultNrfUri              = "https://127.0.0.10:8000"
	CgfDefaultCdrFilePath         = "/tmp"
	ConvergedChargingResUriPrefix = "/nchf-convergedcharging/v3"
)

Variables

This section is empty.

Functions

func InitConfigFactory

func InitConfigFactory(f string, cfg *Config) error

TODO: Support configuration update from REST api

Types

type Cgf

type Cgf struct {
	HostIPv4    string `yaml:"hostIPv4,omitempty" valid:"required,host"`
	Port        int    `yaml:"port,omitempty" valid:"required,port"`
	ListenPort  int    `yaml:"listenPort,omitempty" valid:"required,port"`
	Tls         *Tls   `yaml:"tls,omitempty" valid:"optional"`
	CdrFilePath string `yaml:"cdrFilePath,omitempty" valid:"optional"`
}

type Config

type Config struct {
	Info          *Info          `yaml:"info" valid:"required"`
	Configuration *Configuration `yaml:"configuration" valid:"required"`
	Logger        *Logger        `yaml:"logger" valid:"required"`
	sync.RWMutex
}
var ChfConfig *Config

func ReadConfig

func ReadConfig(cfgPath string) (*Config, error)

func (*Config) GetLogEnable

func (c *Config) GetLogEnable() bool

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

func (*Config) GetLogReportCaller

func (c *Config) GetLogReportCaller() bool

func (*Config) GetVersion

func (c *Config) GetVersion() string

func (*Config) SetLogEnable

func (c *Config) SetLogEnable(enable bool)

func (*Config) SetLogLevel

func (c *Config) SetLogLevel(level string)

func (*Config) SetLogReportCaller

func (c *Config) SetLogReportCaller(reportCaller bool)

func (*Config) Validate

func (c *Config) Validate() (bool, error)

type Configuration

type Configuration struct {
	ChfName             string    `yaml:"chfName,omitempty" valid:"required, type(string)"`
	Sbi                 *Sbi      `yaml:"sbi,omitempty" valid:"required"`
	ServiceNameList     []string  `yaml:"serviceNameList,omitempty" valid:"required"`
	NrfUri              string    `yaml:"nrfUri,omitempty" valid:"required, url"`
	NrfCertPem          string    `yaml:"nrfCertPem,omitempty" valid:"optional"`
	Mongodb             *Mongodb  `yaml:"mongodb" valid:"required"`
	VolumeLimit         int32     `yaml:"volumeLimit,omitempty" valid:"optional"`
	VolumeLimitPDU      int32     `yaml:"volumeLimitPDU,omitempty" valid:"optional"`
	ReserveQuotaRatio   int32     `yaml:"reserveQuotaRatio,omitempty" valid:"optional"`
	VolumeThresholdRate float32   `yaml:"volumeThresholdRate,omitempty" valid:"optional"`
	QuotaValidityTime   int32     `yaml:"quotaValidityTime,omitempty" valid:"optional"`
	RfDiameter          *Diameter `yaml:"rfDiameter,omitempty" valid:"required"`
	AbmfDiameter        *Diameter `yaml:"abmfDiameter,omitempty" valid:"required"`
	Cgf                 *Cgf      `yaml:"cgf,omitempty" valid:"required"`
}

type Diameter

type Diameter struct {
	Protocol string `yaml:"protocol" valid:"required"`
	HostIPv4 string `yaml:"hostIPv4,omitempty" valid:"required,host"`
	Port     int    `yaml:"port,omitempty" valid:"required,port"`
	Tls      *Tls   `yaml:"tls,omitempty" valid:"optional"`
}

type Info

type Info struct {
	Version     string `yaml:"version,omitempty" valid:"required,in(1.0.3)"`
	Description string `yaml:"description,omitempty" valid:"-"`
}

type Logger

type Logger struct {
	Enable       bool   `yaml:"enable" valid:"type(bool)"`
	Level        string `yaml:"level" valid:"required,in(trace|debug|info|warn|error|fatal|panic)"`
	ReportCaller bool   `yaml:"reportCaller" valid:"type(bool)"`
}

type Mongodb

type Mongodb struct {
	Name string `yaml:"name" valid:"required, type(string)"`
	Url  string `yaml:"url" valid:"required"`
}

type Sbi

type Sbi struct {
	Scheme       string `yaml:"scheme" valid:"required,scheme"`
	RegisterIPv4 string `yaml:"registerIPv4,omitempty" valid:"required,host"` // IP that is registered at NRF.
	BindingIPv4  string `yaml:"bindingIPv4,omitempty" valid:"required,host"`  // IP used to run the server in the node.
	Port         int    `yaml:"port,omitempty" valid:"required,port"`
	Tls          *Tls   `yaml:"tls,omitempty" valid:"optional"`
}

type Service

type Service struct {
	ServiceName string `yaml:"serviceName" valid:"required, service"`
	SuppFeat    string `yaml:"suppFeat,omitempty" valid:"-"`
}

type Tls

type Tls struct {
	Pem string `yaml:"pem,omitempty" valid:"type(string),minstringlength(1),required"`
	Key string `yaml:"key,omitempty" valid:"type(string),minstringlength(1),required"`
}

Jump to

Keyboard shortcuts

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