mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-08 20:30:10 +00:00
.
This commit is contained in:
parent
47a08ccbd4
commit
6db2b8c66d
@ -23,15 +23,6 @@ import (
|
|||||||
"zerotier/pkg/zerotier"
|
"zerotier/pkg/zerotier"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
|
||||||
identity <command> [args] Identity management commands
|
|
||||||
new Create new identity (including secret)
|
|
||||||
getpublic <identity> Extract only public part of identity
|
|
||||||
validate <identity> Locally validate an identity
|
|
||||||
sign <identity> <file> Sign a file with an identity's key
|
|
||||||
verify <identity> <file> <sig> Verify a signature
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Identity command
|
// Identity command
|
||||||
func Identity(args []string) {
|
func Identity(args []string) {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
|
@ -70,6 +70,7 @@ func locatorNew(args []string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
fmt.Println(jsonDump(loc))
|
fmt.Println(jsonDump(loc))
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func locatorNewDNSKey(args []string) {
|
func locatorNewDNSKey(args []string) {
|
||||||
|
@ -51,7 +51,7 @@ func NewInetAddressFromString(s string) *InetAddress {
|
|||||||
i.IP = i4
|
i.IP = i4
|
||||||
}
|
}
|
||||||
if len(ss) > 1 {
|
if len(ss) > 1 {
|
||||||
p64, _ := strconv.ParseUint(s, 10, 64)
|
p64, _ := strconv.ParseUint(ss[1], 10, 64)
|
||||||
i.Port = int(p64 & 0xffff)
|
i.Port = int(p64 & 0xffff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,23 +170,24 @@ func (l *Locator) MakeTXTRecords(key *LocatorDNSSigningKey) ([]string, error) {
|
|||||||
return nil, ErrInternal
|
return nil, ErrInternal
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON marshals this Locator as its byte encoding
|
type locatorForUnmarshal struct {
|
||||||
func (l *Locator) MarshalJSON() ([]byte, error) {
|
Bytes []byte
|
||||||
return json.Marshal(l)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON unmarshals this Locator from a byte array in JSON.
|
// UnmarshalJSON unmarshals this Locator from a byte array in JSON.
|
||||||
func (l *Locator) UnmarshalJSON(j []byte) error {
|
func (l *Locator) UnmarshalJSON(j []byte) error {
|
||||||
err := json.Unmarshal(j, l)
|
var bytes locatorForUnmarshal
|
||||||
|
err := json.Unmarshal(j, &bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tmp, err := NewLocatorFromBytes(l.Bytes)
|
tmp, err := NewLocatorFromBytes(bytes.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
l.Identity = tmp.Identity
|
l.Identity = tmp.Identity
|
||||||
l.Physical = tmp.Physical
|
l.Physical = tmp.Physical
|
||||||
l.Virtual = tmp.Virtual
|
l.Virtual = tmp.Virtual
|
||||||
|
l.Bytes = bytes.Bytes
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user