@ -150,8 +150,8 @@ type CAInfoCommand struct {
Name string ` msgpack:"name" `
Name string ` msgpack:"name" `
}
}
func ( r * CAInfoCommand ) String ( ) string {
func ( c * CAInfoCommand ) String ( ) string {
return fmt . Sprintf ( "name=%s" , r . Name )
return fmt . Sprintf ( "name=%s" , c . Name )
}
}
type CAInfoResponse struct {
type CAInfoResponse struct {
@ -161,16 +161,8 @@ type CAInfoResponse struct {
Profiles [ ] CAProfile ` msgpack:"profiles" `
Profiles [ ] CAProfile ` msgpack:"profiles" `
}
}
func ( i CAInfoResponse ) String ( ) string {
func ( r CAInfoResponse ) String ( ) string {
return fmt . Sprintf ( "certificate name=%s, signing=%t, profiles=[%s]" , i . Name , i . Signing , i . Profiles )
return fmt . Sprintf ( "certificate name=%s, signing=%t, profiles=[%s]" , r . Name , r . Signing , r . Profiles )
}
type ErrorResponse struct {
Message string ` msgpack:"message" `
}
func ( e * ErrorResponse ) String ( ) string {
return fmt . Sprintf ( "message=%s" , e . Message )
}
}
type FetchCRLCommand struct {
type FetchCRLCommand struct {
@ -178,13 +170,13 @@ type FetchCRLCommand struct {
LastKnownID [ ] byte ` msgpack:"last_known_id" `
LastKnownID [ ] byte ` msgpack:"last_known_id" `
}
}
func ( f * FetchCRLCommand ) String ( ) string {
func ( c * FetchCRLCommand ) String ( ) string {
builder := & strings . Builder { }
builder := & strings . Builder { }
_ , _ = fmt . Fprintf ( builder , "issuerId='%s'" , f . IssuerID )
_ , _ = fmt . Fprintf ( builder , "issuerId='%s'" , c . IssuerID )
if f . LastKnownID != nil {
if c . LastKnownID != nil {
_ , _ = fmt . Fprintf ( builder , ", lastKnownId=0x%x" , new ( big . Int ) . SetBytes ( f . LastKnownID ) )
_ , _ = fmt . Fprintf ( builder , ", lastKnownId=0x%x" , new ( big . Int ) . SetBytes ( c . LastKnownID ) )
}
}
return builder . String ( )
return builder . String ( )
@ -246,7 +238,7 @@ func (r *FetchCRLResponse) String() string {
type HealthCommand struct { }
type HealthCommand struct { }
func ( h * HealthCommand ) String ( ) string {
func ( c * HealthCommand ) String ( ) string {
return ""
return ""
}
}
@ -289,14 +281,14 @@ type HealthResponse struct {
Info [ ] * HealthInfo
Info [ ] * HealthInfo
}
}
func ( h * HealthResponse ) String ( ) string {
func ( r * HealthResponse ) String ( ) string {
builder := & strings . Builder { }
builder := & strings . Builder { }
_ , _ = fmt . Fprintf ( builder , "signer version=%s, healthy=%v, health data=[" , h. Version , h . Healthy )
_ , _ = fmt . Fprintf ( builder , "signer version=%s, healthy=%v, health data=[" , r. Version , r . Healthy )
infos := make ( [ ] string , len ( h . Info ) )
infos := make ( [ ] string , len ( r . Info ) )
for i , info := range h . Info {
for i , info := range r . Info {
infos [ i ] = fmt . Sprintf ( "{%s}" , info )
infos [ i ] = fmt . Sprintf ( "{%s}" , info )
}
}
@ -319,33 +311,33 @@ type SignCertificateCommand struct {
PreferredHash crypto . Hash ` msgpack:"preferred_hash" `
PreferredHash crypto . Hash ` msgpack:"preferred_hash" `
}
}
func ( s * SignCertificateCommand ) String ( ) string {
func ( c * SignCertificateCommand ) String ( ) string {
builder := & strings . Builder { }
builder := & strings . Builder { }
_ , _ = fmt . Fprintf (
_ , _ = fmt . Fprintf (
builder , "issuer_id=%s, profile_name=%s, cn=%s" , s. IssuerID , s . ProfileName , s . CommonName ,
builder , "issuer_id=%s, profile_name=%s, cn=%s" , c. IssuerID , c . ProfileName , c . CommonName ,
)
)
if s . Organization != "" {
if c . Organization != "" {
_ , _ = fmt . Fprintf ( builder , ", o=%s" , s . Organization )
_ , _ = fmt . Fprintf ( builder , ", o=%s" , c . Organization )
}
}
if s . OrganizationalUnit != "" {
if c . OrganizationalUnit != "" {
_ , _ = fmt . Fprintf ( builder , ", ou=%s" , s . OrganizationalUnit )
_ , _ = fmt . Fprintf ( builder , ", ou=%s" , c . OrganizationalUnit )
}
}
if len ( s . Hostnames ) > 0 {
if len ( c . Hostnames ) > 0 {
builder . WriteString ( ", hostnames=[" )
builder . WriteString ( ", hostnames=[" )
builder . WriteString ( strings . Join ( s . Hostnames , ", " ) )
builder . WriteString ( strings . Join ( c . Hostnames , ", " ) )
builder . WriteRune ( ']' )
builder . WriteRune ( ']' )
}
}
if len ( s . EmailAddresses ) > 0 {
if len ( c . EmailAddresses ) > 0 {
builder . WriteString ( ", email_addresses=[" )
builder . WriteString ( ", email_addresses=[" )
builder . WriteString ( strings . Join ( s. Hostnam es, ", " ) )
builder . WriteString ( strings . Join ( c. EmailAddress es, ", " ) )
builder . WriteRune ( ']' )
builder . WriteRune ( ']' )
}
}
@ -428,3 +420,11 @@ type SignOpenPGPResponse struct {
func ( r * SignOpenPGPResponse ) String ( ) string {
func ( r * SignOpenPGPResponse ) String ( ) string {
return fmt . Sprintf ( "sig_data of %d bytes" , len ( r . SignatureData ) )
return fmt . Sprintf ( "sig_data of %d bytes" , len ( r . SignatureData ) )
}
}
type ErrorResponse struct {
Message string ` msgpack:"message" `
}
func ( r * ErrorResponse ) String ( ) string {
return fmt . Sprintf ( "message=%s" , r . Message )
}