Documentation ¶
Index ¶
- func If[T any](cond bool, a, b T) T
- type Client
- type ClientOption
- type FakeGate
- type GateInf
- type IPv4Hdr
- type RouteTable
- type Server
- func (server *Server) Auth(stream proto.Stream_PersistentStreamServer) (net.IP, bool)
- func (server *Server) BroadcastRouteWithoutMe(stream proto.Stream_PersistentStreamServer, msg *proto.Message)
- func (server *Server) GatherRouteTo(stream proto.Stream_PersistentStreamServer)
- func (server *Server) PersistentStream(stream proto.Stream_PersistentStreamServer) error
- func (server *Server) ReadMessage() (*proto.Message, error)
- func (server *Server) WriteMessage(msg *proto.Message) error
- type ServerOption
- type Socket
- type StreamStore
- type TokenAuth
- type TunWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func StartGrpcClient ¶
func StartGrpcClient(option *ClientOption) *Client
type ClientOption ¶
type IPv4Hdr ¶
func ParseIpv4Hdr ¶
type RouteTable ¶
type RouteTable struct {
// contains filtered or unexported fields
}
func NewRouteTable ¶
func NewRouteTable() *RouteTable
func (*RouteTable) Add ¶
func (ds *RouteTable) Add(cidr string, val proto.Stream_PersistentStreamServer) error
func (*RouteTable) Delete ¶
func (ds *RouteTable) Delete(cidr string) error
func (*RouteTable) DeleteBatch ¶
func (ds *RouteTable) DeleteBatch(cidrs []string)
func (*RouteTable) Lookup ¶
func (ds *RouteTable) Lookup(addr net.IP) (t proto.Stream_PersistentStreamServer, ok bool)
type Server ¶
type Server struct { proto.UnimplementedStreamServer Token string GateImpl GateInf // contains filtered or unexported fields }
func StartGrpcServer ¶
func StartGrpcServer(option *ServerOption, subnet string) *Server
func (*Server) BroadcastRouteWithoutMe ¶
func (server *Server) BroadcastRouteWithoutMe(stream proto.Stream_PersistentStreamServer, msg *proto.Message)
BroadcastRouteWithoutMe 发送广播,路由信息
func (*Server) GatherRouteTo ¶
func (server *Server) GatherRouteTo(stream proto.Stream_PersistentStreamServer)
GatherRouteTo 将所有路由信息集中发送到Stream
func (*Server) PersistentStream ¶
func (server *Server) PersistentStream(stream proto.Stream_PersistentStreamServer) error
func (*Server) ReadMessage ¶
ReadMessage 从GRPCServer读取发送给Tunnel的数据
type ServerOption ¶
type StreamStore ¶
type TokenAuth ¶
func (*TokenAuth) GetRequestMetadata ¶
func (*TokenAuth) RequireTransportSecurity ¶
RequireTransportSecurity 是否强制使用TLS
type TunWrapper ¶
type TunWrapper struct { grpc.ServerStream // contains filtered or unexported fields }
TunWrapper 将Tunnel模拟GRPC Stream
func NewTunWrapper ¶
func NewTunWrapper() *TunWrapper
Click to show internal directories.
Click to hide internal directories.