This is the Go code which corresponds to the coreinstance code in obj-c
func startV2Ray() (core.Server, error) {
configFiles, err := getConfigFilePath()
if err != nil {
return nil, err
}
config, err := core.LoadConfig(GetConfigFormat(), configFiles[0], configFiles)
if err != nil {
return nil, newError("failed to read config files: [", configFiles.String(), "]").Base(err)
}
server, err := core.New(config)
if err != nil {
return nil, newError("failed to create server").Base(err)
}
return server, nil
}
obj-c code
@interface CoreInstance : NSObject <goSeqRefInterface, CoreServer> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
- (nonnull instancetype)init;
// skipped method Instance.AddFeature with unsupported parameter or return types
/**
* Close shutdown the V2Ray instance.
*/
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
// skipped method Instance.GetFeature with unsupported parameter or return types
// skipped method Instance.RequireFeatures with unsupported parameter or return types
/**
* Start starts the V2Ray instance, including all registered features. When Start returns error, the state of the instance is unknown.
A V2Ray instance can be started only once. Upon closing, the instance is not guaranteed to start again.
v2ray:api:stable
*/
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
// skipped method Instance.Type with unsupported parameter or return types
@end