Documentation ¶
Overview ¶
Package vless provies vless proxy support for proxy.Client and proxy.Server
Index ¶
- Constants
- func GenerateXrayShareURL(dialconf *proxy.DialConf) string
- func GetAddrFrom(buf utils.ByteReader) (addr netLayer.Addr, err error)
- func NewClientByURL(url *url.URL) (proxy.Client, error)
- func NewServer(url *url.URL) (proxy.Server, error)
- func WriteAddrTo(writeBuf utils.ByteWriter, raddr netLayer.Addr)
- type Client
- func (c *Client) EstablishUDPChannel(underlay net.Conn, target netLayer.Addr) (netLayer.MsgConn, error)
- func (c *Client) GetUser() proxy.User
- func (c *Client) Handshake(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (io.ReadWriteCloser, error)
- func (c *Client) HasInnerMux() (int, string)
- func (c *Client) IsUDP_MultiChannel() bool
- func (c *Client) Name() string
- func (c *Client) Version() int
- type ClientCreator
- type Server
- func (s *Server) AddV2User(u *proxy.V2rayUser)
- func (*Server) CanFallback() bool
- func (s *Server) DelV2User(u *proxy.V2rayUser)
- func (s *Server) GetUserByBytes(bs []byte) proxy.User
- func (s *Server) GetUserByStr(str string) proxy.User
- func (s *Server) Handshake(underlay net.Conn) (result net.Conn, msgConn netLayer.MsgConn, targetAddr netLayer.Addr, ...)
- func (*Server) HasInnerMux() (int, string)
- func (s *Server) HasUserByBytes(bs []byte) bool
- func (s *Server) Name() string
- func (s *Server) UserBytesLen() int
- type ServerCreator
- type UDPConn
- type UserTCPConn
- func (c *UserTCPConn) CanSplice() (r bool, conn net.Conn)
- func (c *UserTCPConn) EverPossibleToSplice() bool
- func (uc *UserTCPConn) GetIdentityStr() string
- func (uc *UserTCPConn) GetProtocolVersion() int
- func (uc *UserTCPConn) Read(p []byte) (int, error)
- func (c *UserTCPConn) ReadBuffers() (bs [][]byte, err error)
- func (uc *UserTCPConn) ReadFrom(r io.Reader) (written int64, err error)
- func (c *UserTCPConn) WillReadBuffersBenifit() bool
- func (uc *UserTCPConn) Write(p []byte) (int, error)
- func (c *UserTCPConn) WriteBuffers(buffers [][]byte) (int64, error)
Constants ¶
View Source
const ( CmdTCP byte CmdUDP CmdMux )
CMD types, for vless and vmess
View Source
const Name = "vless"
Variables ¶
This section is empty.
Functions ¶
func GenerateXrayShareURL ¶
func GetAddrFrom ¶
func GetAddrFrom(buf utils.ByteReader) (addr netLayer.Addr, err error)
依照 vless 协议的格式 依次读取 地址的 port, 域名/ip 信息
func WriteAddrTo ¶
func WriteAddrTo(writeBuf utils.ByteWriter, raddr netLayer.Addr)
依照 vless 协议的格式 依次写入 地址的 port, 域名/ip 信息
Types ¶
type Client ¶
type Client struct { proxy.ProxyCommonStruct // contains filtered or unexported fields }
实现 proxy.UserClient
func (*Client) EstablishUDPChannel ¶
func (*Client) IsUDP_MultiChannel ¶
type ClientCreator ¶
type ClientCreator struct{}
func (ClientCreator) NewClientFromURL ¶
type Server ¶
type Server struct { proxy.ProxyCommonStruct // contains filtered or unexported fields }
Server 同时支持vless v0 和 v1 实现 proxy.UserServer 以及 tlsLayer.UserHaser
func (*Server) CanFallback ¶
func (*Server) Handshake ¶
func (s *Server) Handshake(underlay net.Conn) (result net.Conn, msgConn netLayer.MsgConn, targetAddr netLayer.Addr, returnErr error)
返回的bytes.Buffer 是用于 回落使用的,内含了整个读取的数据;不回落时不要使用该Buffer
func (*Server) HasInnerMux ¶
func (*Server) HasUserByBytes ¶
func (*Server) UserBytesLen ¶
type ServerCreator ¶
type ServerCreator struct{}
func (ServerCreator) NewServer ¶
func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error)
func (ServerCreator) NewServerFromURL ¶
type UDPConn ¶
func (*UDPConn) CloseConnWithRaddr ¶
type UserTCPConn ¶
实现 net.Conn, io.ReaderFrom, utils.MultiWriter, utils.MultiReader, netLayer.Splicer
func (*UserTCPConn) EverPossibleToSplice ¶
func (c *UserTCPConn) EverPossibleToSplice() bool
func (*UserTCPConn) GetIdentityStr ¶
func (uc *UserTCPConn) GetIdentityStr() string
func (*UserTCPConn) GetProtocolVersion ¶
func (uc *UserTCPConn) GetProtocolVersion() int
func (*UserTCPConn) Read ¶
func (uc *UserTCPConn) Read(p []byte) (int, error)
如果是udp,则是多线程不安全的,如果是tcp,则安不安全看底层的链接。 这里规定,如果是UDP,则 每次 Read 得到的都是一个 完整的UDP 数据包,除非p给的太小……
func (*UserTCPConn) ReadBuffers ¶
func (c *UserTCPConn) ReadBuffers() (bs [][]byte, err error)
func (*UserTCPConn) ReadFrom ¶
func (uc *UserTCPConn) ReadFrom(r io.Reader) (written int64, err error)
专门适用于 裸奔splice的情况
func (*UserTCPConn) WillReadBuffersBenifit ¶
func (c *UserTCPConn) WillReadBuffersBenifit() bool
func (*UserTCPConn) Write ¶
func (uc *UserTCPConn) Write(p []byte) (int, error)
如果是udp,则是多线程不安全的,如果是tcp,则安不安全看底层的链接。 这里规定,如果是UDP,则 每Write一遍,都要Write一个 完整的UDP 数据包
func (*UserTCPConn) WriteBuffers ¶
func (c *UserTCPConn) WriteBuffers(buffers [][]byte) (int64, error)
Click to show internal directories.
Click to hide internal directories.