mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-13 14:44:15 +00:00
init
This commit is contained in:
commit
4c03bf0d45
10 files changed
+338
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package io
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
_ "fmt"
|
||||
"github.com/v2ray/v2ray-core"
|
||||
)
|
||||
|
||||
type JsonVUser struct {
|
||||
id string `json:"id"`
|
||||
email string `json:"email"`
|
||||
}
|
||||
|
||||
type JsonVConfig struct {
|
||||
RunAs string `json:"runas"`
|
||||
Port uint8 `json:"port"`
|
||||
Clients []JsonVUser `json:"users"`
|
||||
Protocol string `json:"protocol"`
|
||||
}
|
||||
|
||||
type JsonVConfigUnmarshaller struct {
|
||||
|
||||
}
|
||||
|
||||
func StringToVUser(id string) (u core.VUser, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (*JsonVConfigUnmarshaller) Unmarshall(data []byte) (*core.VConfig, error) {
|
||||
var jsonConfig JsonVConfig
|
||||
err := json.Unmarshal(data, &jsonConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var vconfig = new(core.VConfig)
|
||||
vconfig.RunAs = core.VUser{}
|
||||
return vconfig, nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
type VMessInput struct {
|
||||
version byte
|
||||
userHash [16]byte
|
||||
randHash [256]byte
|
||||
respKey [32]byte
|
||||
iv [16]byte
|
||||
command byte
|
||||
port uint16
|
||||
target [256]byte
|
||||
data []byte
|
||||
}
|
||||
|
||||
type VMessReader struct {
|
||||
conn *net.Conn
|
||||
}
|
||||
|
||||
func NewVMessReader(conn *net.Conn) (VMessReader, error) {
|
||||
var reader VMessReader
|
||||
reader.conn = conn
|
||||
return reader, nil
|
||||
}
|
||||
|
||||
func (*VMessReader) Read() (VMessInput, error) {
|
||||
var input VMessInput
|
||||
return input, nil
|
||||
}
|
||||
Reference in new issue
Block a user