Subscribe now

To access premium content

  • Free 15 Day Trial
  • Monthly or Yearly Memberships
  • Professional Rated Guides
Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

GitHub – noboruma/go-msquic

Published on:

go-msquic is a Go wrapper for the Microsoft’s QUIC library, providing Go developers with an easy interface to work with QUIC-based protocols such as HTTP/3.
go-msquic API is inspired from quic-go and can be used as a drop-in replacement. Unless you are ready to deal with C libraries, we do actually recommend quic-go over go-msquic.

Before all, it is necessary to have a local MsQuic C library build.
go-msquic relies on CGO and needs both C headers & the library (shared or static, see below).

git clone https://github.com/microsoft/msquic
cd msquic
git submodule update --init --recursive
  • For a static build (libmsquic.a), do the following:
mkdir build-static
cd build-static
cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel -DQUIC_BUILD_SHARED=OFF
  • Alternatively, for a dynamic build (libmsquic.so), do the following:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel
  • Then proceed with the compilation

Set the right package-config

Package-config is the tool used by CGO to find the headers & library automatically.

You can find package-config (.pc) file in this repository. Copy the following pcs/msquic-static.pc (for a static build) or pcs/msquic.pc (for a dynamic build) into /usr/share/pkgconfig/msquic.pc – or anywhere accessible by pkg-config tool.

To install go-msquic, ensure you have Go installed on your system. Then run the following command to install the package:

go get github.com/noboruma/go-msquic

And use in code via:

import "github.com/noboruma/go-msquic/pkg/quic"

If the prerequisites are done properly, you can now compile your Go project relying on go-msquic with CGO_ENABLED=1 and start using msquic.

There is a client & server code in the sample/ directory.

MIT License

Source link

Related