Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andelf/go-curl
golang curl(libcurl) binding.
https://github.com/andelf/go-curl
Last synced: about 2 months ago
JSON representation
golang curl(libcurl) binding.
- Host: GitHub
- URL: https://github.com/andelf/go-curl
- Owner: andelf
- License: apache-2.0
- Created: 2011-10-08T01:50:05.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T04:39:55.000Z (2 months ago)
- Last Synced: 2024-07-24T04:32:47.621Z (2 months ago)
- Language: Go
- Homepage:
- Size: 180 KB
- Stars: 480
- Watchers: 24
- Forks: 131
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-curl
=======[![Build Status](https://secure.travis-ci.org/andelf/go-curl.png?branch=master)](http://travis-ci.org/andelf/go-curl)
go-curl is a GoLang interface to [libcurl](https://curl.haxx.se/libcurl/),
the multiprotocol file transfer library. Similar to the HTTP
support in [net/http] (https://pkg.go.dev/net/http), go-curl can be used to
fetch objects from a Go program. While go-curl can provide simple fetches,
it also exposes most of the functionality of libcurl, including:* Speed - libcurl is very fast.
* Multiple protocol (not just HTTP).
* SSL, authentication and proxy support.
* Support for libcurl's callbacks.This said, libcurl API can be less easy to learn than net/http.
LICENSE
-------go-curl is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).
Current Development Status
--------------------------* currently stable
* READ, WRITE, HEADER, PROGRESS function callback
* a Multipart Form supports file uploading
* Most curl_easy_setopt option
* partly implement share & multi interface
* new callback function prototypeRequirements
------------
* Any version of Go
* libcurl 7.x or higher (including development headers and static/dynamic libs)
* Python 3 (used only by configure scripts)How to Install
--------------$ go get -u github.com/andelf/go-curl
Current Status
--------------* Linux x64
* passed go1 (ArchLinux)
* Windows x86
* passed go1 (win7, mingw-gcc 4.5.2, curl 7.22.0)
* Mac OS
* passed go1 (Mac OS X 10.7.3, curl 7.21.4)Sample Program
--------------```go
package mainimport (
"fmt"
curl "github.com/andelf/go-curl"
)func main() {
easy := curl.EasyInit()
defer easy.Cleanup()easy.Setopt(curl.OPT_URL, "https://www.baidu.com/")
// OPTIONAL - make a callback function
fooTest := func (buf []byte, userdata interface{}) bool {
println("DEBUG: size=>", len(buf))
println("DEBUG: content=>", string(buf))
return true
}easy.Setopt(curl.OPT_WRITEFUNCTION, fooTest)
if err := easy.Perform(); err != nil {
fmt.Printf("ERROR: %v\n", err)
}
}
```See also the [examples](./examples/) directory!