mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-05-13 00:04:14 +08:00
Wrap interface stats
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// OpenVPNInterfaceStats+Internal.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <client/ovpncli.hpp>
|
||||
|
||||
#import "OpenVPNInterfaceStats.h"
|
||||
|
||||
using namespace openvpn;
|
||||
|
||||
@interface OpenVPNInterfaceStats (Internal)
|
||||
|
||||
- (instancetype)initWithInterfaceStats:(ClientAPI::InterfaceStats)stats;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// OpenVPNInterfaceStats.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OpenVPNInterfaceStats : NSObject
|
||||
|
||||
@property (readonly, nonatomic) NSInteger bytesIn;
|
||||
@property (readonly, nonatomic) NSInteger bytesOut;
|
||||
@property (readonly, nonatomic) NSInteger packetsIn;
|
||||
@property (readonly, nonatomic) NSInteger packetsOut;
|
||||
@property (readonly, nonatomic) NSInteger errorsIn;
|
||||
@property (readonly, nonatomic) NSInteger errorsOut;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// OpenVPNInterfaceStats.m
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import "OpenVPNInterfaceStats.h"
|
||||
#import "OpenVPNInterfaceStats+Internal.h"
|
||||
|
||||
@implementation OpenVPNInterfaceStats
|
||||
|
||||
- (instancetype)initWithInterfaceStats:(ClientAPI::InterfaceStats)stats {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_bytesIn = stats.bytesIn;
|
||||
_bytesOut = stats.bytesOut;
|
||||
_packetsIn = stats.packetsIn;
|
||||
_packetsOut = stats.packetsOut;
|
||||
_errorsIn = stats.errorsIn;
|
||||
_errorsOut = stats.errorsOut;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user