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