github.com/v2fly/v2ray-core/v4@v4.45.2/transport/internet/headers/noop/noop.go (about) 1 package noop 2 3 import ( 4 "context" 5 "net" 6 7 "github.com/v2fly/v2ray-core/v4/common" 8 ) 9 10 type Header struct{} 11 12 func (Header) Size() int32 { 13 return 0 14 } 15 16 // Serialize implements PacketHeader. 17 func (Header) Serialize([]byte) {} 18 19 func NewHeader(context.Context, interface{}) (interface{}, error) { 20 return Header{}, nil 21 } 22 23 type ConnectionHeader struct{} 24 25 func (ConnectionHeader) Client(conn net.Conn) net.Conn { 26 return conn 27 } 28 29 func (ConnectionHeader) Server(conn net.Conn) net.Conn { 30 return conn 31 } 32 33 func NewConnectionHeader(context.Context, interface{}) (interface{}, error) { 34 return ConnectionHeader{}, nil 35 } 36 37 func init() { 38 common.Must(common.RegisterConfig((*Config)(nil), NewHeader)) 39 common.Must(common.RegisterConfig((*ConnectionConfig)(nil), NewConnectionHeader)) 40 }