mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-14 08:15:55 -05:00
Style: refine code style
This commit is contained in:
parent
01a2686568
commit
147641e981
@ -292,23 +292,20 @@ type PacketSplitReader struct {
|
||||
Payload *PacketPayload
|
||||
}
|
||||
|
||||
func (r *PacketSplitReader) ReadFrom(p []byte) (int, gonet.Addr, error) {
|
||||
var err error
|
||||
|
||||
func (r *PacketSplitReader) ReadFrom(p []byte) (n int, addr gonet.Addr, err error) {
|
||||
if r.Payload == nil || r.Payload.Buffer.IsEmpty() {
|
||||
r.Payload, err = r.Reader.ReadMultiBufferWithMetadata()
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
addr := &gonet.UDPAddr{
|
||||
addr = &gonet.UDPAddr{
|
||||
IP: r.Payload.Target.Address.IP(),
|
||||
Port: int(r.Payload.Target.Port),
|
||||
}
|
||||
|
||||
mb, nBytes := buf.SplitBytes(r.Payload.Buffer, p)
|
||||
r.Payload.Buffer = mb
|
||||
r.Payload.Buffer, n = buf.SplitBytes(r.Payload.Buffer, p)
|
||||
|
||||
return nBytes, addr, nil
|
||||
return
|
||||
}
|
||||
|
@ -210,7 +210,6 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade
|
||||
udpDispatcherConstructor := udp.NewSplitDispatcher
|
||||
switch s.packetEncoding {
|
||||
case packetaddr.PacketAddrType_None:
|
||||
break
|
||||
case packetaddr.PacketAddrType_Packet:
|
||||
packetAddrDispatcherFactory := udp.NewPacketAddrDispatcherCreator(ctx)
|
||||
udpDispatcherConstructor = packetAddrDispatcherFactory.NewPacketAddrDispatcher
|
||||
|
Loading…
Reference in New Issue
Block a user