//
//  NXSdwan.h
//  NXSdwan
//
//  Created by 徐家骏 on 2019/3/21.
//  Copyright © 2019 徐家骏. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for NXSdwan.
FOUNDATION_EXPORT double NXSdwanVersionNumber;

//! Project version string for NXSdwan.
FOUNDATION_EXPORT const unsigned char NXSdwanVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <NXSdwan/PublicHeader.h>

#import <NXSdwan/NXLoginManagerProtocol.h>
#import <NXSdwan/NXSignalManagerProtocol.h>
#import <NXSdwan/NXOption.h>
#import <NXSdwan/NXAccount.h>
#import <NXSdwan/NXTransportSession.h>
#import <NXSdwan/NXObfuscate.h>
#import <NXSdwan/NXRaptorTest.h>
#import <NXSdwan/NXRaptor.h>
#import <NXSdwan/NXDispatch.h>
#import <NXSdwan/NXLog.h>
#import <NXSdwan/NXNetworkState.h>
#import <NXSdwan/NXDeviceInfo.h>
#import <NXSdwan/NXDevicePolicy.h>
#import <NXSdwan/NVURLProtocol.h>
#import <NXSdwan/NVCustomDNS.h>
#import <NXSdwan/NXCustomSignal.h>

@protocol NXSdwanDelegate <NSObject>

@end

@interface NXSdwan : NSObject

@property(nonatomic, strong, nullable)  NXTransportSession   *activeSession;
@property(nonatomic, strong, nullable, readonly)  id<NXLoginManager> loginManager;
@property(nonatomic, strong, nullable)  id<NXSignalManager>   signalManager;
@property(nonatomic) int    p2pEnabledRatio;
@property(nonatomic) BOOL   transportationEncryptionEnabled;

+ (nonnull instancetype)sharedSDK;

//sdwan初始化，和周期刷新
- (void)registerWithOption:(nonnull NXOption *)option;

- (nullable NSString *)appID;
- (nullable NSString *)appSecret;

- (BOOL)isUsingDemoAppID;
- (NSString *)sdkVersion;

//用户注册，用户id，认证id，id注册到多个relay上。重启时自动注册，进前台时刷新relay注册，relay刷新时刷新

- (nonnull NXTransportSession *)newTransportSessionWithId:(int64_t)sessionId relayList:(nonnull NSArray *)relayList andType:(NXTransportSessionType)type;

//这个要重新设计一下
//- (NSArray *)getAllRelays;
//
//- (NSArray *)getSelectedRelays;

- (nonnull NSArray *)getSessionRelays;
- (nonnull NSArray *)selectedUdpRelays;
- (NSArray *)getPubkeyOfSessionRelays:(NSArray *)list;
- (NSArray *)getPubkeyOfUdpRelays:(NSArray *)list;
- (NSString *)getPubkeyOfUdpRelay:(NSString *)relay;
- (void)setPubkeyOfUdpRelay:(NSString *)relay pubkey:(NSString *)pubkey;

///在调用sdk任何功能之前配置 格式： https://***.com
- (void)setServerAddress:(nonnull NSString *)serverAddress;

@end

double serverTimestampMs(void);
