mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-01 16:18:24 +00:00
comments
This commit is contained in:
@@ -9,16 +9,21 @@ option java_multiple_files = true;
|
||||
import "v2ray.com/core/common/net/address.proto";
|
||||
import "v2ray.com/core/common/protocol/server_spec.proto";
|
||||
|
||||
// Account represents a Socks account.
|
||||
message Account {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
// AuthType is the authentication type of Socks proxy.
|
||||
enum AuthType {
|
||||
// NO_AUTH is for anounymous authentication.
|
||||
NO_AUTH = 0;
|
||||
// PASSWORD is for username/password authentication.
|
||||
PASSWORD = 1;
|
||||
}
|
||||
|
||||
// ServerConfig is the protobuf config for Socks server.
|
||||
message ServerConfig {
|
||||
AuthType auth_type = 1;
|
||||
map<string, string> accounts = 2;
|
||||
@@ -28,6 +33,8 @@ message ServerConfig {
|
||||
uint32 user_level = 6;
|
||||
}
|
||||
|
||||
// ClientConfig is the protobuf config for Socks client.
|
||||
message ClientConfig {
|
||||
// Sever is a list of Socks server addresses.
|
||||
repeated v2ray.core.common.protocol.ServerEndpoint server = 1;
|
||||
}
|
||||
|
||||
@@ -24,22 +24,23 @@ import (
|
||||
|
||||
// Server is a SOCKS 5 proxy server
|
||||
type Server struct {
|
||||
config *ServerConfig
|
||||
v *core.Instance
|
||||
config *ServerConfig
|
||||
policyManager policy.Manager
|
||||
}
|
||||
|
||||
// NewServer creates a new Server object.
|
||||
func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
|
||||
v := core.MustFromContext(ctx)
|
||||
s := &Server{
|
||||
config: config,
|
||||
v: core.MustFromContext(ctx),
|
||||
config: config,
|
||||
policyManager: v.PolicyManager(),
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (s *Server) policy() policy.Session {
|
||||
config := s.config
|
||||
p := s.v.PolicyManager().ForLevel(config.UserLevel)
|
||||
p := s.policyManager.ForLevel(config.UserLevel)
|
||||
if config.Timeout > 0 {
|
||||
features.PrintDeprecatedFeatureWarning("Socks timeout")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user