@@ -11,9 +11,12 @@ use defguard_common::{
1111 } ,
1212 } ,
1313} ;
14- use defguard_proto:: proxy:: {
15- DeviceConfig as ProtoDeviceConfig , DeviceConfigResponse , DeviceInfo ,
16- LocationMfaMode as ProtoLocationMfaMode ,
14+ use defguard_proto:: {
15+ client_types:: {
16+ DeviceConfig as ProtoDeviceConfig , DeviceConfigResponse ,
17+ LocationMfaMode as ProtoLocationMfaMode ,
18+ } ,
19+ proxy:: DeviceInfo ,
1720} ;
1821use sqlx:: PgPool ;
1922use tonic:: Status ;
@@ -94,33 +97,31 @@ pub async fn build_device_config_response(
9497
9598 // DEPRECATED(1.5): superseeded by location_mfa_mode
9699 let mfa_enabled = network. location_mfa_mode == LocationMfaMode :: Internal ;
97- let config =
98- ProtoDeviceConfig {
99- config : Device :: create_config ( & network, & wireguard_network_device) ,
100- network_id : network. id ,
101- network_name : network. name ,
102- assigned_ip : wireguard_network_device. wireguard_ips . as_csv ( ) ,
103- endpoint : format ! ( "{}:{}" , network. endpoint, network. port) ,
104- pubkey : network. pubkey ,
105- allowed_ips : network. allowed_ips . as_csv ( ) ,
106- dns : network. dns ,
107- keepalive_interval : network. keepalive_interval ,
108- #[ allow( deprecated) ]
109- mfa_enabled,
110- location_mfa_mode : Some (
111- <LocationMfaMode as Into < ProtoLocationMfaMode > >:: into (
112- network. location_mfa_mode ,
113- )
114- . into ( ) ,
115- ) ,
116- service_location_mode :
117- Some (
118- <ServiceLocationMode as Into <
119- defguard_proto:: proxy:: ServiceLocationMode ,
120- > >:: into ( network. service_location_mode )
121- . into ( ) ,
122- ) ,
123- } ;
100+ let config = ProtoDeviceConfig {
101+ config : Device :: create_config ( & network, & wireguard_network_device) ,
102+ network_id : network. id ,
103+ network_name : network. name ,
104+ assigned_ip : wireguard_network_device. wireguard_ips . as_csv ( ) ,
105+ endpoint : format ! ( "{}:{}" , network. endpoint, network. port) ,
106+ pubkey : network. pubkey ,
107+ allowed_ips : network. allowed_ips . as_csv ( ) ,
108+ dns : network. dns ,
109+ keepalive_interval : network. keepalive_interval ,
110+ #[ allow( deprecated) ]
111+ mfa_enabled,
112+ location_mfa_mode : Some (
113+ <LocationMfaMode as Into < ProtoLocationMfaMode > >:: into (
114+ network. location_mfa_mode ,
115+ )
116+ . into ( ) ,
117+ ) ,
118+ service_location_mode : Some (
119+ <ServiceLocationMode as Into <
120+ defguard_proto:: client_types:: ServiceLocationMode ,
121+ > >:: into ( network. service_location_mode )
122+ . into ( ) ,
123+ ) ,
124+ } ;
124125 configs. push ( config) ;
125126 }
126127 } else {
@@ -173,13 +174,12 @@ pub async fn build_device_config_response(
173174 )
174175 . into ( ) ,
175176 ) ,
176- service_location_mode :
177- Some (
178- <ServiceLocationMode as Into <
179- defguard_proto:: proxy:: ServiceLocationMode ,
180- > >:: into ( network. service_location_mode )
181- . into ( ) ,
182- ) ,
177+ service_location_mode : Some (
178+ <ServiceLocationMode as Into <
179+ defguard_proto:: client_types:: ServiceLocationMode ,
180+ > >:: into ( network. service_location_mode )
181+ . into ( ) ,
182+ ) ,
183183 } ;
184184 configs. push ( config) ;
185185 }
0 commit comments