mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-21 23:03:08 +01:00
Update readme.md
This commit is contained in:
parent
2a27f7b463
commit
0258ed4ef0
@ -7,6 +7,7 @@ package device
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -470,7 +471,12 @@ func (peer *Peer) RoutineSequentialReceiver() {
|
||||
src_nodeID = EgHeader.GetSrc()
|
||||
dst_nodeID = EgHeader.GetDst()
|
||||
packet_type = elem.Type
|
||||
|
||||
if !packet_type.IsValid_EgType() {
|
||||
if device.LogLevel.LogTransit {
|
||||
fmt.Printf("Transit: Invalid packet usage:%v ttl:%v, content %v PL:%v S:%v D:%v From:%v IP:%v\n", elem.Type.ToString(), elem.TTL, base64.StdEncoding.EncodeToString([]byte(elem.packet)), len(elem.packet), src_nodeID.ToString(), dst_nodeID.ToString(), peer.ID.ToString(), peer.endpoint.DstToString())
|
||||
}
|
||||
goto skip
|
||||
}
|
||||
if device.IsSuperNode {
|
||||
if packet_type.IsControl_Edge2Super() {
|
||||
should_process = true
|
||||
@ -574,6 +580,10 @@ func (peer *Peer) RoutineSequentialReceiver() {
|
||||
fmt.Printf("Transit: Transfer From:%v Me:%v To:%v S:%v D:%v\n", peer.ID, device.ID, peer_out.ID, src_nodeID.ToString(), dst_nodeID.ToString())
|
||||
}
|
||||
go device.SendPacket(peer_out, elem.Type, l2ttl, elem.packet, MessageTransportOffsetContent)
|
||||
} else {
|
||||
if device.LogLevel.LogTransit {
|
||||
fmt.Printf("Transit: No route to %v,usage:%v ttl:%v, content %v PL:%v S:%v D:%v From:%v IP:%v\n", dst_nodeID.ToString(), elem.Type.ToString(), elem.TTL, base64.StdEncoding.EncodeToString([]byte(elem.packet)), len(elem.packet), src_nodeID.ToString(), dst_nodeID.ToString(), peer.ID.ToString(), peer.endpoint.DstToString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ The SuperNode runs [Floyd-Warshall Algorithm](https://en.wikipedia.org/wiki/Floy
|
||||
|
||||
## Quick start
|
||||
|
||||
首先按需求修改`gensuper.yaml`
|
||||
Edit the file `gensuper.yaml` based on your requirement first.
|
||||
|
||||
```yaml
|
||||
Config output dir: /tmp/eg_gen
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/KusakabeSi/EtherGuard-VPN/mtypes"
|
||||
)
|
||||
|
||||
const EgHeaderLen =4
|
||||
const EgHeaderLen = 4
|
||||
|
||||
type EgHeader struct {
|
||||
buf []byte
|
||||
@ -32,6 +32,42 @@ const (
|
||||
BroadcastPeer
|
||||
)
|
||||
|
||||
func (v Usage) IsValid_EgType() bool {
|
||||
if v >= NormalPacket && v <= BroadcastPeer {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (v Usage) ToString() string {
|
||||
switch v {
|
||||
case MessageInitiationType:
|
||||
return "MessageInitiationType"
|
||||
case MessageResponseType:
|
||||
return "MessageResponseType"
|
||||
case MessageCookieReplyType:
|
||||
return "MessageCookieReplyType"
|
||||
case MessageTransportType:
|
||||
return "MessageTransportType"
|
||||
case NormalPacket:
|
||||
return "NormalPacket"
|
||||
case Register:
|
||||
return "Register"
|
||||
case ServerUpdate:
|
||||
return "ServerUpdate"
|
||||
case PingPacket:
|
||||
return "PingPacket"
|
||||
case PongPacket:
|
||||
return "PongPacket"
|
||||
case QueryPeer:
|
||||
return "QueryPeer"
|
||||
case BroadcastPeer:
|
||||
return "BroadcastPeer"
|
||||
default:
|
||||
return "Unknown:" + string(uint8(v))
|
||||
}
|
||||
}
|
||||
|
||||
func (v Usage) IsNormal() bool {
|
||||
return v == NormalPacket
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user