You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/transport/internet/header.go

27 lines
461 B

package internet
import (
"context"
"errors"
"v2ray.com/core/common"
)
type PacketHeader interface {
Size() int
Write([]byte) (int, error)
}
func CreatePacketHeader(config interface{}) (PacketHeader, error) {
header, err := common.CreateObject(context.Background(), config)
if err != nil {
return nil, err
}
switch h := header.(type) {
case PacketHeader:
return h, nil
default:
return nil, errors.New("Internet: Not a packet header.")
}
}