Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,31 @@
return config, nil
}

type XDriveConfig struct {
RemoteFolder string `json:"remoteFolder"`
Service string `json:"service"`
Secrets []string `json:"secrets"`
}

// Build implements Buildable.
func (c *XDriveConfig) Build() (proto.Message, error) {
switch c.Service {
case "local":
case "Google Drive":
if len(c.Secrets) != 3 {
return nil, errors.New("Google Drive needs 3 secrets in order of ClientID, ClientSecret, RefreshToken")
}
default:
return nil, errors.New("unsupported service")
}
config := &xdrive.Config{

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, 386, win7-32)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64, win7-64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, loong64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (darwin, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips64le)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (darwin, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mipsle)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, 386, win7-32)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 5)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 6)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, ppc64le)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64, win7-64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, ppc64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (android, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 6)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, s390x)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips64le)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, riscv64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, 386)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mips)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (android, amd64, android-amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (android, amd64, android-amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, mipsle)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (darwin, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 5)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, s390x)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (windows, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (openbsd, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, arm, 7)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, riscv64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, ppc64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (android, arm64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, loong64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (linux, ppc64le)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (freebsd, amd64)

undefined: xdrive

Check failure on line 472 in infra/conf/transport_internet.go

View workflow job for this annotation

GitHub Actions / build (darwin, amd64)

undefined: xdrive
RemoteFolder: c.RemoteFolder,
Service: c.Service,
Secrets: c.Secrets,
}
return config, nil
}

const (
Byte = 1
Kilobyte = 1024 * Byte
Expand Down
1 change: 1 addition & 0 deletions main/distro/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
_ "github.com/xtls/xray-core/transport/internet/tls"
_ "github.com/xtls/xray-core/transport/internet/udp"
_ "github.com/xtls/xray-core/transport/internet/websocket"
_ "github.com/xtls/xray-core/transport/internet/xdrive"

// Transport headers
_ "github.com/xtls/xray-core/transport/internet/headers/http"
Expand Down
140 changes: 140 additions & 0 deletions transport/internet/xdrive/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions transport/internet/xdrive/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package xray.transport.internet.xdrive;
option go_package = "github.com/xtls/xray-core/transport/internet/xdrive";

message Config {
string remote_folder = 1;
string service = 2;
repeated string secrets = 3;
}
45 changes: 45 additions & 0 deletions transport/internet/xdrive/xdrive.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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
}
Loading