|  | @@ -29,7 +29,7 @@ type Server struct {
 | 
											
												
													
														|  |  	udpMutex         sync.RWMutex
 |  |  	udpMutex         sync.RWMutex
 | 
											
												
													
														|  |  	accepting        bool
 |  |  	accepting        bool
 | 
											
												
													
														|  |  	packetDispatcher dispatcher.PacketDispatcher
 |  |  	packetDispatcher dispatcher.PacketDispatcher
 | 
											
												
													
														|  | -	config           *Config
 |  | 
 | 
											
												
													
														|  | 
 |  | +	config           *ServerConfig
 | 
											
												
													
														|  |  	tcpListener      *internet.TCPHub
 |  |  	tcpListener      *internet.TCPHub
 | 
											
												
													
														|  |  	udpHub           *udp.UDPHub
 |  |  	udpHub           *udp.UDPHub
 | 
											
												
													
														|  |  	udpAddress       v2net.Destination
 |  |  	udpAddress       v2net.Destination
 | 
											
										
											
												
													
														|  | @@ -38,7 +38,7 @@ type Server struct {
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  // NewServer creates a new Server object.
 |  |  // NewServer creates a new Server object.
 | 
											
												
													
														|  | -func NewServer(config *Config, space app.Space, meta *proxy.InboundHandlerMeta) *Server {
 |  | 
 | 
											
												
													
														|  | 
 |  | +func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandlerMeta) *Server {
 | 
											
												
													
														|  |  	s := &Server{
 |  |  	s := &Server{
 | 
											
												
													
														|  |  		config: config,
 |  |  		config: config,
 | 
											
												
													
														|  |  		meta:   meta,
 |  |  		meta:   meta,
 | 
											
										
											
												
													
														|  | @@ -95,7 +95,7 @@ func (this *Server) Start() error {
 | 
											
												
													
														|  |  	this.tcpMutex.Lock()
 |  |  	this.tcpMutex.Lock()
 | 
											
												
													
														|  |  	this.tcpListener = listener
 |  |  	this.tcpListener = listener
 | 
											
												
													
														|  |  	this.tcpMutex.Unlock()
 |  |  	this.tcpMutex.Unlock()
 | 
											
												
													
														|  | -	if this.config.UDPEnabled {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if this.config.UdpEnabled {
 | 
											
												
													
														|  |  		this.listenUDP()
 |  |  		this.listenUDP()
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  	return nil
 |  |  	return nil
 | 
											
										
											
												
													
														|  | @@ -129,7 +129,7 @@ func (this *Server) handleConnection(connection internet.Connection) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func (this *Server) handleSocks5(clientAddr v2net.Destination, reader *v2io.BufferedReader, writer *v2io.BufferedWriter, auth protocol.Socks5AuthenticationRequest) error {
 |  |  func (this *Server) handleSocks5(clientAddr v2net.Destination, reader *v2io.BufferedReader, writer *v2io.BufferedWriter, auth protocol.Socks5AuthenticationRequest) error {
 | 
											
												
													
														|  |  	expectedAuthMethod := protocol.AuthNotRequired
 |  |  	expectedAuthMethod := protocol.AuthNotRequired
 | 
											
												
													
														|  | -	if this.config.AuthType == AuthTypePassword {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if this.config.AuthType == ServerConfig_PASSWORD {
 | 
											
												
													
														|  |  		expectedAuthMethod = protocol.AuthUserPass
 |  |  		expectedAuthMethod = protocol.AuthUserPass
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -152,7 +152,7 @@ func (this *Server) handleSocks5(clientAddr v2net.Destination, reader *v2io.Buff
 | 
											
												
													
														|  |  		log.Error("Socks: failed to write authentication: ", err)
 |  |  		log.Error("Socks: failed to write authentication: ", err)
 | 
											
												
													
														|  |  		return err
 |  |  		return err
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | -	if this.config.AuthType == AuthTypePassword {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if this.config.AuthType == ServerConfig_PASSWORD {
 | 
											
												
													
														|  |  		upRequest, err := protocol.ReadUserPassRequest(reader)
 |  |  		upRequest, err := protocol.ReadUserPassRequest(reader)
 | 
											
												
													
														|  |  		if err != nil {
 |  |  		if err != nil {
 | 
											
												
													
														|  |  			log.Warning("Socks: failed to read username and password: ", err)
 |  |  			log.Warning("Socks: failed to read username and password: ", err)
 | 
											
										
											
												
													
														|  | @@ -182,7 +182,7 @@ func (this *Server) handleSocks5(clientAddr v2net.Destination, reader *v2io.Buff
 | 
											
												
													
														|  |  		return err
 |  |  		return err
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -	if request.Command == protocol.CmdUdpAssociate && this.config.UDPEnabled {
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if request.Command == protocol.CmdUdpAssociate && this.config.UdpEnabled {
 | 
											
												
													
														|  |  		return this.handleUDP(reader, writer)
 |  |  		return this.handleUDP(reader, writer)
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -320,7 +320,7 @@ func (this *ServerFactory) StreamCapability() internet.StreamConnectionType {
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func (this *ServerFactory) Create(space app.Space, rawConfig interface{}, meta *proxy.InboundHandlerMeta) (proxy.InboundHandler, error) {
 |  |  func (this *ServerFactory) Create(space app.Space, rawConfig interface{}, meta *proxy.InboundHandlerMeta) (proxy.InboundHandler, error) {
 | 
											
												
													
														|  | -	return NewServer(rawConfig.(*Config), space, meta), nil
 |  | 
 | 
											
												
													
														|  | 
 |  | +	return NewServer(rawConfig.(*ServerConfig), space, meta), nil
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func init() {
 |  |  func init() {
 |