Browse Source

feat: applet module

dev
dnomd343 2 years ago
parent
commit
21704c7cfa
  1. 16
      include/applet/adguard.h
  2. 2
      include/applet/dnsproxy.h
  3. 2
      include/applet/overture.h
  4. 6
      src/CMakeLists.txt
  5. 3
      src/applet/CMakeLists.txt
  6. 12
      src/applet/adguard.c
  7. 0
      src/applet/dnsproxy.c
  8. 0
      src/applet/overture.c

16
include/applet/adguard.h

@ -0,0 +1,16 @@
#ifndef _ADGUARD_H_
#define _ADGUARD_H_
#include "common.h"
#include "process.h"
typedef struct {
uint8_t debug; // bool value
uint16_t dns_port;
uint16_t web_port;
char *upstream;
char *username;
char *password;
} adguard;
#endif

2
include/dnsproxy.h → include/applet/dnsproxy.h

@ -1,8 +1,8 @@
#ifndef _DNSPROXY_H_
#define _DNSPROXY_H_
#include "process.h"
#include "common.h"
#include "process.h"
typedef struct {
uint16_t port;

2
include/overture.h → include/applet/overture.h

@ -1,8 +1,8 @@
#ifndef _OVERTURE_H_
#define _OVERTURE_H_
#include "process.h"
#include "common.h"
#include "process.h"
typedef struct {
uint16_t port;

6
src/CMakeLists.txt

@ -2,10 +2,12 @@ cmake_minimum_required(VERSION 2.8.12)
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/include/utils)
include_directories(${PROJECT_SOURCE_DIR}/include/applet)
include_directories(${PROJECT_SOURCE_DIR}/include/loader)
add_subdirectory(utils)
add_subdirectory(applet)
add_subdirectory(loader)
add_executable(cleardns cleardns.c dnsproxy.c common.c overture.c)
target_link_libraries(cleardns loader utils)
add_executable(cleardns cleardns.c common.c)
target_link_libraries(cleardns utils applet loader)

3
src/applet/CMakeLists.txt

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 2.8.12)
add_library(applet adguard.c dnsproxy.c overture.c)

12
src/applet/adguard.c

@ -0,0 +1,12 @@
#include "adguard.h"
adguard* adguard_init() {
adguard *info = (adguard *)malloc(sizeof(adguard));
info->debug = FALSE;
info->dns_port = DNS_PORT;
info->web_port = ADGUARD_PORT;
info->upstream = string_join("127.0.0.1:", "5353"); // TODO: use DIVERTER_PORT
info->username = string_init(ADGUARD_USER);
info->password = string_init(ADGUARD_PASSWD);
return info;
}

0
src/dnsproxy.c → src/applet/dnsproxy.c

0
src/overture.c → src/applet/overture.c

Loading…
Cancel
Save