101 Commits

Author SHA1 Message Date
lucheng b4be9a7b32 Add notices in readme, use vtun to support both linux macos and windows 2024-08-28 11:42:10 +08:00
lucheng a6bfacb0c2 Fix client ip by get client ip base on username hash
Count username hash, get client ip base on it, it will make ip
fixed base on client login username.
2024-08-09 12:30:26 +08:00
lucheng b6c51a357c Add demo for use tun
For MacOS, it only support tun. If use tun than tap, server
should recode ip of each endpoint. And parse ipv4 header
from net connection, and forword packet according to ipv4
header dst ip. If dst ip included by vpn cidr cheack the
endpoint and forward to it. If dst ip included by vpn cidr
but no recode of endpoint, drop it do nothing. If dst ip
not included by vpn cidr, send it to server tun interface,
it will forword by server according to routes and iptables
rules.
2024-08-05 13:46:49 +08:00
lucheng c3e8b29a83 Add TODO use hash map to get ip from pool
1. Use username as input to count hash then get ip index
2. Change test env cidr
2024-08-05 09:20:04 +08:00
ShawnLu dc49d5acd4 Merge pull request #13 from lucheng0127/err
Return error when launch client, don't use os.Exist
2024-07-12 11:38:46 +08:00
lucheng a08e9802e4 Use error channel to get goroutine errors 2024-07-12 11:35:45 +08:00
lucheng c4db99d32a Use errgroup to return error of goruntine 2024-07-12 09:51:43 +08:00
lucheng 9d2038ff6f Create Client struct, launch client with Client.Launch
1. Make client a lib, than Client can be create and launch outside
the pkg.
2. Add CheckAuthed func, it will used by the APP Dashboard
2024-07-11 10:11:50 +08:00
lucheng f010c45a96 Revert "Add RunClient function, it will used by app dashboard"
This reverts commit d2a06d2685.
2024-07-11 09:05:37 +08:00
lucheng efab227ca4 Set log output to stdout 2024-07-10 13:52:51 +08:00
shawnlu d2a06d2685 Add RunClient function, it will used by app dashboard 2024-07-07 21:29:02 +08:00
lucheng d8bf22bef0 Make index.html configurable 2024-07-05 17:03:18 +08:00
lucheng 5178b4ae6c Add TODO implement sync routes for windows 2024-07-04 11:24:09 +08:00
lucheng ff6611fc2c Modify readme 2024-07-03 15:26:57 +08:00
lucheng 8311582159 Tar beforce upload to release v1.0-windows 2024-07-03 10:30:23 +08:00
lucheng cb446b7a1c Use ACCESS_TOKEN in action 2024-07-03 10:08:46 +08:00
lucheng db7764a492 Fix make default can't more than one target 2024-07-03 09:50:30 +08:00
lucheng 444e68f980 Fix ut failed 2024-07-03 09:46:46 +08:00
lucheng deb38c4e77 Upload binary to release in action 2024-07-03 09:38:49 +08:00
ShawnLu c6b1414e0c Create build.yml 2024-07-02 17:56:04 +08:00
lucheng 3bda711ed5 Modify README about windows support windows 2024-07-02 15:09:37 +08:00
ShawnLu d3f6107545 Merge pull request #12 from lucheng0127/windows
Windows supported
2024-07-02 14:56:25 +08:00
lucheng 395129216e Windows supported
Support build windows client.
Use in windows, make sure you have been install tap-windows properly.
After launch, the windows client will now listen udp multicast
so if you need to config routes by yourself
2024-07-02 14:49:06 +08:00
lucheng 550901f699 Add windows support to README 2024-07-02 11:45:38 +08:00
lucheng eacff68bac Update README v1.0-alpha 2024-07-01 09:49:01 +08:00
lucheng 76e7009fdd Add flag to set client log level 2024-07-01 09:25:25 +08:00
shawnlu fea0acf96f Don't send route multicast if not config routes
1. Don't send route multicast if not config routes
2. Add debug log to show route multcast send and receive
3. Add TODO to set log level for client
2024-07-01 00:59:18 +08:00
shawnlu cec9a3e135 Implement multicast routes
1. Implement multicast routes, use username as route nexthop,
   server will parse username to ip
2. For route to virtuallan server use SERVER as nexthop
3. Add 50ms delay before send route multicast, to prevent endpoint
   start too fast don't reveice route mlticast
4. Whenever user login or logout multicast routes, no matter user
   in routes nexthop
2024-07-01 00:03:08 +08:00
shawnlu aa4601fa78 Update route when route nexthop user login or logout and send multicast
Only configured routes nexthop user login or logout will make
svc.Routes data change, when svc.Routes change send multicast
to sync routes
SyncRoutesForIface, bind route with tap or bridge interface
so when tap or bridge delted routes will clean up auto.
For know route nexthop ip use replace flag, for unknow route
nexthop ip delete route if exist.
2024-06-30 15:51:47 +08:00
shawnlu fe4bbbd8df Add multicast route when setup bridge or tap 2024-06-30 15:07:31 +08:00
shawnlu 4d5743f0a1 Refactor multicast routes 2024-06-30 10:05:50 +08:00
shawnlu c52966c84b Add multicast send func 2024-06-29 22:49:01 +08:00
shawnlu 25d45734a7 Add TODO to add multicast route dev 2024-06-29 22:09:31 +08:00
shawnlu 0f93569a0b Add funcs to encode or decode avaliable routes between bytes 2024-06-29 21:36:15 +08:00
lucheng a81d35c8b6 Parse routes, sync routes nexthop ip when user authed or client close
Before run server init routes map, key nexthop username, value flag
when user login update value to client ip, when client close update
it to flag
2024-06-28 15:47:25 +08:00
lucheng dd172cee11 Customize process output, to hide some info such as key 2024-06-28 10:21:24 +08:00
lucheng efb0835f91 Add TODO for assign route for endpoints
Routes configed by server, like cidr 192.168.0.0/24
nexthop endpoint username.
Beacuse of endpoint user is already know, but the ip
of endpoint it got from ip pool, so we need to parse
endpoint ip by username.
2024-06-28 09:18:43 +08:00
lucheng 6460f1d8e5 Make AES key configurable
1. Use SetAESKey to set AES key
2. Check config.yaml and make port and log info with default value
3. Make will generate new random AES key in config.yaml
2024-06-27 15:35:49 +08:00
ShawnLu 415992ae19 Merge pull request #11 from w1543565388/fix_key_configurable
Set the AES Key to configurable
2024-06-27 11:39:17 +08:00
root ac5ec0ad26 Set the AES Key to configurable 2024-06-27 11:34:00 +08:00
ShawnLu e72352ccaf Merge pull request #10 from w1543565388/fix_aes_panic
Recover aes.go error crypto/cipher: input not full blocks to log
2024-06-25 11:26:24 +08:00
root 9b64bd1283 Recover aes.go error crypto/cipher: input not full blocks to log 2024-06-25 11:02:25 +08:00
lucheng b9fc980671 Add multicast demo 2024-06-17 09:55:11 +08:00
lucheng 487d03ef23 Add TODO to add preset routes 2024-06-12 09:10:06 +08:00
lucheng 9721fea650 Update README 2024-06-11 17:22:23 +08:00
lucheng 3728d64c35 Add nat to dev env v0.2 2024-06-11 15:43:22 +08:00
lucheng 8591467881 Fix pkt stats wrong
The stats data is the tap pkt stats on server, and the tap on endpoint
just like a veth peer of tap on server, so the actually stats of
endpoint is opposite.
2024-06-11 14:34:09 +08:00
ShawnLu b7e3341d05 Merge pull request #5 from w1543565388/master
Add packet counts and upstream and downstream traffic counts
2024-06-11 14:16:34 +08:00
wj 2fdc3d9476 Add packet counts and upstream and downstream traffic counts 2024-06-11 05:52:50 +00:00
shawnlu fcc4a23d16 Set mac address according to tap ipv4 address
When endpoint reconnect, the tap interface will recreate, and the
mac address of tap will change. It will make arp entry staled.
It will cause network not reachable before arp entry update.
So fix it by set tap with a special mac address that generated
by ipv4 address, and it will make sure each ip with a fixed mac
address, and the arp entry will still be correct even when tap
has been recreate.
2024-06-10 21:42:10 +08:00