1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-13 22:44:02 -04:00

added socks simplified config

This commit is contained in:
Shelikhoo 2021-09-04 21:16:01 +01:00
parent 1876fbd6cd
commit 6b15c7f04f
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package simplified
import (
"context"
"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/protocol"
"github.com/v2fly/v2ray-core/v4/proxy/socks"
)
func init() {
common.Must(common.RegisterConfig((*ServerConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
simplifiedServer := config.(*ServerConfig)
fullServer := &socks.ServerConfig{
AuthType: socks.AuthType_NO_AUTH,
Address: simplifiedServer.Address,
UdpEnabled: simplifiedServer.UdpEnabled,
}
return socks.NewServer(ctx, fullServer)
}))
common.Must(common.RegisterConfig((*ClientConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
simplifiedClient := config.(*ClientConfig)
fullClient := &socks.ClientConfig{
Server: []*protocol.ServerEndpoint{
{
Address: simplifiedClient.Address,
Port: simplifiedClient.Port,
},
},
}
return socks.NewClient(ctx, fullClient)
}))
}

View File

@ -0,0 +1,26 @@
syntax = "proto3";
package v2ray.core.proxy.socks.simplified;
option csharp_namespace = "V2Ray.Core.Proxy.Socks.Simplified";
option go_package = "github.com/v2fly/v2ray-core/v4/proxy/socks/simplified";
option java_package = "com.v2ray.core.proxy.socks.simplified";
option java_multiple_files = true;
import "common/protoext/extensions.proto";
import "common/net/address.proto";
message ServerConfig{
option (v2ray.core.common.protoext.message_opt).type = "inbound";
option (v2ray.core.common.protoext.message_opt).short_name = "socks";
v2ray.core.common.net.IPOrDomain address = 3;
bool udp_enabled = 4;
}
message ClientConfig {
option (v2ray.core.common.protoext.message_opt).type = "outbound";
option (v2ray.core.common.protoext.message_opt).short_name = "socks";
v2ray.core.common.net.IPOrDomain address = 1;
uint32 port = 2;
}