mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-25 10:48:44 +00:00
proxy: introduce a proxy options struct
It is currently unused; it will go into the remote's options.
This commit is contained in:
parent
029c93464f
commit
a7bece2014
@ -40,6 +40,7 @@
|
|||||||
#include "git2/pack.h"
|
#include "git2/pack.h"
|
||||||
#include "git2/patch.h"
|
#include "git2/patch.h"
|
||||||
#include "git2/pathspec.h"
|
#include "git2/pathspec.h"
|
||||||
|
#include "git2/proxy.h"
|
||||||
#include "git2/rebase.h"
|
#include "git2/rebase.h"
|
||||||
#include "git2/refdb.h"
|
#include "git2/refdb.h"
|
||||||
#include "git2/reflog.h"
|
#include "git2/reflog.h"
|
||||||
|
91
include/git2/proxy.h
Normal file
91
include/git2/proxy.h
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||||
|
* a Linking Exception. For full terms see the included COPYING file.
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDE_git_proxy_h__
|
||||||
|
#define INCLUDE_git_proxy_h__
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "transport.h"
|
||||||
|
|
||||||
|
GIT_BEGIN_DECL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of proxy to use.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
/**
|
||||||
|
* Do not attempt to connect through a proxy
|
||||||
|
*/
|
||||||
|
GIT_PROXY_NONE,
|
||||||
|
/**
|
||||||
|
* Try to auto-detect the proxy from the git configuration.
|
||||||
|
*/
|
||||||
|
GIT_PROXY_AUTO,
|
||||||
|
/**
|
||||||
|
* Connect through a HTTP proxy
|
||||||
|
*/
|
||||||
|
GIT_PROXY_HTTP,
|
||||||
|
/**
|
||||||
|
* Connect through a SOCKS v4 proxy
|
||||||
|
*/
|
||||||
|
GIT_PROXY_SOCKS4,
|
||||||
|
/**
|
||||||
|
* Connect through a SOCKS v5 proxy
|
||||||
|
*/
|
||||||
|
GIT_PROXY_SOCKS5,
|
||||||
|
} git_proxy_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for connecting through a proxy
|
||||||
|
*
|
||||||
|
* Note that not all types may be supported, depending on the platform
|
||||||
|
* and compilation options.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned int version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of proxy to use, by URL, auto-detect.
|
||||||
|
*/
|
||||||
|
git_proxy_t type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL of the proxy.
|
||||||
|
*/
|
||||||
|
const char *url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This will be called if the remote host requires
|
||||||
|
* authentication in order to connect to it.
|
||||||
|
*
|
||||||
|
* Returning GIT_PASSTHROUGH will make libgit2 behave as
|
||||||
|
* though this field isn't set.
|
||||||
|
*/
|
||||||
|
git_cred_acquire_cb credentials;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If cert verification fails, this will be called to let the
|
||||||
|
* user make the final decision of whether to allow the
|
||||||
|
* connection to proceed. Returns 1 to allow the connection, 0
|
||||||
|
* to disallow it or a negative value to indicate an error.
|
||||||
|
*/
|
||||||
|
git_transport_certificate_check_cb certificate_check;
|
||||||
|
} git_proxy_options;
|
||||||
|
|
||||||
|
#define GIT_PROXY_OPTIONS_VERSION 1
|
||||||
|
#define GIT_PROXY_OPTIONS_INIT {GIT_PROXY_OPTIONS_VERSION}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a proxy options structure
|
||||||
|
*
|
||||||
|
* @param opts the options struct to initialize
|
||||||
|
* @param version the version of the struct, use `GIT_PROXY_OPTIONS_VERSION`
|
||||||
|
*/
|
||||||
|
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
|
||||||
|
|
||||||
|
GIT_END_DECL
|
||||||
|
|
||||||
|
#endif
|
16
src/proxy.c
Normal file
16
src/proxy.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||||
|
* a Linking Exception. For full terms see the included COPYING file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "git2/proxy.h"
|
||||||
|
|
||||||
|
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
|
||||||
|
{
|
||||||
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
||||||
|
opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user