1 回答
TA贡献1798条经验 获得超3个赞
我必须将新对象的参数分配给返回的对象。我以前试过这个,但我犯了一个错误
type XMLStrap struct {
Status string `xml:"status,attr"`
SSLversion string `xml:"sslversion,attr"`
Bits string `xml:"bits,attr"`
Cipher string `xml:"cipher,attr"`
Valid string ""
}
type Certs struct {
Cert string `xml:"not-valid-after"`
}
type XMLStraps struct {
XMLName xml.Name `xml:"document"`
Straps []XMLStrap `xml:"ssltest>cipher"`
Validation Certs `xml:"ssltest>certificate"`
}
func ReadStraps(reader io.Reader) ([]XMLStrap, error) {
var xmlStraps XMLStraps
if err := xml.NewDecoder(reader).Decode(&xmlStraps); err != nil {
return nil, err
}
xmlStraps.Straps[0].Valid = xmlStraps.Validation.Cert
return xmlStraps.Straps, nil
}
- 1 回答
- 0 关注
- 204 浏览
添加回答
举报