From c4944371b062fb0dd3d0b4a8f1fa4c3968b4385d Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sun, 31 Mar 2024 12:57:57 +0800 Subject: [PATCH] Update README.md --- README.md | 8 ++++++++ config.go | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e837b40..7f8c675 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ Configurations | VendorSpecificApplicationID | object | List of vendor-specific application IDs | | CapabilityExchange | object | Configuration for capability exchange | | TransportProtocol | string | Transport layer protocol to use, either "tcp" or "sctp". Defaults to "tcp" | +| TLS | object | TLS Configuration | ### Vendor Specific Application Id Config | Field Name | Type | Description | @@ -122,6 +123,13 @@ Configurations | FirmwareRevision | number | Firmware revision number | | HostIPAddresses | string array | List of host IP addresses | +### TLS Config +| Field Name | Type | Description | +| ---------- | ------- | ---------------------------------- | +| Enable | boolean | Use TLS encrypted connection | +| Cert | String | TLS certificate file, can be empty | +| Key | String | TLS private key file, can be empty | + ### Example The following example demonstrates how to create a Diameter client in k6 with various configuration options. diff --git a/config.go b/config.go index 3f4eaa0..c6da03d 100644 --- a/config.go +++ b/config.go @@ -17,9 +17,9 @@ type DiameterConfig struct { AcctApplicationID *[]uint32 `json:"acctApplicationId,omitempty"` AuthApplicationId *[]uint32 `json:"authApplicationId,omitempty"` VendorSpecificApplicationID *[]VendorSpecificApplicationIDConfig `json:"vendorSpecificApplicationId,omitempty"` + CapabilityExchange *CapabilityExchangeConfig `json:"capabilityExchange,omitempty"` TransportProtocol *string `josn:"transportProtocol,omitempty"` TLS *TLSConfig `json:"tls,omitempty"` - CapabilityExchange *CapabilityExchangeConfig `json:"capabilityExchange,omitempty"` } type VendorSpecificApplicationIDConfig struct { @@ -111,14 +111,6 @@ func setDiameterConfigDefaults(config *DiameterConfig) { if config.VendorSpecificApplicationID == nil { config.VendorSpecificApplicationID = &defaultVendorSpecificApplicationID } - if config.TransportProtocol == nil { - config.TransportProtocol = &defaultTransportProtocol - } - - // Set defaults for TLSConfig - if config.TLS == nil { - config.TLS = &TLSConfig{} - } // Set defaults for CapabilityExchangeConfig if config.CapabilityExchange == nil { @@ -142,6 +134,16 @@ func setDiameterConfigDefaults(config *DiameterConfig) { if config.CapabilityExchange.HostIPAddresses == nil { config.CapabilityExchange.HostIPAddresses = &defaultHostIPAddresses } + + if config.TransportProtocol == nil { + config.TransportProtocol = &defaultTransportProtocol + } + + // Set defaults for TLSConfig + if config.TLS == nil { + config.TLS = &TLSConfig{} + } + } type Duration struct {