mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
added socks simplified config
This commit is contained in:
parent
1876fbd6cd
commit
6b15c7f04f
33
proxy/socks/simplified/config.go
Normal file
33
proxy/socks/simplified/config.go
Normal 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)
|
||||||
|
}))
|
||||||
|
}
|
26
proxy/socks/simplified/config.proto
Normal file
26
proxy/socks/simplified/config.proto
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user