1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-11 05:30:57 -04:00
v2fly/transport/internet/headers/noop/noop.go

41 lines
770 B
Go
Raw Normal View History

2016-12-08 10:27:41 -05:00
package noop
import (
2017-01-12 16:47:10 -05:00
"context"
2016-12-08 10:27:41 -05:00
"net"
"github.com/v2fly/v2ray-core/v5/common"
2016-12-08 10:27:41 -05:00
)
type Header struct{}
2016-12-08 10:27:41 -05:00
func (Header) Size() int32 {
2016-12-08 10:27:41 -05:00
return 0
}
2017-04-21 09:36:05 -04:00
2018-11-02 16:34:04 -04:00
// Serialize implements PacketHeader.
func (Header) Serialize([]byte) {}
2016-12-08 10:27:41 -05:00
func NewHeader(context.Context, interface{}) (interface{}, error) {
return Header{}, nil
2016-12-08 10:27:41 -05:00
}
type ConnectionHeader struct{}
2016-12-08 10:27:41 -05:00
func (ConnectionHeader) Client(conn net.Conn) net.Conn {
2016-12-08 10:27:41 -05:00
return conn
}
func (ConnectionHeader) Server(conn net.Conn) net.Conn {
2016-12-08 10:27:41 -05:00
return conn
}
func NewConnectionHeader(context.Context, interface{}) (interface{}, error) {
return ConnectionHeader{}, nil
2016-12-08 10:27:41 -05:00
}
func init() {
common.Must(common.RegisterConfig((*Config)(nil), NewHeader))
common.Must(common.RegisterConfig((*ConnectionConfig)(nil), NewConnectionHeader))
2016-12-08 10:27:41 -05:00
}