Compare commits
74 Commits
d0dc6076c8
...
e4988b9e9c
| Author | SHA1 | Date | |
|---|---|---|---|
|
e4988b9e9c
|
|||
|
0183b35acf
|
|||
|
|
faeb599a19 | ||
|
|
a4e72918df | ||
|
|
d7e8dbe0e7 | ||
|
|
71d16f25ff | ||
|
|
c426cef08b | ||
|
|
bda2c6eaa7 | ||
|
|
d68aee8249 | ||
|
|
2f966bb365 | ||
|
|
4a7740f70f | ||
|
|
5be4096452 | ||
|
|
3747aa7abd | ||
|
|
e3eb1f96a5 | ||
|
|
2f5e346532 | ||
|
|
a9fdd76fa3 | ||
|
|
0a9a139409 | ||
|
|
2811e2383f | ||
|
|
ed6cc0e6f6 | ||
|
|
487474a80e | ||
|
|
edb86d27ad | ||
|
|
c0d2118a77 | ||
|
|
70e80f76e0 | ||
|
|
e4092ebebd | ||
|
|
2330e6470e | ||
|
|
7d59eedd39 | ||
|
|
c536bef802 | ||
|
|
23a5cdfe31 | ||
|
|
6894867b9f | ||
|
|
8f11ffa5a4 | ||
|
|
1f18b731c4 | ||
|
|
e3689d29b7 | ||
|
|
2a812f332f | ||
|
|
b16a754713 | ||
|
|
b6238c939e | ||
|
|
6e8a3cef1e | ||
|
|
e56abf5eaa | ||
|
|
6b1881e94c | ||
|
|
7ff46e742b | ||
|
|
a87a277701 | ||
|
|
ef41aa28ce | ||
|
|
d5322e187d | ||
|
|
0a2b23bb88 | ||
|
|
3a30c63eff | ||
|
|
9c27f92f9d | ||
|
|
9e3e2b358b | ||
|
|
a6acb8736c | ||
|
|
3d4e3a8fbe | ||
|
|
97407b2527 | ||
|
|
dc22121739 | ||
|
|
06c0945ac5 | ||
|
|
2b19c80ae3 | ||
|
|
21b15727c5 | ||
|
|
569e712248 | ||
|
|
8c033a12a1 | ||
|
|
6b58ebb993 | ||
|
|
7179de77da | ||
|
|
e6a8c8e013 | ||
|
|
137971e957 | ||
|
|
9abb50a7e2 | ||
|
|
2766a94e3b | ||
|
|
c420e9494a | ||
|
|
407db114c6 | ||
|
|
0537b01d4b | ||
|
|
79dc61e7dc | ||
|
|
67a660117e | ||
|
|
831714e07f | ||
|
|
f047af8148 | ||
|
|
8948d00545 | ||
|
|
2e8a13f135 | ||
|
|
f647519e1c | ||
|
|
94ae912138 | ||
|
|
e3b56376dc | ||
|
|
8c88934763 |
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,4 +0,0 @@
|
||||
[submodule "aegis256"]
|
||||
path = aegis256
|
||||
url = https://github.com/angt/aegis256
|
||||
ignore = dirty
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016-2019, Adrien Gallouët <adrien@gallouet.fr>
|
||||
Copyright (c) 2016-2020, Adrien Gallouët <adrien@gallouet.fr>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
1
aegis256
1
aegis256
Submodule aegis256 deleted from 00fdf8a605
64
mud.h
64
mud.h
@@ -16,17 +16,19 @@ enum mud_state {
|
||||
MUD_UP,
|
||||
};
|
||||
|
||||
struct mud_pubkey {
|
||||
unsigned char remote[MUD_PUBKEY_SIZE];
|
||||
unsigned char local[MUD_PUBKEY_SIZE];
|
||||
};
|
||||
|
||||
struct mud_stat {
|
||||
uint64_t val;
|
||||
uint64_t var;
|
||||
int setup;
|
||||
};
|
||||
|
||||
struct mud_conf {
|
||||
uint64_t keepalive;
|
||||
uint64_t timetolerance;
|
||||
uint64_t kxtimeout;
|
||||
int tc;
|
||||
};
|
||||
|
||||
struct mud_path {
|
||||
enum mud_state state;
|
||||
struct sockaddr_storage local_addr, addr, r_addr;
|
||||
@@ -35,22 +37,37 @@ struct mud_path {
|
||||
uint64_t total;
|
||||
uint64_t bytes;
|
||||
uint64_t time;
|
||||
uint64_t msg_time;
|
||||
uint64_t rate;
|
||||
uint64_t rate_max;
|
||||
uint64_t loss;
|
||||
} tx, rx;
|
||||
struct {
|
||||
struct {
|
||||
uint64_t total;
|
||||
uint64_t bytes;
|
||||
uint64_t time;
|
||||
uint64_t acc;
|
||||
uint64_t acc_time;
|
||||
} tx, rx;
|
||||
uint64_t time;
|
||||
uint64_t sent;
|
||||
uint64_t set;
|
||||
} msg;
|
||||
struct {
|
||||
size_t min;
|
||||
size_t max;
|
||||
size_t probe;
|
||||
size_t last;
|
||||
size_t ok;
|
||||
} mtu;
|
||||
uint64_t window;
|
||||
uint64_t window_time;
|
||||
struct mud_pubkey pk;
|
||||
struct {
|
||||
uint64_t tx_max_rate;
|
||||
uint64_t rx_max_rate;
|
||||
uint64_t beat;
|
||||
unsigned char fixed_rate;
|
||||
unsigned char loss_limit;
|
||||
} conf;
|
||||
uint64_t idle;
|
||||
unsigned char ok;
|
||||
unsigned msg_sent;
|
||||
};
|
||||
|
||||
struct mud_bad {
|
||||
@@ -64,29 +81,26 @@ struct mud_bad {
|
||||
struct mud *mud_create (struct sockaddr *);
|
||||
void mud_delete (struct mud *);
|
||||
|
||||
int mud_get_fd (struct mud *);
|
||||
int mud_update (struct mud *);
|
||||
int mud_send_wait (struct mud *);
|
||||
|
||||
int mud_get_fd (struct mud *);
|
||||
size_t mud_get_mtu (struct mud *);
|
||||
int mud_get_bad (struct mud *, struct mud_bad *);
|
||||
|
||||
int mud_set_key (struct mud *, unsigned char *, size_t);
|
||||
int mud_get_key (struct mud *, unsigned char *, size_t *);
|
||||
|
||||
void mud_set_mtu (struct mud *, size_t);
|
||||
size_t mud_get_mtu (struct mud *);
|
||||
|
||||
int mud_get_bad (struct mud *, struct mud_bad *);
|
||||
|
||||
long mud_send_wait (struct mud *);
|
||||
|
||||
int mud_set_time_tolerance (struct mud *, unsigned long);
|
||||
int mud_set_keyx_timeout (struct mud *, unsigned long);
|
||||
int mud_set_tc (struct mud *, int);
|
||||
int mud_set_aes (struct mud *);
|
||||
int mud_set_aes (struct mud *);
|
||||
int mud_set_conf (struct mud *, struct mud_conf *);
|
||||
|
||||
int mud_set_state (struct mud *, struct sockaddr *, enum mud_state,
|
||||
unsigned long, unsigned long);
|
||||
unsigned long, unsigned long, unsigned long,
|
||||
unsigned char, unsigned char);
|
||||
|
||||
int mud_peer (struct mud *, struct sockaddr *);
|
||||
|
||||
int mud_recv (struct mud *, void *, size_t);
|
||||
int mud_send (struct mud *, const void *, size_t, unsigned);
|
||||
int mud_send (struct mud *, const void *, size_t);
|
||||
|
||||
struct mud_path *mud_get_paths(struct mud *, unsigned *);
|
||||
|
||||
7
test.c
7
test.c
@@ -1,5 +1,4 @@
|
||||
#include "mud.c"
|
||||
#include "aegis256/aegis256.c"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <poll.h>
|
||||
@@ -52,7 +51,7 @@ main(int argc, char **argv)
|
||||
|
||||
// ...from loopback at 1MBps (not 1Mbps)
|
||||
if (mud_set_state(mud, (struct sockaddr *)&local,
|
||||
MUD_UP, 1000 * 1000, 1000 * 1000)) {
|
||||
MUD_UP, 1000 * 1000, 1000 * 1000, 0, 0, 0)) {
|
||||
perror("mud_set_state");
|
||||
return -1;
|
||||
}
|
||||
@@ -62,7 +61,7 @@ main(int argc, char **argv)
|
||||
|
||||
for (;;) {
|
||||
// mandatory, mud have lot of work to do.
|
||||
if (mud_send_wait(mud))
|
||||
if (mud_update(mud))
|
||||
usleep(100000); // don't use all the cpu
|
||||
|
||||
if (client) {
|
||||
@@ -85,7 +84,7 @@ main(int argc, char **argv)
|
||||
|
||||
// we can safely call mud_send()
|
||||
// even if the link is not ready
|
||||
int r = mud_send(mud, argv[1], strlen(argv[1]), 0);
|
||||
int r = mud_send(mud, argv[1], strlen(argv[1]));
|
||||
|
||||
if (r == -1) {
|
||||
if (errno == EAGAIN)
|
||||
|
||||
Reference in New Issue
Block a user