Muxun_programs/python/dns2socks.h
Galaxy 907bd5af0e mx init
the muxun is not operated by git,now init
2025-11-09 20:06:06 +08:00

88 lines
3.1 KiB
C

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef enum Dns2socksVerbosity {
Dns2socksVerbosity_Off = 0,
Dns2socksVerbosity_Error,
Dns2socksVerbosity_Warn,
Dns2socksVerbosity_Info,
Dns2socksVerbosity_Debug,
Dns2socksVerbosity_Trace,
} Dns2socksVerbosity;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
* # Safety
*
* Start dns2socks
* Parameters:
* - listen_addr: the listen address, e.g. "172.19.0.1:53", or null to use the default value
* - dns_remote_server: the dns remote server, e.g. "8.8.8.8:53", or null to use the default value
* - socks5_settings: the socks5 server, e.g. "socks5://[username[:password]@]host:port", or null to use the default value
* - force_tcp: whether to force tcp, true or false, default is false
* - cache_records: whether to cache dns records, true or false, default is false
* - verbosity: the verbosity level, see ArgVerbosity enum, default is ArgVerbosity::Info
* - timeout: the timeout in seconds, default is 5
*/
jint Java_com_github_shadowsocks_bg_Dns2socks_start(JNIEnv env,
JClass _clazz,
JString listen_addr,
JString dns_remote_server,
JString socks5_settings,
jboolean force_tcp,
jboolean cache_records,
jint verbosity,
jint timeout);
/**
* # Safety
*
* Shutdown dns2socks
*/
jint Java_com_github_shadowsocks_bg_Dns2socks_stop(JNIEnv _env, JClass);
/**
* # Safety
*
* Run the dns2socks component with some arguments.
* Parameters:
* - listen_addr: the listen address, e.g. "0.0.0.0:53", or null to use the default value
* - dns_remote_server: the dns remote server, e.g. "8.8.8.8:53", or null to use the default value
* - socks5_settings: the socks5 server, e.g. "socks5://[username[:password]@]host:port", or null to use the default value
* - force_tcp: whether to force tcp, true or false, default is false
* - cache_records: whether to cache dns records, true or false, default is false
* - verbosity: the verbosity level, see ArgVerbosity enum, default is ArgVerbosity::Info
* - timeout: the timeout in seconds, default is 5
*/
int dns2socks_start(const char *listen_addr,
const char *dns_remote_server,
const char *socks5_settings,
bool force_tcp,
bool cache_records,
enum Dns2socksVerbosity verbosity,
int32_t timeout);
/**
* # Safety
*
* Shutdown the dns2socks component.
*/
int dns2socks_stop(void);
/**
* # Safety
*
* set dump log info callback.
*/
void dns2socks_set_log_callback(void (*callback)(enum Dns2socksVerbosity, const char*, void*),
void *ctx);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus