mirror of
https://gitee.com/willfree/http_vpn.git
synced 2026-06-03 08:16:51 +08:00
44 lines
987 B
C++
44 lines
987 B
C++
#include "Client.h"
|
|
using namespace std;
|
|
|
|
// 输出提示信息
|
|
void alert_usage(){
|
|
cout << "Usage : ./client -s /aaa/nfd/vpn/server -c /aaa/nfd/vpn/client" << endl ;
|
|
exit(0) ;
|
|
}
|
|
|
|
// 解析参数
|
|
void parse_arg(string &server_prefix , string &m_prefix , int argc , char **argv){
|
|
if(argc < 5){
|
|
alert_usage() ;
|
|
}
|
|
string cmd1 = argv[1] ;
|
|
string cmd2 = argv[3] ;
|
|
if(cmd1 == "-s"){
|
|
server_prefix = argv[2] ;
|
|
}else if(cmd1 == "-c"){
|
|
m_prefix = argv[2] ;
|
|
}else{
|
|
alert_usage() ;
|
|
}
|
|
if(cmd2 == "-s"){
|
|
server_prefix = argv[4] ;
|
|
}else if(cmd2 == "-c"){
|
|
m_prefix = argv[4] ;
|
|
}else{
|
|
alert_usage() ;
|
|
}
|
|
if(server_prefix == "" || m_prefix == "") alert_usage() ;
|
|
}
|
|
|
|
// 主函数入口
|
|
int main(int argc , char **argv){
|
|
string server_prefix = "/aaa/nfd/vpn/server" ;
|
|
string client_prefix = "/aaa/nfd/vpn/client" ;
|
|
|
|
parse_arg(server_prefix , client_prefix, argc, argv) ;
|
|
|
|
Client *client=new Client(server_prefix,client_prefix);
|
|
client->start();
|
|
delete client;
|
|
} |