Fix: Use local Swift Package (LibboxLocal) with binaryTarget for Libbox.xcframework

This commit is contained in:
2026-07-02 22:50:37 +08:00
parent 20b794122c
commit 621e34cc6a
63 changed files with 4635 additions and 6 deletions
@@ -0,0 +1,80 @@
<?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</string>
<key>LibraryPath</key>
<string>Libbox.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Libbox.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>tvos-arm64</string>
<key>LibraryPath</key>
<string>Libbox.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>Libbox.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Libbox.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
@@ -0,0 +1 @@
Versions/Current/Headers
@@ -0,0 +1 @@
Versions/Current/Libbox
@@ -0,0 +1 @@
Versions/Current/Modules
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1,13 @@
// Objective-C API for talking to the following Go packages
//
// github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Libbox_FRAMEWORK_H__
#define __Libbox_FRAMEWORK_H__
#include "Libbox.objc.h"
#include "Universe.objc.h"
#endif
@@ -0,0 +1,811 @@
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gobind. Do not edit.
#ifndef __Libbox_H__
#define __Libbox_H__
@import Foundation;
#include "ref.h"
#include "Universe.objc.h"
@class LibboxBoxService;
@class LibboxCommandClient;
@class LibboxCommandClientOptions;
@class LibboxCommandServer;
@class LibboxErrorMessage;
@class LibboxExchangeContext;
@class LibboxImportRemoteProfile;
@class LibboxNetworkInterface;
@class LibboxOutboundGroup;
@class LibboxOutboundGroupItem;
@class LibboxPProfServer;
@class LibboxProfileContent;
@class LibboxProfileContentRequest;
@class LibboxProfileDecoder;
@class LibboxProfileEncoder;
@class LibboxProfilePreview;
@class LibboxRoutePrefix;
@class LibboxStatusMessage;
@class LibboxSystemProxyStatus;
@class LibboxWIFIState;
@protocol LibboxCommandClientHandler;
@class LibboxCommandClientHandler;
@protocol LibboxCommandServerHandler;
@class LibboxCommandServerHandler;
@protocol LibboxFunc;
@class LibboxFunc;
@protocol LibboxHTTPClient;
@class LibboxHTTPClient;
@protocol LibboxHTTPRequest;
@class LibboxHTTPRequest;
@protocol LibboxHTTPResponse;
@class LibboxHTTPResponse;
@protocol LibboxInterfaceUpdateListener;
@class LibboxInterfaceUpdateListener;
@protocol LibboxLocalDNSTransport;
@class LibboxLocalDNSTransport;
@protocol LibboxNetworkInterfaceIterator;
@class LibboxNetworkInterfaceIterator;
@protocol LibboxOnDemandRule;
@class LibboxOnDemandRule;
@protocol LibboxOnDemandRuleIterator;
@class LibboxOnDemandRuleIterator;
@protocol LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupItemIterator;
@protocol LibboxOutboundGroupIterator;
@class LibboxOutboundGroupIterator;
@protocol LibboxPlatformInterface;
@class LibboxPlatformInterface;
@protocol LibboxProfilePreviewIterator;
@class LibboxProfilePreviewIterator;
@protocol LibboxRoutePrefixIterator;
@class LibboxRoutePrefixIterator;
@protocol LibboxStringIterator;
@class LibboxStringIterator;
@protocol LibboxTunInterface;
@class LibboxTunInterface;
@protocol LibboxTunOptions;
@class LibboxTunOptions;
@protocol LibboxCommandClientHandler <NSObject>
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@protocol LibboxCommandServerHandler <NSObject>
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxFunc <NSObject>
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxHTTPClient <NSObject>
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@protocol LibboxHTTPRequest <NSObject>
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@protocol LibboxHTTPResponse <NSObject>
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxInterfaceUpdateListener <NSObject>
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@protocol LibboxLocalDNSTransport <NSObject>
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@protocol LibboxNetworkInterfaceIterator <NSObject>
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@protocol LibboxOnDemandRule <NSObject>
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@protocol LibboxOnDemandRuleIterator <NSObject>
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@protocol LibboxOutboundGroupItemIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@protocol LibboxOutboundGroupIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@protocol LibboxPlatformInterface <NSObject>
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@protocol LibboxProfilePreviewIterator <NSObject>
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@protocol LibboxRoutePrefixIterator <NSObject>
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@protocol LibboxStringIterator <NSObject>
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@protocol LibboxTunInterface <NSObject>
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@protocol LibboxTunOptions <NSObject>
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)needWIFIState;
- (void)pause;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)wake;
@end
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t command;
@property (nonatomic) int64_t statusInterval;
@end
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (void)resetLog;
- (void)setService:(LibboxBoxService* _Nullable)newService;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)writeMessage:(NSString* _Nullable)message;
@end
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull message;
- (NSData* _Nullable)encode;
@end
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)errnoCode:(int32_t)code;
- (void)errorCode:(int32_t)code;
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
- (void)rawSuccess:(NSData* _Nullable)result;
- (void)success:(NSString* _Nullable)result;
@end
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) NSString* _Nonnull url;
@property (nonatomic) NSString* _Nonnull host;
@end
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t index;
@property (nonatomic) int32_t mtu;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
@end
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) BOOL selectable;
@property (nonatomic) NSString* _Nonnull selected;
@property (nonatomic) BOOL isExpand;
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
@end
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) int64_t urlTestTime;
@property (nonatomic) int32_t urlTestDelay;
@end
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(long)port;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@property (nonatomic) NSString* _Nonnull config;
@property (nonatomic) NSString* _Nonnull remotePath;
@property (nonatomic) BOOL autoUpdate;
@property (nonatomic) int32_t autoUpdateInterval;
@property (nonatomic) int64_t lastUpdated;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
@end
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)append:(LibboxProfilePreview* _Nullable)profile;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@end
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (NSString* _Nonnull)address;
- (NSString* _Nonnull)mask;
- (int32_t)prefix;
- (NSString* _Nonnull)string;
@end
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t memory;
@property (nonatomic) int32_t goroutines;
@property (nonatomic) int32_t connectionsIn;
@property (nonatomic) int32_t connectionsOut;
@property (nonatomic) BOOL trafficAvailable;
@property (nonatomic) int64_t uplink;
@property (nonatomic) int64_t downlink;
@property (nonatomic) int64_t uplinkTotal;
@property (nonatomic) int64_t downlinkTotal;
@end
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) BOOL available;
@property (nonatomic) BOOL enabled;
@end
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
@property (nonatomic) NSString* _Nonnull ssid;
@property (nonatomic) NSString* _Nonnull bssid;
@end
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxClearServiceError(void);
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
@class LibboxCommandClientHandler;
@class LibboxCommandServerHandler;
@class LibboxFunc;
@class LibboxHTTPClient;
@class LibboxHTTPRequest;
@class LibboxHTTPResponse;
@class LibboxInterfaceUpdateListener;
@class LibboxLocalDNSTransport;
@class LibboxNetworkInterfaceIterator;
@class LibboxOnDemandRule;
@class LibboxOnDemandRuleIterator;
@class LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupIterator;
@class LibboxPlatformInterface;
@class LibboxProfilePreviewIterator;
@class LibboxRoutePrefixIterator;
@class LibboxStringIterator;
@class LibboxTunInterface;
@class LibboxTunOptions;
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
#endif
@@ -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
@@ -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
@@ -0,0 +1,6 @@
framework module Libbox {
header "ref.h"
header "Libbox.objc.h"
header "Universe.objc.h"
export *
}
@@ -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>
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1,13 @@
// Objective-C API for talking to the following Go packages
//
// github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Libbox_FRAMEWORK_H__
#define __Libbox_FRAMEWORK_H__
#include "Libbox.objc.h"
#include "Universe.objc.h"
#endif
@@ -0,0 +1,811 @@
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gobind. Do not edit.
#ifndef __Libbox_H__
#define __Libbox_H__
@import Foundation;
#include "ref.h"
#include "Universe.objc.h"
@class LibboxBoxService;
@class LibboxCommandClient;
@class LibboxCommandClientOptions;
@class LibboxCommandServer;
@class LibboxErrorMessage;
@class LibboxExchangeContext;
@class LibboxImportRemoteProfile;
@class LibboxNetworkInterface;
@class LibboxOutboundGroup;
@class LibboxOutboundGroupItem;
@class LibboxPProfServer;
@class LibboxProfileContent;
@class LibboxProfileContentRequest;
@class LibboxProfileDecoder;
@class LibboxProfileEncoder;
@class LibboxProfilePreview;
@class LibboxRoutePrefix;
@class LibboxStatusMessage;
@class LibboxSystemProxyStatus;
@class LibboxWIFIState;
@protocol LibboxCommandClientHandler;
@class LibboxCommandClientHandler;
@protocol LibboxCommandServerHandler;
@class LibboxCommandServerHandler;
@protocol LibboxFunc;
@class LibboxFunc;
@protocol LibboxHTTPClient;
@class LibboxHTTPClient;
@protocol LibboxHTTPRequest;
@class LibboxHTTPRequest;
@protocol LibboxHTTPResponse;
@class LibboxHTTPResponse;
@protocol LibboxInterfaceUpdateListener;
@class LibboxInterfaceUpdateListener;
@protocol LibboxLocalDNSTransport;
@class LibboxLocalDNSTransport;
@protocol LibboxNetworkInterfaceIterator;
@class LibboxNetworkInterfaceIterator;
@protocol LibboxOnDemandRule;
@class LibboxOnDemandRule;
@protocol LibboxOnDemandRuleIterator;
@class LibboxOnDemandRuleIterator;
@protocol LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupItemIterator;
@protocol LibboxOutboundGroupIterator;
@class LibboxOutboundGroupIterator;
@protocol LibboxPlatformInterface;
@class LibboxPlatformInterface;
@protocol LibboxProfilePreviewIterator;
@class LibboxProfilePreviewIterator;
@protocol LibboxRoutePrefixIterator;
@class LibboxRoutePrefixIterator;
@protocol LibboxStringIterator;
@class LibboxStringIterator;
@protocol LibboxTunInterface;
@class LibboxTunInterface;
@protocol LibboxTunOptions;
@class LibboxTunOptions;
@protocol LibboxCommandClientHandler <NSObject>
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@protocol LibboxCommandServerHandler <NSObject>
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxFunc <NSObject>
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxHTTPClient <NSObject>
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@protocol LibboxHTTPRequest <NSObject>
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@protocol LibboxHTTPResponse <NSObject>
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxInterfaceUpdateListener <NSObject>
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@protocol LibboxLocalDNSTransport <NSObject>
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@protocol LibboxNetworkInterfaceIterator <NSObject>
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@protocol LibboxOnDemandRule <NSObject>
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@protocol LibboxOnDemandRuleIterator <NSObject>
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@protocol LibboxOutboundGroupItemIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@protocol LibboxOutboundGroupIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@protocol LibboxPlatformInterface <NSObject>
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@protocol LibboxProfilePreviewIterator <NSObject>
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@protocol LibboxRoutePrefixIterator <NSObject>
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@protocol LibboxStringIterator <NSObject>
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@protocol LibboxTunInterface <NSObject>
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@protocol LibboxTunOptions <NSObject>
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)needWIFIState;
- (void)pause;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)wake;
@end
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t command;
@property (nonatomic) int64_t statusInterval;
@end
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (void)resetLog;
- (void)setService:(LibboxBoxService* _Nullable)newService;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)writeMessage:(NSString* _Nullable)message;
@end
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull message;
- (NSData* _Nullable)encode;
@end
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)errnoCode:(int32_t)code;
- (void)errorCode:(int32_t)code;
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
- (void)rawSuccess:(NSData* _Nullable)result;
- (void)success:(NSString* _Nullable)result;
@end
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) NSString* _Nonnull url;
@property (nonatomic) NSString* _Nonnull host;
@end
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t index;
@property (nonatomic) int32_t mtu;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
@end
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) BOOL selectable;
@property (nonatomic) NSString* _Nonnull selected;
@property (nonatomic) BOOL isExpand;
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
@end
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) int64_t urlTestTime;
@property (nonatomic) int32_t urlTestDelay;
@end
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(long)port;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@property (nonatomic) NSString* _Nonnull config;
@property (nonatomic) NSString* _Nonnull remotePath;
@property (nonatomic) BOOL autoUpdate;
@property (nonatomic) int32_t autoUpdateInterval;
@property (nonatomic) int64_t lastUpdated;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
@end
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)append:(LibboxProfilePreview* _Nullable)profile;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@end
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (NSString* _Nonnull)address;
- (NSString* _Nonnull)mask;
- (int32_t)prefix;
- (NSString* _Nonnull)string;
@end
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t memory;
@property (nonatomic) int32_t goroutines;
@property (nonatomic) int32_t connectionsIn;
@property (nonatomic) int32_t connectionsOut;
@property (nonatomic) BOOL trafficAvailable;
@property (nonatomic) int64_t uplink;
@property (nonatomic) int64_t downlink;
@property (nonatomic) int64_t uplinkTotal;
@property (nonatomic) int64_t downlinkTotal;
@end
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) BOOL available;
@property (nonatomic) BOOL enabled;
@end
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
@property (nonatomic) NSString* _Nonnull ssid;
@property (nonatomic) NSString* _Nonnull bssid;
@end
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxClearServiceError(void);
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
@class LibboxCommandClientHandler;
@class LibboxCommandServerHandler;
@class LibboxFunc;
@class LibboxHTTPClient;
@class LibboxHTTPRequest;
@class LibboxHTTPResponse;
@class LibboxInterfaceUpdateListener;
@class LibboxLocalDNSTransport;
@class LibboxNetworkInterfaceIterator;
@class LibboxOnDemandRule;
@class LibboxOnDemandRuleIterator;
@class LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupIterator;
@class LibboxPlatformInterface;
@class LibboxProfilePreviewIterator;
@class LibboxRoutePrefixIterator;
@class LibboxStringIterator;
@class LibboxTunInterface;
@class LibboxTunOptions;
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
#endif
@@ -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
@@ -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
@@ -0,0 +1,6 @@
framework module Libbox {
header "ref.h"
header "Libbox.objc.h"
header "Universe.objc.h"
export *
}
@@ -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>
@@ -0,0 +1 @@
Versions/Current/Headers
@@ -0,0 +1 @@
Versions/Current/Libbox
@@ -0,0 +1 @@
Versions/Current/Modules
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1,13 @@
// Objective-C API for talking to the following Go packages
//
// github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Libbox_FRAMEWORK_H__
#define __Libbox_FRAMEWORK_H__
#include "Libbox.objc.h"
#include "Universe.objc.h"
#endif
@@ -0,0 +1,811 @@
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gobind. Do not edit.
#ifndef __Libbox_H__
#define __Libbox_H__
@import Foundation;
#include "ref.h"
#include "Universe.objc.h"
@class LibboxBoxService;
@class LibboxCommandClient;
@class LibboxCommandClientOptions;
@class LibboxCommandServer;
@class LibboxErrorMessage;
@class LibboxExchangeContext;
@class LibboxImportRemoteProfile;
@class LibboxNetworkInterface;
@class LibboxOutboundGroup;
@class LibboxOutboundGroupItem;
@class LibboxPProfServer;
@class LibboxProfileContent;
@class LibboxProfileContentRequest;
@class LibboxProfileDecoder;
@class LibboxProfileEncoder;
@class LibboxProfilePreview;
@class LibboxRoutePrefix;
@class LibboxStatusMessage;
@class LibboxSystemProxyStatus;
@class LibboxWIFIState;
@protocol LibboxCommandClientHandler;
@class LibboxCommandClientHandler;
@protocol LibboxCommandServerHandler;
@class LibboxCommandServerHandler;
@protocol LibboxFunc;
@class LibboxFunc;
@protocol LibboxHTTPClient;
@class LibboxHTTPClient;
@protocol LibboxHTTPRequest;
@class LibboxHTTPRequest;
@protocol LibboxHTTPResponse;
@class LibboxHTTPResponse;
@protocol LibboxInterfaceUpdateListener;
@class LibboxInterfaceUpdateListener;
@protocol LibboxLocalDNSTransport;
@class LibboxLocalDNSTransport;
@protocol LibboxNetworkInterfaceIterator;
@class LibboxNetworkInterfaceIterator;
@protocol LibboxOnDemandRule;
@class LibboxOnDemandRule;
@protocol LibboxOnDemandRuleIterator;
@class LibboxOnDemandRuleIterator;
@protocol LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupItemIterator;
@protocol LibboxOutboundGroupIterator;
@class LibboxOutboundGroupIterator;
@protocol LibboxPlatformInterface;
@class LibboxPlatformInterface;
@protocol LibboxProfilePreviewIterator;
@class LibboxProfilePreviewIterator;
@protocol LibboxRoutePrefixIterator;
@class LibboxRoutePrefixIterator;
@protocol LibboxStringIterator;
@class LibboxStringIterator;
@protocol LibboxTunInterface;
@class LibboxTunInterface;
@protocol LibboxTunOptions;
@class LibboxTunOptions;
@protocol LibboxCommandClientHandler <NSObject>
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@protocol LibboxCommandServerHandler <NSObject>
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxFunc <NSObject>
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxHTTPClient <NSObject>
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@protocol LibboxHTTPRequest <NSObject>
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@protocol LibboxHTTPResponse <NSObject>
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxInterfaceUpdateListener <NSObject>
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@protocol LibboxLocalDNSTransport <NSObject>
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@protocol LibboxNetworkInterfaceIterator <NSObject>
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@protocol LibboxOnDemandRule <NSObject>
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@protocol LibboxOnDemandRuleIterator <NSObject>
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@protocol LibboxOutboundGroupItemIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@protocol LibboxOutboundGroupIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@protocol LibboxPlatformInterface <NSObject>
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@protocol LibboxProfilePreviewIterator <NSObject>
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@protocol LibboxRoutePrefixIterator <NSObject>
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@protocol LibboxStringIterator <NSObject>
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@protocol LibboxTunInterface <NSObject>
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@protocol LibboxTunOptions <NSObject>
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)needWIFIState;
- (void)pause;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)wake;
@end
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t command;
@property (nonatomic) int64_t statusInterval;
@end
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (void)resetLog;
- (void)setService:(LibboxBoxService* _Nullable)newService;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)writeMessage:(NSString* _Nullable)message;
@end
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull message;
- (NSData* _Nullable)encode;
@end
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)errnoCode:(int32_t)code;
- (void)errorCode:(int32_t)code;
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
- (void)rawSuccess:(NSData* _Nullable)result;
- (void)success:(NSString* _Nullable)result;
@end
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) NSString* _Nonnull url;
@property (nonatomic) NSString* _Nonnull host;
@end
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t index;
@property (nonatomic) int32_t mtu;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
@end
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) BOOL selectable;
@property (nonatomic) NSString* _Nonnull selected;
@property (nonatomic) BOOL isExpand;
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
@end
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) int64_t urlTestTime;
@property (nonatomic) int32_t urlTestDelay;
@end
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(long)port;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@property (nonatomic) NSString* _Nonnull config;
@property (nonatomic) NSString* _Nonnull remotePath;
@property (nonatomic) BOOL autoUpdate;
@property (nonatomic) int32_t autoUpdateInterval;
@property (nonatomic) int64_t lastUpdated;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
@end
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)append:(LibboxProfilePreview* _Nullable)profile;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@end
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (NSString* _Nonnull)address;
- (NSString* _Nonnull)mask;
- (int32_t)prefix;
- (NSString* _Nonnull)string;
@end
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t memory;
@property (nonatomic) int32_t goroutines;
@property (nonatomic) int32_t connectionsIn;
@property (nonatomic) int32_t connectionsOut;
@property (nonatomic) BOOL trafficAvailable;
@property (nonatomic) int64_t uplink;
@property (nonatomic) int64_t downlink;
@property (nonatomic) int64_t uplinkTotal;
@property (nonatomic) int64_t downlinkTotal;
@end
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) BOOL available;
@property (nonatomic) BOOL enabled;
@end
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
@property (nonatomic) NSString* _Nonnull ssid;
@property (nonatomic) NSString* _Nonnull bssid;
@end
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxClearServiceError(void);
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
@class LibboxCommandClientHandler;
@class LibboxCommandServerHandler;
@class LibboxFunc;
@class LibboxHTTPClient;
@class LibboxHTTPRequest;
@class LibboxHTTPResponse;
@class LibboxInterfaceUpdateListener;
@class LibboxLocalDNSTransport;
@class LibboxNetworkInterfaceIterator;
@class LibboxOnDemandRule;
@class LibboxOnDemandRuleIterator;
@class LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupIterator;
@class LibboxPlatformInterface;
@class LibboxProfilePreviewIterator;
@class LibboxRoutePrefixIterator;
@class LibboxStringIterator;
@class LibboxTunInterface;
@class LibboxTunOptions;
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
#endif
@@ -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
@@ -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
@@ -0,0 +1,6 @@
framework module Libbox {
header "ref.h"
header "Libbox.objc.h"
header "Universe.objc.h"
export *
}
@@ -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>
@@ -0,0 +1 @@
Versions/Current/Headers
@@ -0,0 +1 @@
Versions/Current/Libbox
@@ -0,0 +1 @@
Versions/Current/Modules
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1,13 @@
// Objective-C API for talking to the following Go packages
//
// github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Libbox_FRAMEWORK_H__
#define __Libbox_FRAMEWORK_H__
#include "Libbox.objc.h"
#include "Universe.objc.h"
#endif
@@ -0,0 +1,811 @@
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gobind. Do not edit.
#ifndef __Libbox_H__
#define __Libbox_H__
@import Foundation;
#include "ref.h"
#include "Universe.objc.h"
@class LibboxBoxService;
@class LibboxCommandClient;
@class LibboxCommandClientOptions;
@class LibboxCommandServer;
@class LibboxErrorMessage;
@class LibboxExchangeContext;
@class LibboxImportRemoteProfile;
@class LibboxNetworkInterface;
@class LibboxOutboundGroup;
@class LibboxOutboundGroupItem;
@class LibboxPProfServer;
@class LibboxProfileContent;
@class LibboxProfileContentRequest;
@class LibboxProfileDecoder;
@class LibboxProfileEncoder;
@class LibboxProfilePreview;
@class LibboxRoutePrefix;
@class LibboxStatusMessage;
@class LibboxSystemProxyStatus;
@class LibboxWIFIState;
@protocol LibboxCommandClientHandler;
@class LibboxCommandClientHandler;
@protocol LibboxCommandServerHandler;
@class LibboxCommandServerHandler;
@protocol LibboxFunc;
@class LibboxFunc;
@protocol LibboxHTTPClient;
@class LibboxHTTPClient;
@protocol LibboxHTTPRequest;
@class LibboxHTTPRequest;
@protocol LibboxHTTPResponse;
@class LibboxHTTPResponse;
@protocol LibboxInterfaceUpdateListener;
@class LibboxInterfaceUpdateListener;
@protocol LibboxLocalDNSTransport;
@class LibboxLocalDNSTransport;
@protocol LibboxNetworkInterfaceIterator;
@class LibboxNetworkInterfaceIterator;
@protocol LibboxOnDemandRule;
@class LibboxOnDemandRule;
@protocol LibboxOnDemandRuleIterator;
@class LibboxOnDemandRuleIterator;
@protocol LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupItemIterator;
@protocol LibboxOutboundGroupIterator;
@class LibboxOutboundGroupIterator;
@protocol LibboxPlatformInterface;
@class LibboxPlatformInterface;
@protocol LibboxProfilePreviewIterator;
@class LibboxProfilePreviewIterator;
@protocol LibboxRoutePrefixIterator;
@class LibboxRoutePrefixIterator;
@protocol LibboxStringIterator;
@class LibboxStringIterator;
@protocol LibboxTunInterface;
@class LibboxTunInterface;
@protocol LibboxTunOptions;
@class LibboxTunOptions;
@protocol LibboxCommandClientHandler <NSObject>
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@protocol LibboxCommandServerHandler <NSObject>
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxFunc <NSObject>
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxHTTPClient <NSObject>
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@protocol LibboxHTTPRequest <NSObject>
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@protocol LibboxHTTPResponse <NSObject>
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxInterfaceUpdateListener <NSObject>
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@protocol LibboxLocalDNSTransport <NSObject>
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@protocol LibboxNetworkInterfaceIterator <NSObject>
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@protocol LibboxOnDemandRule <NSObject>
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@protocol LibboxOnDemandRuleIterator <NSObject>
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@protocol LibboxOutboundGroupItemIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@protocol LibboxOutboundGroupIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@protocol LibboxPlatformInterface <NSObject>
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@protocol LibboxProfilePreviewIterator <NSObject>
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@protocol LibboxRoutePrefixIterator <NSObject>
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@protocol LibboxStringIterator <NSObject>
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@protocol LibboxTunInterface <NSObject>
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@protocol LibboxTunOptions <NSObject>
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)needWIFIState;
- (void)pause;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)wake;
@end
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t command;
@property (nonatomic) int64_t statusInterval;
@end
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (void)resetLog;
- (void)setService:(LibboxBoxService* _Nullable)newService;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)writeMessage:(NSString* _Nullable)message;
@end
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull message;
- (NSData* _Nullable)encode;
@end
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)errnoCode:(int32_t)code;
- (void)errorCode:(int32_t)code;
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
- (void)rawSuccess:(NSData* _Nullable)result;
- (void)success:(NSString* _Nullable)result;
@end
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) NSString* _Nonnull url;
@property (nonatomic) NSString* _Nonnull host;
@end
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t index;
@property (nonatomic) int32_t mtu;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
@end
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) BOOL selectable;
@property (nonatomic) NSString* _Nonnull selected;
@property (nonatomic) BOOL isExpand;
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
@end
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) int64_t urlTestTime;
@property (nonatomic) int32_t urlTestDelay;
@end
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(long)port;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@property (nonatomic) NSString* _Nonnull config;
@property (nonatomic) NSString* _Nonnull remotePath;
@property (nonatomic) BOOL autoUpdate;
@property (nonatomic) int32_t autoUpdateInterval;
@property (nonatomic) int64_t lastUpdated;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
@end
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)append:(LibboxProfilePreview* _Nullable)profile;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@end
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (NSString* _Nonnull)address;
- (NSString* _Nonnull)mask;
- (int32_t)prefix;
- (NSString* _Nonnull)string;
@end
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t memory;
@property (nonatomic) int32_t goroutines;
@property (nonatomic) int32_t connectionsIn;
@property (nonatomic) int32_t connectionsOut;
@property (nonatomic) BOOL trafficAvailable;
@property (nonatomic) int64_t uplink;
@property (nonatomic) int64_t downlink;
@property (nonatomic) int64_t uplinkTotal;
@property (nonatomic) int64_t downlinkTotal;
@end
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) BOOL available;
@property (nonatomic) BOOL enabled;
@end
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
@property (nonatomic) NSString* _Nonnull ssid;
@property (nonatomic) NSString* _Nonnull bssid;
@end
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxClearServiceError(void);
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
@class LibboxCommandClientHandler;
@class LibboxCommandServerHandler;
@class LibboxFunc;
@class LibboxHTTPClient;
@class LibboxHTTPRequest;
@class LibboxHTTPResponse;
@class LibboxInterfaceUpdateListener;
@class LibboxLocalDNSTransport;
@class LibboxNetworkInterfaceIterator;
@class LibboxOnDemandRule;
@class LibboxOnDemandRuleIterator;
@class LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupIterator;
@class LibboxPlatformInterface;
@class LibboxProfilePreviewIterator;
@class LibboxRoutePrefixIterator;
@class LibboxStringIterator;
@class LibboxTunInterface;
@class LibboxTunOptions;
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
#endif
@@ -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
@@ -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
@@ -0,0 +1,6 @@
framework module Libbox {
header "ref.h"
header "Libbox.objc.h"
header "Universe.objc.h"
export *
}
@@ -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>
@@ -0,0 +1,13 @@
// Objective-C API for talking to the following Go packages
//
// github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gomobile bind. Do not edit.
#ifndef __Libbox_FRAMEWORK_H__
#define __Libbox_FRAMEWORK_H__
#include "Libbox.objc.h"
#include "Universe.objc.h"
#endif
@@ -0,0 +1,811 @@
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
//
// File is generated by gobind. Do not edit.
#ifndef __Libbox_H__
#define __Libbox_H__
@import Foundation;
#include "ref.h"
#include "Universe.objc.h"
@class LibboxBoxService;
@class LibboxCommandClient;
@class LibboxCommandClientOptions;
@class LibboxCommandServer;
@class LibboxErrorMessage;
@class LibboxExchangeContext;
@class LibboxImportRemoteProfile;
@class LibboxNetworkInterface;
@class LibboxOutboundGroup;
@class LibboxOutboundGroupItem;
@class LibboxPProfServer;
@class LibboxProfileContent;
@class LibboxProfileContentRequest;
@class LibboxProfileDecoder;
@class LibboxProfileEncoder;
@class LibboxProfilePreview;
@class LibboxRoutePrefix;
@class LibboxStatusMessage;
@class LibboxSystemProxyStatus;
@class LibboxWIFIState;
@protocol LibboxCommandClientHandler;
@class LibboxCommandClientHandler;
@protocol LibboxCommandServerHandler;
@class LibboxCommandServerHandler;
@protocol LibboxFunc;
@class LibboxFunc;
@protocol LibboxHTTPClient;
@class LibboxHTTPClient;
@protocol LibboxHTTPRequest;
@class LibboxHTTPRequest;
@protocol LibboxHTTPResponse;
@class LibboxHTTPResponse;
@protocol LibboxInterfaceUpdateListener;
@class LibboxInterfaceUpdateListener;
@protocol LibboxLocalDNSTransport;
@class LibboxLocalDNSTransport;
@protocol LibboxNetworkInterfaceIterator;
@class LibboxNetworkInterfaceIterator;
@protocol LibboxOnDemandRule;
@class LibboxOnDemandRule;
@protocol LibboxOnDemandRuleIterator;
@class LibboxOnDemandRuleIterator;
@protocol LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupItemIterator;
@protocol LibboxOutboundGroupIterator;
@class LibboxOutboundGroupIterator;
@protocol LibboxPlatformInterface;
@class LibboxPlatformInterface;
@protocol LibboxProfilePreviewIterator;
@class LibboxProfilePreviewIterator;
@protocol LibboxRoutePrefixIterator;
@class LibboxRoutePrefixIterator;
@protocol LibboxStringIterator;
@class LibboxStringIterator;
@protocol LibboxTunInterface;
@class LibboxTunInterface;
@protocol LibboxTunOptions;
@class LibboxTunOptions;
@protocol LibboxCommandClientHandler <NSObject>
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@protocol LibboxCommandServerHandler <NSObject>
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxFunc <NSObject>
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxHTTPClient <NSObject>
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@protocol LibboxHTTPRequest <NSObject>
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@protocol LibboxHTTPResponse <NSObject>
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@protocol LibboxInterfaceUpdateListener <NSObject>
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@protocol LibboxLocalDNSTransport <NSObject>
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@protocol LibboxNetworkInterfaceIterator <NSObject>
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@protocol LibboxOnDemandRule <NSObject>
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@protocol LibboxOnDemandRuleIterator <NSObject>
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@protocol LibboxOutboundGroupItemIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@protocol LibboxOutboundGroupIterator <NSObject>
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@protocol LibboxPlatformInterface <NSObject>
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@protocol LibboxProfilePreviewIterator <NSObject>
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@protocol LibboxRoutePrefixIterator <NSObject>
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@protocol LibboxStringIterator <NSObject>
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@protocol LibboxTunInterface <NSObject>
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@protocol LibboxTunOptions <NSObject>
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)needWIFIState;
- (void)pause;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)wake;
@end
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t command;
@property (nonatomic) int64_t statusInterval;
@end
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (void)resetLog;
- (void)setService:(LibboxBoxService* _Nullable)newService;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
- (void)writeMessage:(NSString* _Nullable)message;
@end
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull message;
- (NSData* _Nullable)encode;
@end
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)errnoCode:(int32_t)code;
- (void)errorCode:(int32_t)code;
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
- (void)rawSuccess:(NSData* _Nullable)result;
- (void)success:(NSString* _Nullable)result;
@end
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) NSString* _Nonnull url;
@property (nonatomic) NSString* _Nonnull host;
@end
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int32_t index;
@property (nonatomic) int32_t mtu;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
@end
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) BOOL selectable;
@property (nonatomic) NSString* _Nonnull selected;
@property (nonatomic) BOOL isExpand;
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
@end
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull tag;
@property (nonatomic) NSString* _Nonnull type;
@property (nonatomic) int64_t urlTestTime;
@property (nonatomic) int32_t urlTestDelay;
@end
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(long)port;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@property (nonatomic) NSString* _Nonnull config;
@property (nonatomic) NSString* _Nonnull remotePath;
@property (nonatomic) BOOL autoUpdate;
@property (nonatomic) int32_t autoUpdateInterval;
@property (nonatomic) int64_t lastUpdated;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
@end
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (void)append:(LibboxProfilePreview* _Nullable)profile;
- (NSData* _Nullable)encode;
@end
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t profileID;
@property (nonatomic) NSString* _Nonnull name;
@property (nonatomic) int32_t type;
@end
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
- (NSString* _Nonnull)address;
- (NSString* _Nonnull)mask;
- (int32_t)prefix;
- (NSString* _Nonnull)string;
@end
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) int64_t memory;
@property (nonatomic) int32_t goroutines;
@property (nonatomic) int32_t connectionsIn;
@property (nonatomic) int32_t connectionsOut;
@property (nonatomic) BOOL trafficAvailable;
@property (nonatomic) int64_t uplink;
@property (nonatomic) int64_t downlink;
@property (nonatomic) int64_t uplinkTotal;
@property (nonatomic) int64_t downlinkTotal;
@end
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
@property (nonatomic) BOOL available;
@property (nonatomic) BOOL enabled;
@end
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
@property (nonatomic) NSString* _Nonnull ssid;
@property (nonatomic) NSString* _Nonnull bssid;
@end
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxClearServiceError(void);
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
@class LibboxCommandClientHandler;
@class LibboxCommandServerHandler;
@class LibboxFunc;
@class LibboxHTTPClient;
@class LibboxHTTPRequest;
@class LibboxHTTPResponse;
@class LibboxInterfaceUpdateListener;
@class LibboxLocalDNSTransport;
@class LibboxNetworkInterfaceIterator;
@class LibboxOnDemandRule;
@class LibboxOnDemandRuleIterator;
@class LibboxOutboundGroupItemIterator;
@class LibboxOutboundGroupIterator;
@class LibboxPlatformInterface;
@class LibboxProfilePreviewIterator;
@class LibboxRoutePrefixIterator;
@class LibboxStringIterator;
@class LibboxTunInterface;
@class LibboxTunOptions;
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)clearLog;
- (void)connected;
- (void)disconnected:(NSString* _Nullable)message;
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
- (void)updateClashMode:(NSString* _Nullable)newMode;
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
- (void)writeLog:(NSString* _Nullable)message;
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
@end
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
- (void)postServiceClose;
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)close;
- (void)keepAlive;
- (void)modernTLS;
- (id<LibboxHTTPRequest> _Nullable)newRequest;
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
- (void)pinnedTLS12;
- (void)restrictedTLS;
- (void)trySocks5:(int32_t)port;
@end
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
- (void)randomUserAgent;
- (void)setContent:(NSData* _Nullable)content;
- (void)setContentString:(NSString* _Nullable)content;
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
- (void)setMethod:(NSString* _Nullable)method;
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
- (void)setUserAgent:(NSString* _Nullable)userAgent;
@end
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
@end
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
@end
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
- (BOOL)raw;
@end
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxNetworkInterface* _Nullable)next;
@end
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
- (int32_t)interfaceTypeMatch;
- (NSString* _Nonnull)probeURL;
- (id<LibboxStringIterator> _Nullable)ssidMatch;
- (int32_t)target;
@end
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (id<LibboxOnDemandRule> _Nullable)next;
@end
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroupItem* _Nullable)next;
@end
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxOutboundGroup* _Nullable)next;
@end
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
- (void)clearDNSCache;
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
- (BOOL)includeAllNetworks;
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
- (LibboxWIFIState* _Nullable)readWIFIState;
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
- (BOOL)underNetworkExtension;
- (BOOL)usePlatformAutoDetectInterfaceControl;
- (BOOL)usePlatformDefaultInterfaceMonitor;
- (BOOL)usePlatformInterfaceGetter;
- (BOOL)useProcFS;
- (void)writeLog:(NSString* _Nullable)message;
@end
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxProfilePreview* _Nullable)next;
@end
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (LibboxRoutePrefix* _Nullable)next;
@end
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)hasNext;
- (NSString* _Nonnull)next;
@end
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
- (int32_t)fileDescriptor;
@end
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (BOOL)getAutoRoute;
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
- (NSString* _Nonnull)getHTTPProxyServer;
- (int32_t)getHTTPProxyServerPort;
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
- (int32_t)getMTU;
- (BOOL)getStrictRoute;
- (BOOL)isHTTPProxyEnabled;
@end
#endif
@@ -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
@@ -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
@@ -0,0 +1,6 @@
framework module Libbox {
header "ref.h"
header "Libbox.objc.h"
header "Universe.objc.h"
export *
}
@@ -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>
@@ -0,0 +1,16 @@
// swift-tools-version: 5.7
import PackageDescription
let package = Package(
name: "LibboxLocal",
platforms: [.iOS(.v15), .macOS(.v13), .tvOS(.v17)],
products: [
.library(name: "Libbox", targets: ["Libbox"]),
],
targets: [
.binaryTarget(
name: "Libbox",
path: "Libbox.xcframework"
),
]
)
@@ -175,8 +175,6 @@
C0DDD6782CB907F300AE1C0A /* 5a519db7.json in Resources */ = {isa = PBXBuildFile; fileRef = C0DDD6762CB907F300AE1C0A /* 5a519db7.json */; };
C0DDD67B2CB908B200AE1C0A /* 12c853b3.json in Resources */ = {isa = PBXBuildFile; fileRef = C0DDD67A2CB908B200AE1C0A /* 12c853b3.json */; };
C0DDD6922CB9110900AE1C0A /* View+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DDD6882CB9110900AE1C0A /* View+Extensions.swift */; };
C0E540152CA17EBF0054BC97 /* Libbox.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0E540142CA17EBF0054BC97 /* Libbox.xcframework */; };
C0E540162CA17EBF0054BC98 /* Libbox.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0E540142CA17EBF0054BC97 /* Libbox.xcframework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -469,7 +467,6 @@
C0DDD6762CB907F300AE1C0A /* 5a519db7.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = 5a519db7.json; sourceTree = "<group>"; };
C0DDD67A2CB908B200AE1C0A /* 12c853b3.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = 12c853b3.json; sourceTree = "<group>"; };
C0DDD6882CB9110900AE1C0A /* View+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+Extensions.swift"; sourceTree = "<group>"; };
C0E540142CA17EBF0054BC97 /* Libbox.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Libbox.xcframework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -505,7 +502,6 @@
buildActionMask = 2147483647;
files = (
3A9759202A4EB69C00E4404B /* Library.framework in Frameworks */,
C0E540152CA17EBF0054BC97 /* Libbox.xcframework in Frameworks */,
3A4EAD372A4FEC20005435B3 /* ApplicationLibrary.framework in Frameworks */,
044AE9732CC9D33B00F5813E /* Crisp in Frameworks */,
C01BFABD2E80052E00D8ACA6 /* Vision.framework in Frameworks */,
@@ -517,7 +513,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C0E540162CA17EC10054BC98 /* Libbox.xcframework in Frameworks */,
0451E1D62CC3AE2800E9A49F /* GRDB in Frameworks */,
3A7E90382A46778E00D53052 /* BinaryCodable in Frameworks */,
3AF3A3D22B2207F3001FD7C1 /* libresolv.tbd in Frameworks */,
@@ -702,7 +697,6 @@
3AEC20BC2A45991900A63465 = {
isa = PBXGroup;
children = (
C0E540142CA17EBF0054BC97 /* Libbox.xcframework */,
3AEC20F42A459AB400A63465 /* XiaoXiong */,
3AEC211E2A459B4700A63465 /* Library */,
3A4EAD112A4FEAE6005435B3 /* ApplicationLibrary */,
@@ -1089,6 +1083,7 @@
packageProductDependencies = (
3A7E90372A46778E00D53052 /* BinaryCodable */,
0451E1D52CC3AE2800E9A49F /* GRDB */,
C0E540312CA27EC10054BCA2 /* Libbox */,
);
productName = Library;
productReference = 3AEC211D2A459B4700A63465 /* Library.framework */;
@@ -1187,6 +1182,7 @@
C0DDD6422CB7E0F000AE1C0A /* XCRemoteSwiftPackageReference "lottie-ios" */,
0451E1D42CC3ADDF00E9A49F /* XCLocalSwiftPackageReference "GRDB.swift-6.29.3" */,
044AE9712CC9D33B00F5813E /* XCLocalSwiftPackageReference "crisp-sdk-ios" */,
C0E540302CA27EC10054BCA1 /* XCLocalSwiftPackageReference "LibboxLocal" */,
);
productRefGroup = 3AEC20C72A45991900A63465 /* Products */;
projectDirPath = "";
@@ -2335,6 +2331,13 @@
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCLocalSwiftPackageReference section */
C0E540302CA27EC10054BCA1 /* XCLocalSwiftPackageReference "LibboxLocal" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = LibboxLocal;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
044AE9722CC9D33B00F5813E /* Crisp */ = {
isa = XCSwiftPackageProductDependency;
@@ -2360,6 +2363,11 @@
package = C0DDD6422CB7E0F000AE1C0A /* XCRemoteSwiftPackageReference "lottie-ios" */;
productName = Lottie;
};
C0E540312CA27EC10054BCA2 /* Libbox */ = {
isa = XCSwiftPackageProductDependency;
package = C0E540302CA27EC10054BCA1 /* XCLocalSwiftPackageReference "LibboxLocal" */;
productName = Libbox;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 3AEC20BD2A45991900A63465 /* Project object */;