Browse Source

add wireguard fake header

pull/1269/head
Darien Raymond 6 years ago
parent
commit
02ae48095b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 1
      main/distro/all/all.go
  2. 69
      transport/internet/headers/wireguard/config.pb.go
  3. 10
      transport/internet/headers/wireguard/config.proto
  4. 28
      transport/internet/headers/wireguard/wireguard.go

1
main/distro/all/all.go

@ -48,6 +48,7 @@ import (
_ "v2ray.com/core/transport/internet/headers/tls"
_ "v2ray.com/core/transport/internet/headers/utp"
_ "v2ray.com/core/transport/internet/headers/wechat"
_ "v2ray.com/core/transport/internet/headers/wireguard"
// JSON config support. Choose only one from the two below.
// The following line loads JSON from v2ctl

69
transport/internet/headers/wireguard/config.pb.go

@ -0,0 +1,69 @@
package wireguard
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type WireguardConfig struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WireguardConfig) Reset() { *m = WireguardConfig{} }
func (m *WireguardConfig) String() string { return proto.CompactTextString(m) }
func (*WireguardConfig) ProtoMessage() {}
func (*WireguardConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_20d981d9a887b445, []int{0}
}
func (m *WireguardConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WireguardConfig.Unmarshal(m, b)
}
func (m *WireguardConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WireguardConfig.Marshal(b, m, deterministic)
}
func (dst *WireguardConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_WireguardConfig.Merge(dst, src)
}
func (m *WireguardConfig) XXX_Size() int {
return xxx_messageInfo_WireguardConfig.Size(m)
}
func (m *WireguardConfig) XXX_DiscardUnknown() {
xxx_messageInfo_WireguardConfig.DiscardUnknown(m)
}
var xxx_messageInfo_WireguardConfig proto.InternalMessageInfo
func init() {
proto.RegisterType((*WireguardConfig)(nil), "v2ray.core.transport.internet.headers.wireguard.WireguardConfig")
}
func init() {
proto.RegisterFile("v2ray.com/core/transport/internet/headers/wireguard/config.proto", fileDescriptor_config_20d981d9a887b445)
}
var fileDescriptor_config_20d981d9a887b445 = []byte{
// 163 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x28, 0x33, 0x2a, 0x4a,
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x29, 0x4a, 0xcc, 0x2b,
0x2e, 0xc8, 0x2f, 0x2a, 0xd1, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0x2d, 0xd1, 0xcf, 0x48,
0x4d, 0x4c, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0xcf, 0x2c, 0x4a, 0x4d, 0x2f, 0x4d, 0x2c, 0x4a, 0xd1,
0x4f, 0xce, 0xcf, 0x4b, 0xcb, 0x4c, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x87, 0x99,
0x50, 0x94, 0xaa, 0x07, 0xd7, 0xad, 0x07, 0xd3, 0xad, 0x07, 0xd5, 0xad, 0x07, 0xd7, 0xad, 0x24,
0xc8, 0xc5, 0x1f, 0x0e, 0xe3, 0x38, 0x83, 0x4d, 0x72, 0x2a, 0xe1, 0x32, 0x4e, 0xce, 0xcf, 0xd5,
0x23, 0xd1, 0xa4, 0x00, 0xc6, 0x28, 0x4e, 0x38, 0x67, 0x15, 0x93, 0x7e, 0x98, 0x51, 0x50, 0x62,
0xa5, 0x9e, 0x33, 0x48, 0x7b, 0x08, 0x5c, 0xbb, 0x27, 0x4c, 0xbb, 0x07, 0x54, 0x3b, 0xdc, 0xee,
0x24, 0x36, 0xb0, 0x07, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x6d, 0x59, 0xf8, 0x04,
0x01, 0x00, 0x00,
}

10
transport/internet/headers/wireguard/config.proto

@ -0,0 +1,10 @@
syntax = "proto3";
package v2ray.core.transport.internet.headers.wireguard;
option csharp_namespace = "V2Ray.Core.Transport.Internet.Headers.Wireguard";
option go_package = "wireguard";
option java_package = "com.v2ray.core.transport.internet.headers.wireguard";
option java_multiple_files = true;
message WireguardConfig {
}

28
transport/internet/headers/wireguard/wireguard.go

@ -0,0 +1,28 @@
package wireguard
import (
"context"
"v2ray.com/core/common"
)
type Wireguard struct{}
func (Wireguard) Size() int32 {
return 4
}
// Write implements io.Writer.
func (Wireguard) Write(b []byte) (int, error) {
b = append(b[:0], 0x04, 0x00, 0x00, 0x00)
return 4, nil
}
// NewWireguard returns a new VideoChat instance based on given config.
func NewWireguard(ctx context.Context, config interface{}) (interface{}, error) {
return Wireguard{}, nil
}
func init() {
common.Must(common.RegisterConfig((*WireguardConfig)(nil), NewWireguard))
}
Loading…
Cancel
Save