@@ -32,6 +32,7 @@ import (
3232 "github.com/vishvananda/netlink"
3333
3434 "kmesh.net/kmesh/pkg/constants"
35+ "kmesh.net/kmesh/pkg/controller/encryption"
3536)
3637
3738// DecodeHex is a utility function to decode a hex string into bytes.
@@ -48,13 +49,13 @@ func TestLoadIPSecKey(t *testing.T) {
4849 aeadKey := DecodeHex ("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161" )
4950 tests := []struct {
5051 name string
51- keyData IpSecKey
52+ keyData encryption. IpSecKey
5253 expectError bool
5354 errorMsg string
5455 }{
5556 { // Valid
5657 name : "valid_rfc4106_key" ,
57- keyData : IpSecKey {
58+ keyData : encryption. IpSecKey {
5859 Spi : 1 ,
5960 AeadKeyName : "rfc4106(gcm(aes))" ,
6061 AeadKey : aeadKey ,
@@ -64,7 +65,7 @@ func TestLoadIPSecKey(t *testing.T) {
6465 },
6566 {
6667 name : "invalid_algo_name" ,
67- keyData : IpSecKey {
68+ keyData : encryption. IpSecKey {
6869 Spi : 3 ,
6970 AeadKeyName : "aes-gcm" , // should start with "rfc"
7071 AeadKey : aeadKey ,
@@ -75,7 +76,7 @@ func TestLoadIPSecKey(t *testing.T) {
7576 },
7677 {
7778 name : "empty_algo_name" ,
78- keyData : IpSecKey {
79+ keyData : encryption. IpSecKey {
7980 Spi : 4 ,
8081 AeadKeyName : "" ,
8182 AeadKey : aeadKey ,
@@ -161,13 +162,13 @@ func TestLoadIPSecKey(t *testing.T) {
161162 // Test multiple key loading (should update history)
162163 tests = []struct {
163164 name string
164- keyData IpSecKey
165+ keyData encryption. IpSecKey
165166 expectError bool
166167 errorMsg string
167168 }{
168169 {
169170 name : "first_key" ,
170- keyData : IpSecKey {
171+ keyData : encryption. IpSecKey {
171172 Spi : 1 ,
172173 AeadKeyName : "rfc4106(gcm(aes))" ,
173174 AeadKey : aeadKey ,
@@ -177,7 +178,7 @@ func TestLoadIPSecKey(t *testing.T) {
177178 },
178179 {
179180 name : "second_key" ,
180- keyData : IpSecKey {
181+ keyData : encryption. IpSecKey {
181182 Spi : 2 ,
182183 AeadKeyName : "rfc4106(gcm(aes))" ,
183184 AeadKey : DecodeHex ("abc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161" ),
@@ -334,7 +335,7 @@ func hasStateRule(state *netlink.XfrmState) (bool, error) {
334335func TestCreateStateRule (t * testing.T ) {
335336 handler := NewIpSecHandler ()
336337 testKey := DecodeHex ("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161" )
337- ipsecKey := IpSecKey {
338+ ipsecKey := encryption. IpSecKey {
338339 Spi : 1001 ,
339340 AeadKeyName : "rfc4106(gcm(aes))" ,
340341 AeadKey : testKey ,
@@ -536,7 +537,7 @@ func TestFlush(t *testing.T) {
536537
537538 // create state rule
538539 testKey := DecodeHex ("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161" )
539- ipsecKey := IpSecKey {
540+ ipsecKey := encryption. IpSecKey {
540541 Spi : 1001 ,
541542 AeadKeyName : "rfc4106(gcm(aes))" ,
542543 AeadKey : testKey ,
0 commit comments