Exemple #1
0
func boilup() {
	raknet.InitProtocol()
	ocr1 = raknet.GetHandler(0x05).Write(raknet.Fields{
		"protocol": uint8(raknet.RaknetProtocol),
		"mtuSize":  1464,
	}).Done()
	ocr2 = raknet.GetHandler(0x07).Write(raknet.Fields{
		"serverAddress": func() *net.UDPAddr {
			n, _ := net.ResolveUDPAddr("udp", os.Args[1])
			return n
		}(),
		"mtuSize":  uint16(1464),
		"clientID": uint64(483287947),
	}).Done()
	dp := &raknet.DataPacket{
		Head:      0x80,
		SeqNumber: 0,
		Packets: []*raknet.EncapsulatedPacket{
			&raknet.EncapsulatedPacket{
				Buffer: raknet.GetDataHandler(0x13).Write(raknet.Fields{
					"address": new(net.UDPAddr),
					"systemAddresses": func() []*net.UDPAddr {
						r := make([]*net.UDPAddr, 10)
						for i := 0; i < 10; i++ {
							r[i] = new(net.UDPAddr)
						}
						return r
					}(),
					"sendPing": uint64(324324),
					"sendPong": uint64(324325),
				}),
			},
		},
	}
	dp.Encode()
	handshake = dp.Done()
}
Exemple #2
0
func sendFromFields(pid byte, field raknet.Fields) {
	send(append([]byte{pid}, raknet.GetHandler(pid).Write(field).Done()[1:]...))
	return
}