@@ -45,8 +45,8 @@ var flags []cli.Flag = []cli.Flag{
4545 },
4646 & cli.StringFlag {
4747 Name : "client-attestation-type" ,
48- Value : string ( proxy . AttestationNone ) ,
49- Usage : "type of attestation to present (" + proxy .AvailableAttestationTypes + ")" ,
48+ Value : "" ,
49+ Usage : "type of attestation to present (" + proxy .AvailableAttestationTypes + "). If not set, automatically detected. " ,
5050 },
5151 & cli.BoolFlag {
5252 Name : "log-json" ,
@@ -101,10 +101,41 @@ func runClient(cCtx *cli.Context) error {
101101 return errors .New ("invalid combination of --verify-tls and --server-attestation-type passed (only 'none' is allowed)" )
102102 }
103103
104+ // In cmd/proxy-client/main.go
105+
106+ func runClient (cCtx * cli.Context ) error {
107+ listenAddr := cCtx .String ("listen-addr" )
108+ targetAddr := cCtx .String ("target-addr" )
109+ serverMeasurements := cCtx .String ("server-measurements" )
110+ logJSON := cCtx .Bool ("log-json" )
111+ logDebug := cCtx .Bool ("log-debug" )
112+ tdx .SetLogDcapQuote (cCtx .Bool ("log-dcap-quote" ))
113+
114+ verifyTLS := cCtx .Bool ("verify-tls" )
115+
116+ log := common .SetupLogger (& common.LoggingOpts {
117+ Debug : logDebug ,
118+ JSON : logJSON ,
119+ Service : "proxy-client" ,
120+ Version : common .Version ,
121+ })
122+
123+ if cCtx .String ("server-attestation-type" ) != "none" && verifyTLS {
124+ log .Error ("invalid combination of --verify-tls and --server-attestation-type passed (only 'none' is allowed)" )
125+ return errors .New ("invalid combination of --verify-tls and --server-attestation-type passed (only 'none' is allowed)" )
126+ }
127+
128+ // Auto-detect client attestation type if not specified
104129 clientAttestationType , err := proxy .ParseAttestationType (cCtx .String ("client-attestation-type" ))
105130 if err != nil {
106- log .With ("attestation-type" , cCtx .String ("client-attestation-type" )).Error ("invalid client-attestation-type passed, see --help" )
107- return err
131+ // If parsing fails and no type was specified, use auto-detection
132+ if cCtx .String ("client-attestation-type" ) == "" {
133+ clientAttestationType = proxy .DetectAttestationType ()
134+ log .With ("detected_attestation" , clientAttestationType ).Info ("Auto-detected client attestation type" )
135+ } else {
136+ log .With ("attestation-type" , cCtx .String ("client-attestation-type" )).Error ("invalid client-attestation-type passed, see --help" )
137+ return err
138+ }
108139 }
109140
110141 serverAttestationType , err := proxy .ParseAttestationType (cCtx .String ("server-attestation-type" ))
0 commit comments