NodeStatus.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2016 ZeroTier, Inc. https://www.zerotier.com/
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #import "NodeStatus.h"
  19. @implementation NodeStatus
  20. - (id)initWithJsonData:(NSDictionary*)jsonData
  21. {
  22. self = [super init];
  23. if(self) {
  24. _address = (NSString*)[jsonData objectForKey:@"address"];
  25. _publicIdentity = (NSString*)[jsonData objectForKey:@"publicIdentity"];
  26. _online = [(NSNumber*)[jsonData objectForKey:@"online"] boolValue];
  27. _tcpFallbackActive = [(NSNumber*)[jsonData objectForKey:@"tcpFallbackActive"] boolValue];
  28. _versionMajor = [(NSNumber*)[jsonData objectForKey:@"versionMajor"] intValue];
  29. _versionMinor = [(NSNumber*)[jsonData objectForKey:@"versionMinor"] intValue];
  30. _versionRev = [(NSNumber*)[jsonData objectForKey:@"versionRev"] intValue];
  31. _version = (NSString*)[jsonData objectForKey:@"version"];
  32. _clock = [(NSNumber*)[jsonData objectForKey:@"clock"] unsignedLongLongValue];
  33. }
  34. return self;
  35. }
  36. @end