mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
18 lines
336 B
Go
18 lines
336 B
Go
|
package badversion
|
||
|
|
||
|
import "github.com/sagernet/sing-box/common/json"
|
||
|
|
||
|
func (v Version) MarshalJSON() ([]byte, error) {
|
||
|
return json.Marshal(v.String())
|
||
|
}
|
||
|
|
||
|
func (v *Version) UnmarshalJSON(data []byte) error {
|
||
|
var version string
|
||
|
err := json.Unmarshal(data, &version)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
*v = Parse(version)
|
||
|
return nil
|
||
|
}
|