https://github.com/sago35/netdriver-for-go
communicate from Go using `tinygo.org/x/drivers/net`
https://github.com/sago35/netdriver-for-go
golang tinygo
Last synced: 8 months ago
JSON representation
communicate from Go using `tinygo.org/x/drivers/net`
- Host: GitHub
- URL: https://github.com/sago35/netdriver-for-go
- Owner: sago35
- License: mit
- Created: 2022-12-24T03:18:45.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-27T11:36:53.000Z (about 3 years ago)
- Last Synced: 2025-04-02T14:18:22.739Z (11 months ago)
- Topics: golang, tinygo
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# netdriver-for-go
This package was created to communicate from Go using `tinygo.org/x/drivers/net`.
## how to use
```go
package main
import (
"fmt"
"io"
"log"
"github.com/sago35/netdriver-for-go"
"tinygo.org/x/drivers/net"
"tinygo.org/x/drivers/net/http"
)
func main() {
err := run()
if err != nil {
log.Fatal(err)
}
}
func run() error {
var buf [1024 * 10]byte
net.UseDriver(&netdriver.Driver{
MaxPacketSize: 4096,
Debug: false,
})
http.SetBuf(buf[:])
res, err := http.Get("http://tinygo.org")
if err != nil {
return err
}
defer res.Body.Close()
b, err := io.ReadAll(res.Body)
if err != nil {
return err
}
fmt.Printf("%q\n", string(b))
return nil
}
```
## LICENSE
MIT
## Author
sago35 -