From 263bf53c80ba0f7182a1606c78cf29eace6892a6 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Tue, 15 Apr 2025 12:38:37 +0300 Subject: [PATCH 1/9] update network traffic schema Signed-off-by: bcmmbaga --- management/server/http/api/openapi.yml | 128 +++++++++++++++--------- management/server/http/api/types.gen.go | 76 ++++++++------ 2 files changed, 127 insertions(+), 77 deletions(-) diff --git a/management/server/http/api/openapi.yml b/management/server/http/api/openapi.yml index 82971541d..58fc3dffc 100644 --- a/management/server/http/api/openapi.yml +++ b/management/server/http/api/openapi.yml @@ -1881,6 +1881,71 @@ components: - os - address - dns_label + NetworkTrafficUser: + type: object + properties: + id: + type: string + nullable: true + description: "UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated)." + example: "google-oauth2|123456789012345678901" + email: + type: string + nullable: true + description: "Email of the user who initiated the event (if any)." + example: "alice@netbird.io" + name: + type: string + nullable: true + description: "Name of the user who initiated the event (if any)." + example: "Alice Smith" + required: + - id + - email + - name + NetworkTrafficPolicy: + type: object + properties: + id: + type: string + description: "ID of the policy that allowed this event." + example: "ch8i4ug6lnn4g9hqv7m0" + name: + type: string + description: "Name of the policy that allowed this event." + example: "All to All" + required: + - id + - name + NetworkTrafficICMP: + type: object + properties: + type: + type: integer + description: "ICMP type (if applicable)." + example: 8 + code: + type: integer + description: "ICMP code (if applicable)." + example: 0 + required: + - type + - code + NetworkTrafficSubEvent: + type: object + properties: + type: + type: string + description: Type of the event (e.g., TYPE_UNKNOWN, TYPE_START, TYPE_END, TYPE_DROP). + example: TYPE_START + timestamp: + type: string + format: date-time + description: Timestamp of the event as sent by the peer. + example: 2025-03-20T16:23:58.125397Z + required: + - type + - timestamp NetworkTrafficEvent: type: object properties: @@ -1896,11 +1961,6 @@ components: type: string description: "ID of the reporter of the event (e.g., the peer that reported the event)." example: "ch8i4ug6lnn4g9hqv7m0" - timestamp: - type: string - format: date-time - description: "Timestamp of the event. Send by the peer." - example: "2025-03-20T16:23:58.125397Z" receive_timestamp: type: string format: date-time @@ -1908,31 +1968,18 @@ components: example: "2025-03-20T16:23:58.125397Z" source: $ref: '#/components/schemas/NetworkTrafficEndpoint' - user_id: - type: string - nullable: true - description: "UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated)." - example: "google-oauth2|123456789012345678901" - user_email: - type: string - nullable: true - description: "Email of the user who initiated the event (if any)." - example: "alice@netbird.io" - user_name: - type: string - nullable: true - description: "Name of the user who initiated the event (if any)." - example: "Alice Smith" destination: $ref: '#/components/schemas/NetworkTrafficEndpoint' + user: + $ref: '#/components/schemas/NetworkTrafficUser' + policy: + $ref: '#/components/schemas/NetworkTrafficPolicy' + icmp: + $ref: '#/components/schemas/NetworkTrafficICMP' protocol: type: integer description: "Protocol is the protocol of the traffic (e.g. 1 = ICMP, 6 = TCP, 17 = UDP, etc.)." example: 6 - type: - type: string - description: "Type of the event (e.g. TYPE_UNKNOWN, TYPE_START, TYPE_END, TYPE_DROP)." - example: "TYPE_START" direction: type: string description: "Direction of the traffic (e.g. DIRECTION_UNKNOWN, INGRESS, EGRESS)." @@ -1953,43 +2000,28 @@ components: type: integer description: "Number of packets transmitted." example: 5 - policy_id: - type: string - description: "ID of the policy that allowed this event." - example: "ch8i4ug6lnn4g9hqv7m0" - policy_name: - type: string - description: "Name of the policy that allowed this event." - example: "All to All" - icmp_type: - type: integer - description: "ICMP type (if applicable)." - example: 8 - icmp_code: - type: integer - description: "ICMP code (if applicable)." - example: 0 + events: + type: array + description: "List of events that are correlated to this flow (e.g., start, end)." + items: + $ref: '#/components/schemas/NetworkTrafficSubEvent' required: - id - flow_id - reporter_id - - timestamp - receive_timestamp - source - - user_id - - user_email - destination + - user + - policy + - icmp - protocol - - type - direction - rx_bytes - rx_packets - tx_bytes - tx_packets - - policy_id - - policy_name - - icmp_type - - icmp_code + - events responses: not_found: description: Resource not found diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index 751311333..e47e7735d 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -230,7 +230,7 @@ type Account struct { // AccountExtraSettings defines model for AccountExtraSettings. type AccountExtraSettings struct { - // NetworkTrafficLogsEnabled Enables or disables network traffic logs. If enabled, all network traffic logs from peers will be stored. + // NetworkTrafficLogsEnabled Enables or disables network traffic logging. If enabled, all network traffic events from peers will be stored. NetworkTrafficLogsEnabled bool `json:"network_traffic_logs_enabled"` // NetworkTrafficPacketCounterEnabled Enables or disables network traffic packet counter. If enabled, network packets and their size will be counted and reported. (This can have an slight impact on performance) @@ -852,23 +852,16 @@ type NetworkTrafficEvent struct { // Direction Direction of the traffic (e.g. DIRECTION_UNKNOWN, INGRESS, EGRESS). Direction string `json:"direction"` + // Events List of events that are correlated to this flow (e.g., start, end). + Events []NetworkTrafficSubEvent `json:"events"` + // FlowId FlowID is the ID of the connection flow. Not unique because it can be the same for multiple events (e.g., start and end of the connection). - FlowId string `json:"flow_id"` - - // IcmpCode ICMP code (if applicable). - IcmpCode int `json:"icmp_code"` - - // IcmpType ICMP type (if applicable). - IcmpType int `json:"icmp_type"` + FlowId string `json:"flow_id"` + Icmp NetworkTrafficICMP `json:"icmp"` // Id ID of the event. Unique. - Id string `json:"id"` - - // PolicyId ID of the policy that allowed this event. - PolicyId string `json:"policy_id"` - - // PolicyName Name of the policy that allowed this event. - PolicyName string `json:"policy_name"` + Id string `json:"id"` + Policy NetworkTrafficPolicy `json:"policy"` // Protocol Protocol is the protocol of the traffic (e.g. 1 = ICMP, 6 = TCP, 17 = UDP, etc.). Protocol int `json:"protocol"` @@ -886,26 +879,21 @@ type NetworkTrafficEvent struct { RxPackets int `json:"rx_packets"` Source NetworkTrafficEndpoint `json:"source"` - // Timestamp Timestamp of the event. Send by the peer. - Timestamp time.Time `json:"timestamp"` - // TxBytes Number of bytes transmitted. TxBytes int `json:"tx_bytes"` // TxPackets Number of packets transmitted. - TxPackets int `json:"tx_packets"` + TxPackets int `json:"tx_packets"` + User NetworkTrafficUser `json:"user"` +} - // Type Type of the event (e.g. TYPE_UNKNOWN, TYPE_START, TYPE_END, TYPE_DROP). - Type string `json:"type"` +// NetworkTrafficICMP defines model for NetworkTrafficICMP. +type NetworkTrafficICMP struct { + // Code ICMP code (if applicable). + Code int `json:"code"` - // UserEmail Email of the user who initiated the event (if any). - UserEmail *string `json:"user_email"` - - // UserId UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated). - UserId *string `json:"user_id"` - - // UserName Name of the user who initiated the event (if any). - UserName *string `json:"user_name"` + // Type ICMP type (if applicable). + Type int `json:"type"` } // NetworkTrafficLocation defines model for NetworkTrafficLocation. @@ -917,6 +905,36 @@ type NetworkTrafficLocation struct { CountryCode string `json:"country_code"` } +// NetworkTrafficPolicy defines model for NetworkTrafficPolicy. +type NetworkTrafficPolicy struct { + // Id ID of the policy that allowed this event. + Id string `json:"id"` + + // Name Name of the policy that allowed this event. + Name string `json:"name"` +} + +// NetworkTrafficSubEvent defines model for NetworkTrafficSubEvent. +type NetworkTrafficSubEvent struct { + // Timestamp Timestamp of the event as sent by the peer. + Timestamp time.Time `json:"timestamp"` + + // Type Type of the event (e.g., TYPE_UNKNOWN, TYPE_START, TYPE_END, TYPE_DROP). + Type string `json:"type"` +} + +// NetworkTrafficUser defines model for NetworkTrafficUser. +type NetworkTrafficUser struct { + // Email Email of the user who initiated the event (if any). + Email *string `json:"email"` + + // Id UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated). + Id *string `json:"id"` + + // Name Name of the user who initiated the event (if any). + Name *string `json:"name"` +} + // OSVersionCheck Posture check for the version of operating system type OSVersionCheck struct { // Android Posture check for the version of operating system From 446ad0e9de5e4ec5e9cd2494c963f02b06b09bf0 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Wed, 16 Apr 2025 00:55:38 +0300 Subject: [PATCH 2/9] Remove id and received timestamp from correlated event Signed-off-by: bcmmbaga --- management/server/http/api/openapi.yml | 9 --------- management/server/http/api/types.gen.go | 10 ++-------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/management/server/http/api/openapi.yml b/management/server/http/api/openapi.yml index 58fc3dffc..cd4efce07 100644 --- a/management/server/http/api/openapi.yml +++ b/management/server/http/api/openapi.yml @@ -1949,10 +1949,6 @@ components: NetworkTrafficEvent: type: object properties: - id: - type: string - description: "ID of the event. Unique." - example: "18e204d6-f7c6-405d-8025-70becb216add" flow_id: type: string description: "FlowID is the ID of the connection flow. Not unique because it can be the same for multiple events (e.g., start and end of the connection)." @@ -1961,11 +1957,6 @@ components: type: string description: "ID of the reporter of the event (e.g., the peer that reported the event)." example: "ch8i4ug6lnn4g9hqv7m0" - receive_timestamp: - type: string - format: date-time - description: "Timestamp when the event was received by our API." - example: "2025-03-20T16:23:58.125397Z" source: $ref: '#/components/schemas/NetworkTrafficEndpoint' destination: diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index e47e7735d..e0d1e43d5 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -856,19 +856,13 @@ type NetworkTrafficEvent struct { Events []NetworkTrafficSubEvent `json:"events"` // FlowId FlowID is the ID of the connection flow. Not unique because it can be the same for multiple events (e.g., start and end of the connection). - FlowId string `json:"flow_id"` - Icmp NetworkTrafficICMP `json:"icmp"` - - // Id ID of the event. Unique. - Id string `json:"id"` + FlowId string `json:"flow_id"` + Icmp NetworkTrafficICMP `json:"icmp"` Policy NetworkTrafficPolicy `json:"policy"` // Protocol Protocol is the protocol of the traffic (e.g. 1 = ICMP, 6 = TCP, 17 = UDP, etc.). Protocol int `json:"protocol"` - // ReceiveTimestamp Timestamp when the event was received by our API. - ReceiveTimestamp time.Time `json:"receive_timestamp"` - // ReporterId ID of the reporter of the event (e.g., the peer that reported the event). ReporterId string `json:"reporter_id"` From cab9b4caf49fca13346b331ad86ac120a19c9401 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Wed, 16 Apr 2025 16:10:18 +0300 Subject: [PATCH 3/9] Update user properties to remove nullable types Signed-off-by: bcmmbaga --- management/server/http/api/openapi.yml | 3 --- management/server/http/api/types.gen.go | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/management/server/http/api/openapi.yml b/management/server/http/api/openapi.yml index cd4efce07..5d346f226 100644 --- a/management/server/http/api/openapi.yml +++ b/management/server/http/api/openapi.yml @@ -1886,17 +1886,14 @@ components: properties: id: type: string - nullable: true description: "UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated)." example: "google-oauth2|123456789012345678901" email: type: string - nullable: true description: "Email of the user who initiated the event (if any)." example: "alice@netbird.io" name: type: string - nullable: true description: "Name of the user who initiated the event (if any)." example: "Alice Smith" required: diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index e0d1e43d5..b73c64de2 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -920,13 +920,13 @@ type NetworkTrafficSubEvent struct { // NetworkTrafficUser defines model for NetworkTrafficUser. type NetworkTrafficUser struct { // Email Email of the user who initiated the event (if any). - Email *string `json:"email"` + Email string `json:"email"` // Id UserID is the ID of the user that initiated the event (can be empty as not every event is user-initiated). - Id *string `json:"id"` + Id string `json:"id"` // Name Name of the user who initiated the event (if any). - Name *string `json:"name"` + Name string `json:"name"` } // OSVersionCheck Posture check for the version of operating system From c32f02ac6d1af969c02105c1064d1e424a1f03c8 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Fri, 18 Apr 2025 23:46:01 +0300 Subject: [PATCH 4/9] Refactor test container functions to return DSN string Updated MySQL and PostgreSQL test container functions to return the DSN string instead of setting environment variables Signed-off-by: bcmmbaga --- management/server/store/store.go | 16 ++++++++-------- management/server/testutil/store.go | 19 ++++++++----------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/management/server/store/store.go b/management/server/store/store.go index c13a8dfe6..1bd7fab69 100644 --- a/management/server/store/store.go +++ b/management/server/store/store.go @@ -415,16 +415,16 @@ func getSqlStoreEngine(ctx context.Context, store *SqlStore, kind types.Engine) } func newReusedPostgresStore(ctx context.Context, store *SqlStore, kind types.Engine) (*SqlStore, func(), error) { - if envDsn, ok := os.LookupEnv(postgresDsnEnv); !ok || envDsn == "" { + dsn, ok := os.LookupEnv(postgresDsnEnv) + if !ok || dsn == "" { var err error - _, err = testutil.CreatePostgresTestContainer() + _, dsn, err = testutil.CreatePostgresTestContainer() if err != nil { return nil, nil, err } } - dsn, ok := os.LookupEnv(postgresDsnEnv) - if !ok { + if dsn == "" { return nil, nil, fmt.Errorf("%s is not set", postgresDsnEnv) } @@ -447,16 +447,16 @@ func newReusedPostgresStore(ctx context.Context, store *SqlStore, kind types.Eng } func newReusedMysqlStore(ctx context.Context, store *SqlStore, kind types.Engine) (*SqlStore, func(), error) { - if envDsn, ok := os.LookupEnv(mysqlDsnEnv); !ok || envDsn == "" { + dsn, ok := os.LookupEnv(mysqlDsnEnv) + if !ok || dsn == "" { var err error - _, err = testutil.CreateMysqlTestContainer() + _, dsn, err = testutil.CreateMysqlTestContainer() if err != nil { return nil, nil, err } } - dsn, ok := os.LookupEnv(mysqlDsnEnv) - if !ok { + if dsn == "" { return nil, nil, fmt.Errorf("%s is not set", mysqlDsnEnv) } diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index 8672efa7f..e982be864 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -5,7 +5,6 @@ package testutil import ( "context" - "os" "time" log "github.com/sirupsen/logrus" @@ -16,7 +15,7 @@ import ( ) // CreateMysqlTestContainer creates a new MySQL container for testing. -func CreateMysqlTestContainer() (func(), error) { +func CreateMysqlTestContainer() (func(), string, error) { ctx := context.Background() myContainer, err := mysql.RunContainer(ctx, @@ -30,11 +29,10 @@ func CreateMysqlTestContainer() (func(), error) { ), ) if err != nil { - return nil, err + return nil, "", err } cleanup := func() { - os.Unsetenv("NETBIRD_STORE_ENGINE_MYSQL_DSN") timeoutCtx, cancelFunc := context.WithTimeout(ctx, 1*time.Second) defer cancelFunc() if err = myContainer.Terminate(timeoutCtx); err != nil { @@ -44,14 +42,14 @@ func CreateMysqlTestContainer() (func(), error) { talksConn, err := myContainer.ConnectionString(ctx) if err != nil { - return nil, err + return nil, "", err } - return cleanup, os.Setenv("NETBIRD_STORE_ENGINE_MYSQL_DSN", talksConn) + return cleanup, talksConn, nil } // CreatePostgresTestContainer creates a new PostgreSQL container for testing. -func CreatePostgresTestContainer() (func(), error) { +func CreatePostgresTestContainer() (func(), string, error) { ctx := context.Background() pgContainer, err := postgres.RunContainer(ctx, @@ -65,11 +63,10 @@ func CreatePostgresTestContainer() (func(), error) { ), ) if err != nil { - return nil, err + return nil, "", err } cleanup := func() { - os.Unsetenv("NETBIRD_STORE_ENGINE_POSTGRES_DSN") timeoutCtx, cancelFunc := context.WithTimeout(ctx, 1*time.Second) defer cancelFunc() if err = pgContainer.Terminate(timeoutCtx); err != nil { @@ -79,8 +76,8 @@ func CreatePostgresTestContainer() (func(), error) { talksConn, err := pgContainer.ConnectionString(ctx) if err != nil { - return nil, err + return nil, "", err } - return cleanup, os.Setenv("NETBIRD_STORE_ENGINE_POSTGRES_DSN", talksConn) + return cleanup, talksConn, nil } From 1dbca5a77279d348137a64b43b2989a047d75d31 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Tue, 22 Apr 2025 12:36:11 +0300 Subject: [PATCH 5/9] fix test containers cleanup Signed-off-by: bcmmbaga --- management/server/store/store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/server/store/store.go b/management/server/store/store.go index 1bd7fab69..ae14093cb 100644 --- a/management/server/store/store.go +++ b/management/server/store/store.go @@ -435,12 +435,12 @@ func newReusedPostgresStore(ctx context.Context, store *SqlStore, kind types.Eng dsn, cleanup, err := createRandomDB(dsn, db, kind) if err != nil { - return nil, cleanup, err + return nil, nil, err } store, err = NewPostgresqlStoreFromSqlStore(ctx, store, dsn, nil) if err != nil { - return nil, cleanup, err + return nil, nil, err } return store, cleanup, nil @@ -467,7 +467,7 @@ func newReusedMysqlStore(ctx context.Context, store *SqlStore, kind types.Engine dsn, cleanup, err := createRandomDB(dsn, db, kind) if err != nil { - return nil, cleanup, err + return nil, nil, err } store, err = NewMysqlStoreFromSqlStore(ctx, store, dsn, nil) From f2e2e93bea84f7caf6b82020b4a9ba56650fd903 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Tue, 22 Apr 2025 14:49:21 +0300 Subject: [PATCH 6/9] Reuse MySQL and Postgres containers in tests Signed-off-by: bcmmbaga --- management/server/store/store.go | 7 ++++-- management/server/testutil/store.go | 36 +++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/management/server/store/store.go b/management/server/store/store.go index ae14093cb..a071c1325 100644 --- a/management/server/store/store.go +++ b/management/server/store/store.go @@ -353,11 +353,14 @@ func NewTestStoreFromSQL(ctx context.Context, filename string, dataDir string) ( return nil, nil, fmt.Errorf("failed to add all group to account: %v", err) } + var sqlStore Store + var cleanup func() + maxRetries := 2 for i := 0; i < maxRetries; i++ { - sqlStore, cleanUp, err := getSqlStoreEngine(ctx, store, kind) + sqlStore, cleanup, err = getSqlStoreEngine(ctx, store, kind) if err == nil { - return sqlStore, cleanUp, nil + return sqlStore, cleanup, nil } if i < maxRetries-1 { time.Sleep(100 * time.Millisecond) diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index e982be864..705934309 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -14,11 +14,25 @@ import ( "github.com/testcontainers/testcontainers-go/wait" ) +var ( + pgContainer *postgres.PostgresContainer + mysqlContainer *mysql.MySQLContainer +) + // CreateMysqlTestContainer creates a new MySQL container for testing. func CreateMysqlTestContainer() (func(), string, error) { ctx := context.Background() - myContainer, err := mysql.RunContainer(ctx, + if mysqlContainer != nil { + connStr, err := mysqlContainer.ConnectionString(ctx) + if err != nil { + return nil, "", err + } + return noOpCleanup, connStr, nil + } + + var err error + mysqlContainer, err = mysql.RunContainer(ctx, testcontainers.WithImage("mlsmaycon/warmed-mysql:8"), mysql.WithDatabase("testing"), mysql.WithUsername("root"), @@ -35,12 +49,12 @@ func CreateMysqlTestContainer() (func(), string, error) { cleanup := func() { timeoutCtx, cancelFunc := context.WithTimeout(ctx, 1*time.Second) defer cancelFunc() - if err = myContainer.Terminate(timeoutCtx); err != nil { - log.WithContext(ctx).Warnf("failed to stop mysql container %s: %s", myContainer.GetContainerID(), err) + if err = mysqlContainer.Terminate(timeoutCtx); err != nil { + log.WithContext(ctx).Warnf("failed to stop mysql container %s: %s", mysqlContainer.GetContainerID(), err) } } - talksConn, err := myContainer.ConnectionString(ctx) + talksConn, err := mysqlContainer.ConnectionString(ctx) if err != nil { return nil, "", err } @@ -52,7 +66,16 @@ func CreateMysqlTestContainer() (func(), string, error) { func CreatePostgresTestContainer() (func(), string, error) { ctx := context.Background() - pgContainer, err := postgres.RunContainer(ctx, + if pgContainer != nil { + connStr, err := pgContainer.ConnectionString(ctx) + if err != nil { + return nil, "", err + } + return noOpCleanup, connStr, nil + } + + var err error + pgContainer, err = postgres.RunContainer(ctx, testcontainers.WithImage("postgres:16-alpine"), postgres.WithDatabase("netbird"), postgres.WithUsername("root"), @@ -81,3 +104,6 @@ func CreatePostgresTestContainer() (func(), string, error) { return cleanup, talksConn, nil } + +// noOpCleanup does nothing, used when the container is reused +func noOpCleanup() {} From 34e74ffb8ac9394ed0d2ce8d1e92c99954113c4b Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Tue, 22 Apr 2025 15:10:49 +0300 Subject: [PATCH 7/9] fix sonar Signed-off-by: bcmmbaga --- management/server/testutil/store.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index 705934309..a7381da12 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -105,5 +105,6 @@ func CreatePostgresTestContainer() (func(), string, error) { return cleanup, talksConn, nil } -// noOpCleanup does nothing, used when the container is reused -func noOpCleanup() {} +func noOpCleanup() { + // no-op +} From bf091cdaff434ecfe9e3cb3d13fc5b79d47ed371 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Fri, 25 Apr 2025 17:54:46 +0300 Subject: [PATCH 8/9] Fix func signature Signed-off-by: bcmmbaga --- management/server/testutil/store_ios.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/management/server/testutil/store_ios.go b/management/server/testutil/store_ios.go index edde62f1e..35de3992d 100644 --- a/management/server/testutil/store_ios.go +++ b/management/server/testutil/store_ios.go @@ -3,14 +3,14 @@ package testutil -func CreatePostgresTestContainer() (func(), error) { +func CreatePostgresTestContainer() (func(), string, error) { return func() { // Empty function for Postgres - }, nil + }, "", nil } -func CreateMysqlTestContainer() (func(), error) { +func CreateMysqlTestContainer() (func(), string, error) { return func() { // Empty function for MySQL - }, nil + }, "", nil } From de7cf681690429e7fbbc15bdbdd89724e06441b8 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Wed, 30 Apr 2025 12:59:00 +0300 Subject: [PATCH 9/9] regenerate api specs Signed-off-by: bcmmbaga --- management/server/http/api/types.gen.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index a2a554b17..1d50a4354 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -910,15 +910,6 @@ type NetworkTrafficEvent struct { User NetworkTrafficUser `json:"user"` } -// NetworkTrafficICMP defines model for NetworkTrafficICMP. -type NetworkTrafficICMP struct { - // Code ICMP code (if applicable). - Code int `json:"code"` - - // Type ICMP type (if applicable). - Type int `json:"type"` -} - // NetworkTrafficEventsResponse defines model for NetworkTrafficEventsResponse. type NetworkTrafficEventsResponse struct { // Data List of network traffic events @@ -937,6 +928,15 @@ type NetworkTrafficEventsResponse struct { TotalRecords int `json:"total_records"` } +// NetworkTrafficICMP defines model for NetworkTrafficICMP. +type NetworkTrafficICMP struct { + // Code ICMP code (if applicable). + Code int `json:"code"` + + // Type ICMP type (if applicable). + Type int `json:"type"` +} + // NetworkTrafficLocation defines model for NetworkTrafficLocation. type NetworkTrafficLocation struct { // CityName Name of the city (if known).