mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 10:00:34 +00:00
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package xdrive
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/xtls/xray-core/common"
|
|
"github.com/xtls/xray-core/common/net"
|
|
"github.com/xtls/xray-core/transport/internet"
|
|
"github.com/xtls/xray-core/transport/internet/stat"
|
|
)
|
|
|
|
const protocolName = "xdrive"
|
|
|
|
func init() {
|
|
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
|
return new(Config)
|
|
}))
|
|
common.Must(internet.RegisterTransportDialer(protocolName, Dial))
|
|
common.Must(internet.RegisterTransportListener(protocolName, Serve))
|
|
}
|
|
|
|
func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error) {
|
|
//config := streamSettings.ProtocolSettings.(*Config)
|
|
|
|
var conn net.Conn
|
|
return stat.Connection(conn), nil
|
|
}
|
|
|
|
type Server struct {
|
|
config *Config
|
|
}
|
|
|
|
func (s *Server) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (s *Server) Addr() net.Addr {
|
|
return nil
|
|
}
|
|
|
|
func Serve(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, addConn internet.ConnHandler) (internet.Listener, error) {
|
|
var server Server
|
|
|
|
return &server, nil
|
|
}
|