Skip to content
Merged

TMP #458

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions app/ios/Frameworks/Yggdrasil.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Yggdrasil.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>Yggdrasil.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Objective-C API for talking to github.com/yggdrasil-network/yggdrasil-go/src/config Go package.
// gobind -lang=objc github.com/yggdrasil-network/yggdrasil-go/src/config
//
// File is generated by gobind. Do not edit.

#ifndef __Config_H__
#define __Config_H__

@import Foundation;
#include "ref.h"
#include "Universe.objc.h"


@class ConfigMulticastInterfaceConfig;
@class ConfigNodeConfig;

@interface ConfigMulticastInterfaceConfig : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull regex;
@property (nonatomic) BOOL beacon;
@property (nonatomic) BOOL listen;
// skipped field MulticastInterfaceConfig.Port with unsupported type: uint16

@end

/**
* NodeConfig is the main configuration structure, containing configuration
options that are necessary for an Yggdrasil node to run. You will need to
supply one of these structs to the Yggdrasil core when starting a node.
*/
@interface ConfigNodeConfig : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
// skipped field NodeConfig.RWMutex with unsupported type: sync.RWMutex

// skipped field NodeConfig.Peers with unsupported type: []string

// skipped field NodeConfig.InterfacePeers with unsupported type: map[string][]string

// skipped field NodeConfig.Listen with unsupported type: []string

@property (nonatomic) NSString* _Nonnull adminListen;
// skipped field NodeConfig.MulticastInterfaces with unsupported type: []github.com/yggdrasil-network/yggdrasil-go/src/config.MulticastInterfaceConfig

// skipped field NodeConfig.AllowedPublicKeys with unsupported type: []string

@property (nonatomic) NSString* _Nonnull publicKey;
@property (nonatomic) NSString* _Nonnull privateKey;
@property (nonatomic) NSString* _Nonnull ifName;
// skipped field NodeConfig.IfMTU with unsupported type: uint64

@property (nonatomic) BOOL nodeInfoPrivacy;
// skipped field NodeConfig.NodeInfo with unsupported type: map[string]interface{}

- (void)lock;
/**
* NewSigningKeys replaces the signing keypair in the NodeConfig with a new
signing keypair. The signing keys are used by the switch to derive the
structure of the spanning tree.
*/
- (void)newKeys;
- (void)rLock;
// skipped method NodeConfig.RLocker with unsupported parameter or return types

- (void)rUnlock;
- (void)unlock;
@end

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Objective-C API for talking to github.com/yggdrasil-network/yggdrasil-go/contrib/mobile Go package.
// gobind -lang=objc github.com/yggdrasil-network/yggdrasil-go/contrib/mobile
//
// File is generated by gobind. Do not edit.

#ifndef __Mobile_H__
#define __Mobile_H__

@import Foundation;
#include "ref.h"
#include "Universe.objc.h"

#include "Config.objc.h"

@class MobileMobileLogger;
@class MobileYggdrasil;

@interface MobileMobileLogger : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)write:(NSData* _Nullable)p0 n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
@end

/**
* Yggdrasil mobile package is meant to "plug the gap" for mobile support, as
Gomobile will not create headers for Swift/Obj-C etc if they have complex
(non-native) types. Therefore for iOS we will expose some nice simple
functions. Note that in the case of iOS we handle reading/writing to/from TUN
in Swift therefore we use the "dummy" TUN interface instead.
*/
@interface MobileYggdrasil : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
/**
* GetAddressString gets the node's IPv6 address
*/
- (NSString* _Nonnull)getAddressString;
/**
* GetCoordsString gets the node's coordinates
*/
- (NSString* _Nonnull)getCoordsString;
- (NSString* _Nonnull)getDHTJSON;
/**
* GetMTU returns the configured node MTU. This must be called AFTER Start.
*/
- (long)getMTU;
- (NSString* _Nonnull)getPeersJSON;
/**
* GetPublicKeyString gets the node's public key in hex form
*/
- (NSString* _Nonnull)getPublicKeyString;
/**
* GetSubnetString gets the node's IPv6 subnet in CIDR notation
*/
- (NSString* _Nonnull)getSubnetString;
/**
* Recv waits for and reads a packet coming from Yggdrasil. It
will be a fully formed IPv6 packet
*/
- (NSData* _Nullable)recv:(NSError* _Nullable* _Nullable)error;
/**
* Send sends a packet to Yggdrasil. It should be a fully formed
IPv6 packet
*/
- (BOOL)send:(NSData* _Nullable)p0 error:(NSError* _Nullable* _Nullable)error;
/**
* StartAutoconfigure starts a node with a randomly generated config
*/
- (BOOL)startAutoconfigure:(NSError* _Nullable* _Nullable)error;
/**
* StartJSON starts a node with the given JSON config. You can get JSON config
(rather than HJSON) by using the GenerateConfigJSON() function
*/
- (BOOL)startJSON:(NSData* _Nullable)configjson error:(NSError* _Nullable* _Nullable)error;
/**
* Stop the mobile Yggdrasil instance
*/
- (BOOL)stop:(NSError* _Nullable* _Nullable)error;
@end

/**
* GenerateConfigJSON generates mobile-friendly configuration in JSON format
*/
FOUNDATION_EXPORT NSData* _Nullable MobileGenerateConfigJSON(void);

FOUNDATION_EXPORT NSString* _Nonnull MobileGetVersion(void);

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Objective-C API for talking to Go package.
// gobind -lang=objc
//
// File is generated by gobind. Do not edit.

#ifndef __Universe_H__
#define __Universe_H__

@import Foundation;
#include "ref.h"

@protocol Universeerror;
@class Universeerror;

@protocol Universeerror <NSObject>
- (NSString* _Nonnull)error;
@end

@class Universeerror;

@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
}
@property(strong, readonly) _Nonnull id _ref;

- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSString* _Nonnull)error;
@end

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

// Objective-C API for talking to the following Go packages
//
// github.com/yggdrasil-network/yggdrasil-go/contrib/mobile
// github.com/yggdrasil-network/yggdrasil-go/src/config
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Yggdrasil_FRAMEWORK_H__
#define __Yggdrasil_FRAMEWORK_H__

#include "Mobile.objc.h"
#include "Config.objc.h"
#include "Universe.objc.h"

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#ifndef __GO_REF_HDR__
#define __GO_REF_HDR__

#include <Foundation/Foundation.h>

// GoSeqRef is an object tagged with an integer for passing back and
// forth across the language boundary. A GoSeqRef may represent either
// an instance of a Go object, or an Objective-C object passed to Go.
// The explicit allocation of a GoSeqRef is used to pin a Go object
// when it is passed to Objective-C. The Go seq package maintains a
// reference to the Go object in a map keyed by the refnum along with
// a reference count. When the reference count reaches zero, the Go
// seq package will clear the corresponding entry in the map.
@interface GoSeqRef : NSObject {
}
@property(readonly) int32_t refnum;
@property(strong) id obj; // NULL when representing a Go object.

// new GoSeqRef object to proxy a Go object. The refnum must be
// provided from Go side.
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;

- (int32_t)incNum;

@end

@protocol goSeqRefInterface
-(GoSeqRef*) _ref;
@end

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
framework module "Yggdrasil" {
header "ref.h"
header "Mobile.objc.h"
header "Config.objc.h"
header "Universe.objc.h"
header "Yggdrasil.h"

export *
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
Binary file not shown.
Loading