Giter VIP home page Giter VIP logo

tinynet's Introduction

tinynet

A net implementation for Go and TinyGo based on unisockets, targeting both WebAssembly and native platforms.

make CI Mirror PkgGoDev Part of webnetes

Overview

tinynet implements a subnet of the Go net package. Because it is based on unisockets, it supports more platforms (WASM/JS, WASM/WASI, TinyGo, Go etc.) than the official net package.

Usage

Check out PkgGoDev for API documentation. Many examples on how to use it (clients, servers and an example distributed system) can also be found in the cmd package. Additionally, the Makefile might also be of interest; it shows how to build native and WASM binaries.

You want a Kubernetes-style system for WASM, running in the browser and in node? You might be interested in webnetes, which supports the unisockets-based networking used by tinynet.

License

tinynet (c) 2021 Felicitas Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

tinynet's People

Contributors

jakwai01 avatar pojntfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tinynet's Issues

failure with unisockets

I am trying to use tinynet in coraza with cgo and I am facing the following issue:

# github.com/alphahorizonio/unisockets/pkg/unisockets
../../../../../../../../../opt/homebrew/Cellar/tinygo/0.22.0/lib/wasi-libc/sysroot/include/__header_sys_socket.h:12:35: unexpected token ILLEGAL, expected end of expression

The pointed out file is

#ifndef __wasilibc___header_sys_socket_h
#define __wasilibc___header_sys_socket_h

#include <__struct_msghdr.h>
#include <__struct_sockaddr.h>
#include <__struct_sockaddr_storage.h>

#include <wasi/api.h>

#define SHUT_RD __WASI_SDFLAGS_RD
#define SHUT_WR __WASI_SDFLAGS_WR
#define SHUT_RDWR (SHUT_RD | SHUT_WR)

#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
#define MSG_TRUNC __WASI_RIFLAGS_RECV_DATA_TRUNCATED

#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM

#define SOCK_NONBLOCK (0x00004000)
#define SOCK_CLOEXEC (0x00002000)

#define SOL_SOCKET 0x7fffffff

#define SO_TYPE 3

#define AF_UNSPEC 0
#define AF_INET 1
#define AF_INET6 2
#define AF_UNIX 3

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

#endif

I wonder what version of tinygo is targeted in this repo.

unexpected token ILLEGAL

Makefile:
test: build-tcp-client-wasm-wasi-tinygo

../usr/local/tinygo/lib/wasi-libc/sysroot/include/__header_sys_socket.h:12:28: unexpected token ILLEGAL
make: *** [build-tcp-client-wasm-wasi-tinygo] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.