Initial version of slipstream DNS tunnel

This commit is contained in:
Jop Zitman 2024-12-10 14:40:14 +08:00
commit 29f3c50237
18 changed files with 1586 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#ifndef LUA_RESTY_BASE_ENCODING_BASE32_H
#define LUA_RESTY_BASE_ENCODING_BASE32_H
#include <stdint.h>
size_t b32_encode(char *dest, const char *src, size_t len, uint32_t no_padding, uint32_t hex);
size_t b32_decode(char *dest, const char *src, size_t len, uint32_t hex);
#endif // LUA_RESTY_BASE_ENCODING_BASE32_H

32
include/slipstream.h Normal file
View file

@ -0,0 +1,32 @@
#ifndef SLIPSTREAM_H
#define SLIPSTREAM_H
/* Header file for the picoquic sample project.
* It contains the definitions common to client and server */
#ifdef __cplusplus
extern "C" {
#endif
#define SLIPSTREAM_ALPN "picoquic_sample"
#define SLIPSTREAM_SNI "test.example.com"
#define SLIPSTREAM_NO_ERROR 0
#define SLIPSTREAM_INTERNAL_ERROR 0x101
#define SLIPSTREAM_FILE_CANCEL_ERROR 0x105
#define SLIPSTREAM_CLIENT_TICKET_STORE "sample_ticket_store.bin";
#define SLIPSTREAM_CLIENT_TOKEN_STORE "sample_token_store.bin";
#define SLIPSTREAM_QLOG_DIR "./qlog/";
int picoquic_slipstream_client(int listen_port, char const* server_name, int server_port);
int picoquic_slipstream_server(int server_port, const char* pem_cert, const char* pem_key, char const* upstream_name,
int upstream_port);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,9 @@
#ifndef SLIPSTREAM_INLINE_DOTS_H
#define SLIPSTREAM_INLINE_DOTS_H
#include <stddef.h>
size_t slipstream_inline_dotify(char * __restrict__ buf, size_t buflen, size_t len);
size_t slipstream_inline_undotify(char * __restrict__ buf, size_t len);
#endif // SLIPSTREAM_INLINE_DOTS_H

View file

@ -0,0 +1,20 @@
#ifndef SLIPSTREAM_SERVER_CIRCULAR_QUEUE_BUFFER_H
#define SLIPSTREAM_SERVER_CIRCULAR_QUEUE_BUFFER_H
#define SIZE 4096
#include "SPCDNS/src/dns.h"
typedef struct {
dns_decoded_t queries[SIZE][DNS_DECODEBUF_4K];
size_t tail;
size_t head;
} circular_query_buffer_t;
dns_decoded_t* circular_query_buffer_get_write_slot(circular_query_buffer_t* buf);
dns_decoded_t* circular_query_buffer_get_read_slot(circular_query_buffer_t* buf);
size_t circular_query_buffer_get_size(circular_query_buffer_t* buf);
#endif // SLIPSTREAM_SERVER_CIRCULAR_QUEUE_BUFFER_H