Documentation ¶
Overview ¶
Package vless implements vless v0/v1 for proxy.Client and proxy.Server.
vless的客户端配置 分享url文档: https://github.com/XTLS/Xray-core/discussions/716
Index ¶
- Constants
- func GenerateXrayShareURL(dc *proxy.DialConf) string
- func WriteAddrTo(writeBuf utils.ByteWriter, raddr netLayer.Addr)
- type Client
- func (c *Client) EstablishUDPChannel(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (netLayer.MsgConn, error)
- func (*Client) GetCreator() proxy.ClientCreator
- func (c *Client) GetUser() utils.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
- type ServerCreator
- type UDPConn
- type UserTCPConn
- func (c *UserTCPConn) CanMultiRead() bool
- func (c *UserTCPConn) CanSpliceRead() (bool, *net.TCPConn, *net.UnixConn)
- func (c *UserTCPConn) CanSpliceWrite() (r bool, conn *net.TCPConn)
- func (c *UserTCPConn) EverPossibleToSpliceRead() bool
- func (c *UserTCPConn) EverPossibleToSpliceWrite() bool
- func (u *UserTCPConn) GetProtocolVersion() int
- func (c *UserTCPConn) GetRawForReadv() syscall.RawConn
- func (c *UserTCPConn) PutBuffers(bs [][]byte)
- func (c *UserTCPConn) Read(p []byte) (int, error)
- func (c *UserTCPConn) ReadBuffers() (bs [][]byte, err error)
- func (c *UserTCPConn) ReadFrom(r io.Reader) (written int64, err error)
- func (c *UserTCPConn) Upstream() net.Conn
- func (c *UserTCPConn) WillReadBuffersBenifit() int
- func (c *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 WriteAddrTo ¶
func WriteAddrTo(writeBuf utils.ByteWriter, raddr netLayer.Addr)
依照 vless 协议的格式 依次写入 地址的 port, 域名/ip 信息
Types ¶
type Client ¶
实现 proxy.UserClient
func (*Client) EstablishUDPChannel ¶
func (*Client) GetCreator ¶ added in v1.2.4
func (*Client) GetCreator() proxy.ClientCreator
func (*Client) IsUDP_MultiChannel ¶
type ClientCreator ¶
type ClientCreator struct{ proxy.CreatorCommonStruct }
type Server ¶
type Server struct { proxy.Base *utils.MultiUserMap // 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) (tcpConn net.Conn, msgConn netLayer.MsgConn, targetAddr netLayer.Addr, returnErr error)
返回的bytes.Buffer 是用于 回落使用的,内含了整个读取的数据;不回落时不要使用该Buffer
func (*Server) HasInnerMux ¶
type ServerCreator ¶
type ServerCreator struct{ proxy.CreatorCommonStruct }
func (ServerCreator) NewServer ¶
func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error)
如果 lc.Version==0, 则只支持 v0.
func (ServerCreator) URLToListenConf ¶ added in v1.2.4
func (ServerCreator) URLToListenConf(url *url.URL, lc *proxy.ListenConf, format int) (*proxy.ListenConf, error)
如果 v=0, 则只支持 v0.
type UDPConn ¶
type UDPConn struct { net.Conn utils.V2rayUser //在 Server握手成功后会设置这一项. // contains filtered or unexported fields }
func (*UDPConn) CloseConnWithRaddr ¶
func (*UDPConn) GetProtocolVersion ¶ added in v1.2.2
type UserTCPConn ¶
type UserTCPConn struct { net.Conn utils.V2rayUser //在 Server握手成功后会设置这一项. // contains filtered or unexported fields }
实现 net.Conn, io.ReaderFrom, utils.User, utils.MultiWriter, utils.MultiReader, netLayer.Splicer, netLayer.ConnWrapper, netLayer.SpliceReader
func (*UserTCPConn) CanMultiRead ¶ added in v1.2.5
func (c *UserTCPConn) CanMultiRead() bool
func (*UserTCPConn) CanSpliceRead ¶ added in v1.2.5
func (*UserTCPConn) CanSpliceWrite ¶ added in v1.2.5
func (c *UserTCPConn) CanSpliceWrite() (r bool, conn *net.TCPConn)
func (*UserTCPConn) EverPossibleToSpliceRead ¶ added in v1.2.5
func (c *UserTCPConn) EverPossibleToSpliceRead() bool
当底层链接可以暴露为 tcp或 unix链接时,返回true
func (*UserTCPConn) EverPossibleToSpliceWrite ¶ added in v1.2.5
func (c *UserTCPConn) EverPossibleToSpliceWrite() bool
func (*UserTCPConn) GetProtocolVersion ¶
func (u *UserTCPConn) GetProtocolVersion() int
func (*UserTCPConn) GetRawForReadv ¶ added in v1.2.5
func (c *UserTCPConn) GetRawForReadv() syscall.RawConn
func (*UserTCPConn) PutBuffers ¶ added in v1.2.5
func (c *UserTCPConn) PutBuffers(bs [][]byte)
func (*UserTCPConn) Read ¶
func (c *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 (c *UserTCPConn) ReadFrom(r io.Reader) (written int64, err error)
专门适用于 裸奔splice的情况
func (*UserTCPConn) Upstream ¶ added in v1.2.5
func (c *UserTCPConn) Upstream() net.Conn
func (*UserTCPConn) WillReadBuffersBenifit ¶
func (c *UserTCPConn) WillReadBuffersBenifit() int
func (*UserTCPConn) WriteBuffers ¶
func (c *UserTCPConn) WriteBuffers(buffers [][]byte) (int64, error)
Click to show internal directories.
Click to hide internal directories.