(packet *highway.ReqDataHighwayHead, block []byte, serverURL string, end bool)
| 138 | } |
| 139 | |
| 140 | func sendHighwayPacket(packet *highway.ReqDataHighwayHead, block []byte, serverURL string, end bool) (io.ReadCloser, error) { |
| 141 | marshal, err := proto.Marshal(packet) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | buf := hw.Frame(marshal, block) |
| 146 | data, err := io.ReadAll(&buf) |
| 147 | if err != nil { |
| 148 | return nil, err |
| 149 | } |
| 150 | return postHighwayContent(bytes.NewReader(data), serverURL, end) |
| 151 | /* |
| 152 | return postHighwayContent( |
| 153 | binary.NewBuilder(nil). |
| 154 | WriteBytes([]byte{0x28}). |
| 155 | WriteU32(uint32(len(marshal))). |
| 156 | WriteU32(uint32(len(block))). |
| 157 | WriteBytes(marshal). |
| 158 | WriteBytes(block). |
| 159 | WriteBytes([]byte{0x29}).ToReader(), serverURL, end) |
| 160 | */ |
| 161 | } |
| 162 | |
| 163 | func postHighwayContent(content io.Reader, serverURL string, end bool) (io.ReadCloser, error) { |
| 164 | // Parse server URL |
no test coverage detected