@@ -105,6 +105,7 @@ type Config struct {
105105 DoHClientX509AuthLegacy DoHClientX509AuthConfig `toml:"tls_client_auth"`
106106 DNS64 DNS64Config `toml:"dns64"`
107107 EDNSClientSubnet []string `toml:"edns_client_subnet"`
108+ IPEncryption IPEncryptionConfig `toml:"ip_encryption"`
108109}
109110
110111func newConfig () Config {
@@ -291,6 +292,11 @@ type DNS64Config struct {
291292 Resolvers []string `toml:"resolver"`
292293}
293294
295+ type IPEncryptionConfig struct {
296+ Key string `toml:"key"`
297+ Algorithm string `toml:"algorithm"`
298+ }
299+
294300type CaptivePortalsConfig struct {
295301 MapFile string `toml:"map_file"`
296302}
@@ -449,6 +455,11 @@ func ConfigLoad(proxy *Proxy, flags *ConfigFlags) error {
449455 // Configure DNS64
450456 configureDNS64 (proxy , & config )
451457
458+ // Configure IP encryption
459+ if err := configureIPEncryption (proxy , & config ); err != nil {
460+ return err
461+ }
462+
452463 // Configure source restrictions
453464 configureSourceRestrictions (proxy , flags , & config )
454465
@@ -544,6 +555,19 @@ func configureDNS64(proxy *Proxy, config *Config) {
544555 proxy .dns64Resolvers = config .DNS64 .Resolvers
545556}
546557
558+ // configureIPEncryption - Helper function for IP encryption
559+ func configureIPEncryption (proxy * Proxy , config * Config ) error {
560+ ipCryptConfig , err := NewIPCryptConfig (
561+ config .IPEncryption .Key ,
562+ config .IPEncryption .Algorithm ,
563+ )
564+ if err != nil {
565+ return fmt .Errorf ("IP encryption configuration error: %w" , err )
566+ }
567+ proxy .ipCryptConfig = ipCryptConfig
568+ return nil
569+ }
570+
547571func (config * Config ) printRegisteredServers (proxy * Proxy , jsonOutput bool , includeRelays bool ) error {
548572 var summary []ServerSummary
549573 if includeRelays {
0 commit comments