func (this *Server) Start() error { if this.accepting { return nil } tcpHub, err := internet.ListenTCP(this.meta.Address, this.meta.Port, this.handleConnection, this.meta.StreamSettings) if err != nil { log.Error("Shadowsocks: Failed to listen TCP on ", this.meta.Address, ":", this.meta.Port, ": ", err) return err } this.tcpHub = tcpHub if this.config.UdpEnabled { this.udpServer = udp.NewUDPServer(this.packetDispatcher) udpHub, err := udp.ListenUDP(this.meta.Address, this.meta.Port, udp.ListenOption{Callback: this.handlerUDPPayload}) if err != nil { log.Error("Shadowsocks: Failed to listen UDP on ", this.meta.Address, ":", this.meta.Port, ": ", err) return err } this.udpHub = udpHub } this.accepting = true return nil }
func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.PacketDispatcher) *UDPNameServer { s := &UDPNameServer{ address: address, requests: make(map[uint16]*PendingRequest), udpServer: udp.NewUDPServer(dispatcher), } return s }
func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.PacketDispatcher) *UDPNameServer { s := &UDPNameServer{ address: address, requests: make(map[uint16]*PendingRequest), udpServer: udp.NewUDPServer(&proxy.InboundHandlerMeta{ AllowPassiveConnection: false, }, dispatcher), } return s }
func (this *Server) listenUDP() error { this.udpServer = udp.NewUDPServer(this.meta, this.packetDispatcher) udpHub, err := udp.ListenUDP(this.meta.Address, this.meta.Port, udp.ListenOption{Callback: this.handleUDPPayload}) if err != nil { log.Error("Socks: Failed to listen on udp ", this.meta.Address, ":", this.meta.Port) return err } this.udpMutex.Lock() this.udpAddress = v2net.UDPDestination(this.config.Address, this.meta.Port) this.udpHub = udpHub this.udpMutex.Unlock() return nil }
func (v *Server) listenUDP() error { v.udpServer = udp.NewUDPServer(v.packetDispatcher) udpHub, err := udp.ListenUDP(v.meta.Address, v.meta.Port, udp.ListenOption{Callback: v.handleUDPPayload}) if err != nil { log.Error("Socks: Failed to listen on udp (", v.meta.Address, ":", v.meta.Port, "): ", err) return err } v.udpMutex.Lock() v.udpAddress = v2net.UDPDestination(v.config.GetNetAddress(), v.meta.Port) v.udpHub = udpHub v.udpMutex.Unlock() return nil }
func (this *DokodemoDoor) ListenUDP() error { this.udpServer = udp.NewUDPServer(this.meta, this.packetDispatcher) udpHub, err := udp.ListenUDP( this.meta.Address, this.meta.Port, udp.ListenOption{ Callback: this.handleUDPPackets, ReceiveOriginalDest: this.config.FollowRedirect, }) if err != nil { log.Error("Dokodemo failed to listen on ", this.meta.Address, ":", this.meta.Port, ": ", err) return err } this.udpMutex.Lock() this.udpHub = udpHub this.udpMutex.Unlock() return nil }
func (v *DokodemoDoor) ListenUDP() error { v.udpServer = udp.NewUDPServer(v.packetDispatcher) udpHub, err := udp.ListenUDP( v.meta.Address, v.meta.Port, udp.ListenOption{ Callback: v.handleUDPPackets, ReceiveOriginalDest: v.config.FollowRedirect, Concurrency: 2, }) if err != nil { log.Error("Dokodemo failed to listen on ", v.meta.Address, ":", v.meta.Port, ": ", err) return err } v.udpMutex.Lock() v.udpHub = udpHub v.udpMutex.Unlock() return nil }