factory

package
v0.0.0-...-b8cd232 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	N3iwfDefaultTLSKeyLogPath  = "./log/n3iwfsslkey.log"
	N3iwfDefaultCertPemPath    = "./cert/n3iwf.pem"
	N3iwfDefaultPrivateKeyPath = "./cert/n3iwf.key"
	N3iwfDefaultConfigPath     = "./config/n3iwfcfg.yaml"
)

Variables

This section is empty.

Functions

func InitConfigFactory

func InitConfigFactory(f string, cfg *Config) error

TODO: Support configuration update from REST api

Types

type AMFSCTPAddresses

type AMFSCTPAddresses struct {
	IPAddresses []string `yaml:"IP" valid:"required"`
	Port        int      `yaml:"Port,omitempty" valid:"port,optional"` // Default port is 38412 if not defined.
}

func (*AMFSCTPAddresses) Validate

func (a *AMFSCTPAddresses) Validate() (bool, error)

type BroadcastPLMNItem

type BroadcastPLMNItem struct {
	PLMNID              PLMNID             `yaml:"PLMNID" valid:"required"`
	TAISliceSupportList []SliceSupportItem `yaml:"TAISliceSupportList" valid:"required"`
}

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 N3iwfConfig *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 {
	N3IWFInfo        N3IWFNFInfo        `yaml:"N3IWFInformation" valid:"required"`
	AMFSCTPAddresses []AMFSCTPAddresses `yaml:"AMFSCTPAddresses" valid:"required"`

	TCPPort              uint16     `yaml:"NASTCPPort" valid:"port,required"`
	IKEBindAddr          string     `yaml:"IKEBindAddress" valid:"host,required"`
	IPSecGatewayAddr     string     `yaml:"IPSecTunnelAddress" valid:"host,required"`
	UEIPAddressRange     string     `yaml:"UEIPAddressRange" valid:"cidr,required"`                // e.g. 10.0.1.0/24
	XfrmIfaceName        string     `yaml:"XFRMInterfaceName" valid:"stringlength(1|10),optional"` // must != 0
	XfrmIfaceId          uint32     `yaml:"XFRMInterfaceID" valid:"numeric,optional"`              // must != 0
	GTPBindAddr          string     `yaml:"GTPBindAddress" valid:"host,required"`
	FQDN                 string     `yaml:"FQDN" valid:"url,required"` // e.g. n3iwf.free5gc.org
	PrivateKey           string     `yaml:"PrivateKey" valid:"type(string),minstringlength(1),optional"`
	CertificateAuthority string     `yaml:"CertificateAuthority" valid:"type(string),minstringlength(1),optional"`
	Certificate          string     `yaml:"Certificate" valid:"type(string),minstringlength(1),optional"`
	LivenessCheck        TimerValue `yaml:"LivenessCheck" valid:"required"`
}

type GlobalN3IWFID

type GlobalN3IWFID struct {
	PLMNID  PLMNID `yaml:"PLMNID" valid:"required"`
	N3IWFID uint16 `yaml:"N3IWFID" valid:"range(0|65535),required"` // with length 2 bytes
}

type Info

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

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 N3IWFNFInfo

type N3IWFNFInfo struct {
	GlobalN3IWFID   GlobalN3IWFID     `yaml:"GlobalN3IWFID" valid:"required"`
	RanNodeName     string            `yaml:"Name,omitempty" valid:"optional"`
	SupportedTAList []SupportedTAItem `yaml:"SupportedTAList" valid:"required"`
}

type PLMNID

type PLMNID struct {
	Mcc string `yaml:"MCC" valid:"numeric,stringlength(3|3),required"`
	Mnc string `yaml:"MNC" valid:"numeric,stringlength(2|3),required"`
}

type SNSSAIItem

type SNSSAIItem struct {
	SST string `yaml:"SST" valid:"hexadecimal,stringlength(1|1),required"`
	SD  string `yaml:"SD,omitempty" valid:"hexadecimal,stringlength(6|6),required"`
}

type SliceSupportItem

type SliceSupportItem struct {
	SNSSAI SNSSAIItem `yaml:"SNSSAI" valid:"required"`
}

type SupportedTAItem

type SupportedTAItem struct {
	TAC               string              `yaml:"TAC" valid:"hexadecimal,stringlength(6|6),required"`
	BroadcastPLMNList []BroadcastPLMNItem `yaml:"BroadcastPLMNList" valid:"required"`
}

type TimerValue

type TimerValue struct {
	Enable        bool          `yaml:"enable" valid:"type(bool)"`
	TransFreq     time.Duration `yaml:"transFreq" valid:"type(time.Duration)"`
	MaxRetryTimes int32         `yaml:"maxRetryTimes,omitempty" valid:"type(int32)"`
}

Jump to

Keyboard shortcuts

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