Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
This commit is contained in:
Clemens Vasters 2019-11-27 12:03:30 +01:00
Родитель c8723d8bcf
Коммит 87af41e38d
88 изменённых файлов: 4421 добавлений и 4430 удалений

Просмотреть файл

@ -1,46 +1,47 @@
version: '0.1.3-{build}' version: '0.1.3-{build}'
init: init:
- git config --global core.autocrlf true - git config --global core.autocrlf true
branches: matrix:
only: fast_finish: true
- master - image: Visual Studio 2017
- /^v\d+\.\d+\.\d+.*$/ - image: Ubuntu
build_script: branches:
- cmd: .\package.cmd only:
- sh: ./package.sh - master
clone_depth: 1 - /^v\d+\.\d+\.\d+.*$/
environment: build_script:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - cmd: .\package.cmd
DOTNET_CLI_TELEMETRY_OPTOUT: 1 - sh: ./package.sh
AZBRIDGE_TEST_CXNSTRING: clone_depth: 1
secure: DLwQwbX0CCtVlezqK0rPcIgnxFofTos/c3UMLTGSIWdHFwO9YHIU8a6fbxVaH5sFP+MS/ELLP66C4KVY8KwAf2EkF5ZgNm8624d1ERwN6xNCQbIVprzXw0TfgWRdIp76/07R1BnGZ/+lawAieosU9v/r6L8ibaoWB3f+mfOAgAz+dkm+azytP9A3NgrbKhr6LiRirVTrzz4+JgVDrwTgKA== environment:
DOCKER_USER: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
secure: hNy9HBcjNhhWaM96cjKZYw== DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOCKER_PASS: AZBRIDGE_TEST_CXNSTRING:
secure: gMshhMI/3eiFO2D7A59gpkzwpyuuyRG1lEga3a5p1xM= secure: DLwQwbX0CCtVlezqK0rPcIgnxFofTos/c3UMLTGSIWdHFwO9YHIU8a6fbxVaH5sFP+MS/ELLP66C4KVY8KwAf2EkF5ZgNm8624d1ERwN6xNCQbIVprzXw0TfgWRdIp76/07R1BnGZ/+lawAieosU9v/r6L8ibaoWB3f+mfOAgAz+dkm+azytP9A3NgrbKhr6LiRirVTrzz4+JgVDrwTgKA==
test_script: DOCKER_USER:
# - cmd: docker login -u=%DOCKER_USER% -p=%DOCKER_PASS% secure: hNy9HBcjNhhWaM96cjKZYw==
- cmd: .\verify-build.cmd DOCKER_PASS:
- sh: docker login -u $DOCKER_USER -p $DOCKER_PASS secure: gMshhMI/3eiFO2D7A59gpkzwpyuuyRG1lEga3a5p1xM=
- sh: ./verify-build.sh test_script:
image: # - cmd: docker login -u=%DOCKER_USER% -p=%DOCKER_PASS%
- Visual Studio 2017 - cmd: .\verify-build.cmd
- Ubuntu - sh: docker login -u $DOCKER_USER -p $DOCKER_PASS
artifacts: - sh: ./verify-build.sh
- path: 'artifacts\build\**\*.tar.gz' artifacts:
- path: 'artifacts\build\**\*.zip' - path: 'artifacts\build\**\*.tar.gz'
- path: 'artifacts\build\**\*.deb' - path: 'artifacts\build\**\*.zip'
- path: 'artifacts\build\**\*.rpm' - path: 'artifacts\build\**\*.deb'
- path: 'artifacts\build\**\*.msi' - path: 'artifacts\build\**\*.rpm'
deploy: - path: 'artifacts\build\**\*.msi'
- provider: GitHub deploy:
tag: $(APPVEYOR_REPO_TAG_NAME) - provider: GitHub
release: Release $(APPVEYOR_REPO_TAG_NAME) tag: $(APPVEYOR_REPO_TAG_NAME)
description: This is the release $(APPVEYOR_REPO_TAG_NAME) of $(APPVEYOR_REPO_NAME). release: Release $(APPVEYOR_REPO_TAG_NAME)
auth_token: description: This is the release $(APPVEYOR_REPO_TAG_NAME) of $(APPVEYOR_REPO_NAME).
secure: y86dwXyXNSKbC78BtVOuwkdd3apz6wFaZvy42Sy56PtREJnLRV/KkBIkOK1iucSZ auth_token:
artifact: /.*/ secure: y86dwXyXNSKbC78BtVOuwkdd3apz6wFaZvy42Sy56PtREJnLRV/KkBIkOK1iucSZ
draft: false artifact: /.*/
prerelease: true draft: false
on: prerelease: true
on:
appveyor_repo_tag: true # deploy on tag push only appveyor_repo_tag: true # deploy on tag push only

Просмотреть файл

@ -1,4 +1,4 @@
artifacts artifacts
test/ test/
**/bin/ **/bin/
**/obj/ **/obj/

102
.gitattributes поставляемый
Просмотреть файл

@ -1,51 +1,51 @@
*.doc diff=astextplain *.doc diff=astextplain
*.DOC diff=astextplain *.DOC diff=astextplain
*.docx diff=astextplain *.docx diff=astextplain
*.DOCX diff=astextplain *.DOCX diff=astextplain
*.dot diff=astextplain *.dot diff=astextplain
*.DOT diff=astextplain *.DOT diff=astextplain
*.pdf diff=astextplain *.pdf diff=astextplain
*.PDF diff=astextplain *.PDF diff=astextplain
*.rtf diff=astextplain *.rtf diff=astextplain
*.RTF diff=astextplain *.RTF diff=astextplain
*.jpg binary *.jpg binary
*.png binary *.png binary
*.gif binary *.gif binary
*.cs text=auto diff=csharp *.cs text=auto diff=csharp
*.vb text=auto *.vb text=auto
*.resx text=auto *.resx text=auto
*.c text=auto *.c text=auto
*.cpp text=auto *.cpp text=auto
*.cxx text=auto *.cxx text=auto
*.h text=auto *.h text=auto
*.hxx text=auto *.hxx text=auto
*.py text=auto *.py text=auto
*.rb text=auto *.rb text=auto
*.java text=auto *.java text=auto
*.html text=auto *.html text=auto
*.htm text=auto *.htm text=auto
*.css text=auto *.css text=auto
*.scss text=auto *.scss text=auto
*.sass text=auto *.sass text=auto
*.less text=auto *.less text=auto
*.js text=auto *.js text=auto
*.lisp text=auto *.lisp text=auto
*.clj text=auto *.clj text=auto
*.sql text=auto *.sql text=auto
*.php text=auto *.php text=auto
*.lua text=auto *.lua text=auto
*.m text=auto *.m text=auto
*.asm text=auto *.asm text=auto
*.erl text=auto *.erl text=auto
*.fs text=auto *.fs text=auto
*.fsx text=auto *.fsx text=auto
*.hs text=auto *.hs text=auto
*.csproj text=auto *.csproj text=auto
*.vbproj text=auto *.vbproj text=auto
*.fsproj text=auto *.fsproj text=auto
*.dbproj text=auto *.dbproj text=auto
*.sln text=auto eol=crlf *.sln text=auto eol=crlf
*.sh eol=lf *.sh eol=lf

66
.gitignore поставляемый
Просмотреть файл

@ -1,34 +1,34 @@
[Oo]bj/ [Oo]bj/
[Bb]in/ [Bb]in/
TestResults/ TestResults/
.nuget/ .nuget/
_ReSharper.*/ _ReSharper.*/
packages/ packages/
artifacts/ artifacts/
PublishProfiles/ PublishProfiles/
*.user *.user
*.suo *.suo
*.cache *.cache
*.docstates *.docstates
_ReSharper.* _ReSharper.*
nuget.exe nuget.exe
*net45.csproj *net45.csproj
*net451.csproj *net451.csproj
*k10.csproj *k10.csproj
*.psess *.psess
*.vsp *.vsp
*.pidb *.pidb
*.userprefs *.userprefs
*DS_Store *DS_Store
*.ncrunchsolution *.ncrunchsolution
*.*sdf *.*sdf
*.ipch *.ipch
*.sln.ide *.sln.ide
project.lock.json project.lock.json
/.vs /.vs
.vscode/ .vscode/
.build/ .build/
.testPublish/ .testPublish/
global.json global.json
*.g.targets *.g.targets
launchSettings.json launchSettings.json

958
CONFIG.md
Просмотреть файл

@ -1,479 +1,479 @@
# Configuration and Command Line Options # Configuration and Command Line Options
## Command Line Options ## Command Line Options
'azbridge' can be run in a "local" or "remote" mode. The "local" mode binds a 'azbridge' can be run in a "local" or "remote" mode. The "local" mode binds a
local listener address or socket to a relay name. The "remote" mode binds a relay local listener address or socket to a relay name. The "remote" mode binds a relay
name to a remote listener adress. name to a remote listener adress.
Since azbridge helps with scenarios not dissimilar to SSH tunnels, albeit without Since azbridge helps with scenarios not dissimilar to SSH tunnels, albeit without
requiring peer-to-peer connectivity, the command line syntax of 'azbridge' uses requiring peer-to-peer connectivity, the command line syntax of 'azbridge' uses
elements that resemble SSH's equivalent tunnel functionality, especially the -L elements that resemble SSH's equivalent tunnel functionality, especially the -L
and -R arguments. The key difference to SSH is that azbridge always binds sockets and -R arguments. The key difference to SSH is that azbridge always binds sockets
to an Azure Relay name, and that Azure Relay acts as the identifier for the to an Azure Relay name, and that Azure Relay acts as the identifier for the
tunnel and as network rendezvous point. In other words, you **always** need to tunnel and as network rendezvous point. In other words, you **always** need to
pair an azbridge instance running as local forwarder with an azbridge running pair an azbridge instance running as local forwarder with an azbridge running
as a remote forwarder on the other end. as a remote forwarder on the other end.
SSH's dynamic SOCKS proxy functionality (SSH's -D option) is not supported since SSH's dynamic SOCKS proxy functionality (SSH's -D option) is not supported since
it puts clients in control of selecting remote hosts after they've been bridged it puts clients in control of selecting remote hosts after they've been bridged
into a foreign network, and this may pose significant security risks and might into a foreign network, and this may pose significant security risks and might
inadvertently enable undesired access to resources on that foreign network. inadvertently enable undesired access to resources on that foreign network.
`(C) -- 127.3.2.1:5000 -> (L) -- ['myname'] -> (R) -- 10.1.2.3:5000 -> (S)` `(C) -- 127.3.2.1:5000 -> (L) -- ['myname'] -> (R) -- 10.1.2.3:5000 -> (S)`
* **(C)** Client * **(C)** Client
* **(L)** Local forwarder: `azbridge -L 127.3.2.1:5000:myname` * **(L)** Local forwarder: `azbridge -L 127.3.2.1:5000:myname`
* **(R)** Remote forwarder: `azbridge -R myname:10.1.2.3:5000` * **(R)** Remote forwarder: `azbridge -R myname:10.1.2.3:5000`
* **(S)** Server listening at `10.1.2.3:5000` * **(S)** Server listening at `10.1.2.3:5000`
A single instance of azbridge can support multiple concurrent "local" listeners A single instance of azbridge can support multiple concurrent "local" listeners
and multiple "remote" forwarders concurrently, also in a mixed configuration. and multiple "remote" forwarders concurrently, also in a mixed configuration.
The required Azure Relay connection string can either be supplied on the command The required Azure Relay connection string can either be supplied on the command
line, can be picked from an environment variable, or from a configuration file. line, can be picked from an environment variable, or from a configuration file.
The connection string's embedded authentication/authorization information must The connection string's embedded authentication/authorization information must
confer sufficient permissions for the desired operation(s) to be executed, e.g. confer sufficient permissions for the desired operation(s) to be executed, e.g.
for the "local" mode, the connection string must enable the bridge to send to for the "local" mode, the connection string must enable the bridge to send to
the configured relay entity. the configured relay entity.
Arguments: Arguments:
**-b bind_address** **-b bind_address**
Use bind_address on the local machine as the source address of Use bind_address on the local machine as the source address of
forwarding connections. Only useful on systems with more than one forwarding connections. Only useful on systems with more than one
address. address.
**-D** **-D**
Reserved. Not presently supported Reserved. Not presently supported
**-E endpoint_uri** **-E endpoint_uri**
Azure Relay endpoint URI (see -x). Azure Relay endpoint URI (see -x).
**-F configfile** **-F configfile**
Specifies an alternative per-user configuration file. If a configuration Specifies an alternative per-user configuration file. If a configuration
file is given on the command line, the system-wide configuration file file is given on the command line, the system-wide configuration file
(Linux: /etc/azbridge/azbridge_config.machine.yml, (Linux: /etc/azbridge/azbridge_config.machine.yml,
Windows: %ALLUSERSPROFILE%\Microsoft\AzureBridge\azbridge_config.machine.yml) will be Windows: %ALLUSERSPROFILE%\Microsoft\AzureBridge\azbridge_config.machine.yml) will be
ignored. ignored.
The default for the per-user configuration file is ~/.azurebridge/config The default for the per-user configuration file is ~/.azurebridge/config
on Linux and %USERPROFILE%\.azurebridge\config on Windows. on Linux and %USERPROFILE%\.azurebridge\config on Windows.
**-g** **-g**
Allows remote hosts to connect to local forwarded ports. Allows remote hosts to connect to local forwarded ports.
**-K policy_name** **-K policy_name**
Azure Relay shared access policy name to use (see -x). Azure Relay shared access policy name to use (see -x).
**-k policy_key** **-k policy_key**
Azure Relay shared access policy key to use (see -x). Azure Relay shared access policy key to use (see -x).
**-L [bind_address:]port[/port_name]{;...}:relay_name**<br/> **-L [bind_address:]port[/port_name]{;...}:relay_name**<br/>
**-L local_socket[/port_name]{;...}:relay_name**<br/> **-L local_socket[/port_name]{;...}:relay_name**<br/>
Specifies that connections to the given TCP/UDP port(s) or Unix socket(s) Specifies that connections to the given TCP/UDP port(s) or Unix socket(s)
on the local (client) host are to be bound (forwarded) to the given on the local (client) host are to be bound (forwarded) to the given
Azure Relay name. Azure Relay name.
- `bind_address`: Optional local IP address to bind the - `bind_address`: Optional local IP address to bind the
listener to. This may be a DNS name or a numerical IPv4 or listener to. This may be a DNS name or a numerical IPv4 or
IPv6 address expression and must resolve to a network endpoint IPv6 address expression and must resolve to a network endpoint
on the local machine. When omitted, the listener is bound to on the local machine. When omitted, the listener is bound to
all addresses ("any"). all addresses ("any").
- `port`: TCP or UDP port number. TCP ports are the default. - `port`: TCP or UDP port number. TCP ports are the default.
UDP port numbers must be suffixed with `U`, UDP port numbers must be suffixed with `U`,
e.g. `-L 3434U:relay`. e.g. `-L 3434U:relay`.
- `local_socket`: Unix socket name. The expression will be - `local_socket`: Unix socket name. The expression will be
interpreted as a Unix socket name if it's not a valid `port` interpreted as a Unix socket name if it's not a valid `port`
expression (i.e. not a number, with optional protocol suffix). expression (i.e. not a number, with optional protocol suffix).
- `port_name`: Optional logical name for the port. If a "local" - `port_name`: Optional logical name for the port. If a "local"
TCP port ought to be mapped to a different "remote" TCP port, TCP port ought to be mapped to a different "remote" TCP port,
a logical name allows this clearly, e.g. `-L 13389/rdp:relay` a logical name allows this clearly, e.g. `-L 13389/rdp:relay`
matches to `-R relay:rdp/3389` on the logical port name `rdp`, matches to `-R relay:rdp/3389` on the logical port name `rdp`,
which is bound to TCP port 13389 on the local side and TCP which is bound to TCP port 13389 on the local side and TCP
port 3389 on the remote side. For TCP/UDP, the default value port 3389 on the remote side. For TCP/UDP, the default value
for `port_name` is the `port` value itself, meaning for `port_name` is the `port` value itself, meaning
`-L 13389:relay` can also be matched with `-R relay:13389/3389`. `-L 13389:relay` can also be matched with `-R relay:13389/3389`.
For Unix sockets, this logical mapping can also be used, and For Unix sockets, this logical mapping can also be used, and
the default value is the name of `local_socket`. It is the default value is the name of `local_socket`. It is
permitted for multiple local TCP ports and Unix sockets or permitted for multiple local TCP ports and Unix sockets or
for multiple UDP ports to use the same logical port name. UDP for multiple UDP ports to use the same logical port name. UDP
ports must always be matched to remote UDP forwarders. ports must always be matched to remote UDP forwarders.
- `relay_name`: Name of the relay to bind the port(s) to. - `relay_name`: Name of the relay to bind the port(s) to.
There can be multiple local binding expressions given for a There can be multiple local binding expressions given for a
`relay_name`, separated by semicolons. The expressions can `relay_name`, separated by semicolons. The expressions can
also mix protocols, e.g. `-L 7777;7777U:relay` binds the also mix protocols, e.g. `-L 7777;7777U:relay` binds the
TCP and UDP ports 7777 to one relay name. TCP and UDP ports 7777 to one relay name.
The bridge opens a listener on a TCP or UDP port or a Unix socket The bridge opens a listener on a TCP or UDP port or a Unix socket
"here". The TCP or UDP listener is optionally bound to the "here". The TCP or UDP listener is optionally bound to the
specified `bind_address`. Whenever a connection specified `bind_address`. Whenever a connection
is made to the local port or socket, the connection is forwarded is made to the local port or socket, the connection is forwarded
to a connected remote bridge via the chosen Relay entity. to a connected remote bridge via the chosen Relay entity.
Port forwardings can also be specified in the configuration file. Port forwardings can also be specified in the configuration file.
Only the superuser can forward privileged ports. IPv6 addresses Only the superuser can forward privileged ports. IPv6 addresses
can be specified by enclosing the address in square brackets. can be specified by enclosing the address in square brackets.
By default, the local port is bound in accordance with the By default, the local port is bound in accordance with the
*GatewayPorts* configuration setting. However, an explicit bind_address *GatewayPorts* configuration setting. However, an explicit bind_address
may be used to bind the connection to a specific address. The may be used to bind the connection to a specific address. The
bind_address of ``localhost'' indicates that the listening port bind_address of ``localhost'' indicates that the listening port
be bound for local use only, while an empty address or '*' indi- be bound for local use only, while an empty address or '*' indi-
cates that the port should be available from all interfaces. cates that the port should be available from all interfaces.
The -L option can be used multiple times on a single command line, The -L option can be used multiple times on a single command line,
but only once per `relay_name`. but only once per `relay_name`.
**-o option** **-o option**
Can be used to give options in the format used in the configura- Can be used to give options in the format used in the configura-
tion file. This is useful for specifying options for which there tion file. This is useful for specifying options for which there
is no separate command-line flag. is no separate command-line flag.
**-q** **-q**
Quiet mode. Causes most warning and diagnostic messages to be Quiet mode. Causes most warning and diagnostic messages to be
suppressed. suppressed.
**-R relay_name:[port_name/]hostport{;...}**<br/> **-R relay_name:[port_name/]hostport{;...}**<br/>
**-R relay_name:host:[port_name/]hostport{;...}**<br/> **-R relay_name:host:[port_name/]hostport{;...}**<br/>
**-R relay_name:[port_name/]local_socket{;...}** **-R relay_name:[port_name/]local_socket{;...}**
Specifies that connections to the given Azure Relay name Specifies that connections to the given Azure Relay name
and optional logical port name are to be forwarded to the and optional logical port name are to be forwarded to the
given host and port, or Unix socket*. given host and port, or Unix socket*.
Whenever a connection is made to the Relay and logical port, Whenever a connection is made to the Relay and logical port,
the connection is forwarded to this listener (or a concurrently the connection is forwarded to this listener (or a concurrently
connected listener in a random load distribution fashion), and a connected listener in a random load distribution fashion), and a
then a forwarding connection is made to either port, host:hostport, then a forwarding connection is made to either port, host:hostport,
or local_socket, from the local machine. or local_socket, from the local machine.
- `relay_name`: Name of the relay to bind the forwarder to. - `relay_name`: Name of the relay to bind the forwarder to.
- `port_name`: Optional logical name for the port as defined by - `port_name`: Optional logical name for the port as defined by
the local forwarder bound to this relay (see -L). the local forwarder bound to this relay (see -L).
- `host`: Host name or IP address to forward to. - `host`: Host name or IP address to forward to.
- `port`: TCP or UDP port number. TCP ports are the default. - `port`: TCP or UDP port number. TCP ports are the default.
UDP port numbers must be suffixed with `U`, UDP port numbers must be suffixed with `U`,
e.g. `-R relay:3434U`. UDP forwarders can only be bound to e.g. `-R relay:3434U`. UDP forwarders can only be bound to
logcial UDP ports. logcial UDP ports.
- `local_socket`: Unix socket name. The expression will be - `local_socket`: Unix socket name. The expression will be
interpreted as a Unix socket name if it's not a valid `port` interpreted as a Unix socket name if it's not a valid `port`
expression (i.e. not a number, with optional protocol suffix). expression (i.e. not a number, with optional protocol suffix).
There can be multiple local binding expressions given for a There can be multiple local binding expressions given for a
`relay_name`, separated by semicolons. The expressions can `relay_name`, separated by semicolons. The expressions can
also mix protocols, e.g. `-R relay:7777;7777U` binds to also mix protocols, e.g. `-R relay:7777;7777U` binds to
TCP and UDP port forwarders for 7777 on one relay name. TCP and UDP port forwarders for 7777 on one relay name.
Port forwardings can also be specified in the configuration file. Port forwardings can also be specified in the configuration file.
Privileged ports can be forwarded only when runing with elevated privileges. Privileged ports can be forwarded only when runing with elevated privileges.
IPv6 addresses can be specified by enclosing the address in square IPv6 addresses can be specified by enclosing the address in square
brackets. brackets.
The -R option can be used multiple times on a single command line, The -R option can be used multiple times on a single command line,
but only once for each `relay_name`. but only once for each `relay_name`.
**-S signature** **-S signature**
Azure Relay shared access signature (previously issued access token) Azure Relay shared access signature (previously issued access token)
to use (see -x) to use (see -x)
**-V** **-V**
Display the version number and exit. Display the version number and exit.
**-v** **-v**
Verbose mode. Causes ssh to print debugging messages about its Verbose mode. Causes ssh to print debugging messages about its
progress. This is helpful in debugging connection, authentica- progress. This is helpful in debugging connection, authentica-
tion, and configuration problems. Multiple -v options increase tion, and configuration problems. Multiple -v options increase
the verbosity. The maximum is 3. the verbosity. The maximum is 3.
**-x connection_string** **-x connection_string**
Connection String. Azure Relay connection string for the namespace Connection String. Azure Relay connection string for the namespace
or for a specific Azure Relay. The Connection String properties or for a specific Azure Relay. The Connection String properties
can be overriden by the -E (Endpoint), -K (SharedAccessKeyName), can be overriden by the -E (Endpoint), -K (SharedAccessKeyName),
-k (SharedAccessKey), -S (SharedAccessSignature) arguments. -k (SharedAccessKey), -S (SharedAccessSignature) arguments.
If an EntityPath is specified in the connection string, that name If an EntityPath is specified in the connection string, that name
is the only valid option for the relay_name expressions in the is the only valid option for the relay_name expressions in the
-L and -R options or for expressions in the effective configuration -L and -R options or for expressions in the effective configuration
file. file.
The connection string can be set via the AZURE_BRIDGE_CONNECTIONSTRING The connection string can be set via the AZURE_BRIDGE_CONNECTIONSTRING
environment variable. environment variable.
## Configuration File ## Configuration File
The configuration file is a YAML file that specifies options that apply The configuration file is a YAML file that specifies options that apply
to the machine or user. The machine level options are always read and to the machine or user. The machine level options are always read and
then complemented by or overriden by the user-level options. then complemented by or overriden by the user-level options.
The configuration file can exist in three locations: The configuration file can exist in three locations:
1. Machine configuration, always loaded if present. 1. Machine configuration, always loaded if present.
Linux: /etc/azurebridge/azurebridge_config Linux: /etc/azurebridge/azurebridge_config
Windows: %ALLUSERSPROFILE%\Microsoft\AzureBridge\azbridge_config Windows: %ALLUSERSPROFILE%\Microsoft\AzureBridge\azbridge_config
2. User configuration, overrides and complements machine config. 2. User configuration, overrides and complements machine config.
Linux: ~/.azurebridge/config Linux: ~/.azurebridge/config
Windows: %USERPROFILE%\.azurebridge\config Windows: %USERPROFILE%\.azurebridge\config
3. Override user configuration location for current execution with 3. Override user configuration location for current execution with
the -f option. the -f option.
The configuration file holds a range of configuration options that, just The configuration file holds a range of configuration options that, just
like the command line options, partially lean on similar expressions like the command line options, partially lean on similar expressions
used in SSH, even though the configuration format differs from that of SSH. used in SSH, even though the configuration format differs from that of SSH.
The "LocalForward" and "RemoteForward" sections define bindings as with The "LocalForward" and "RemoteForward" sections define bindings as with
the -L and -R command line options above. the -L and -R command line options above.
* **AddressFamily** - Specifies which address family to use when connecting. Valid * **AddressFamily** - Specifies which address family to use when connecting. Valid
arguments are "any", "inet" (use IPv4 only), or "inet6" arguments are "any", "inet" (use IPv4 only), or "inet6"
(use IPv6 only). The default is "any". (use IPv6 only). The default is "any".
* **AzureRelayConnectionString** - Azure Relay connection string for a Relay * **AzureRelayConnectionString** - Azure Relay connection string for a Relay
namespace. Only one namespace connection string can be specified per configuration namespace. Only one namespace connection string can be specified per configuration
file. file.
* **AzureRelayEndpoint** - Azure Relay endpoint URI for a Relay namespace. Overrides * **AzureRelayEndpoint** - Azure Relay endpoint URI for a Relay namespace. Overrides
the 'Endpoint' property of the connection string, if present. the 'Endpoint' property of the connection string, if present.
* **AzureRelaySharedAccessKeyName** - Azure Relay shared access policy name. Overrides * **AzureRelaySharedAccessKeyName** - Azure Relay shared access policy name. Overrides
the 'SharedAccessKeyName' property of the connection string, if present. the 'SharedAccessKeyName' property of the connection string, if present.
* **AzureRelaySharedAccessKey** - Azure Relay shared access policy key. Overrides * **AzureRelaySharedAccessKey** - Azure Relay shared access policy key. Overrides
the 'SharedAccessKey' property of the connection string, if present. the 'SharedAccessKey' property of the connection string, if present.
* **AzureRelaySharedAccessSignature** - Azure Relay shared access policy signature. Overrides * **AzureRelaySharedAccessSignature** - Azure Relay shared access policy signature. Overrides
the 'SharedAccessSignature' property of the connection string, if present. the 'SharedAccessSignature' property of the connection string, if present.
* **BindAddress** - Use the specified address on the local machine as the source * **BindAddress** - Use the specified address on the local machine as the source
address of the connection. Only useful on systems with more than address of the connection. Only useful on systems with more than
one address. one address.
* **ClearAllForwardings** - Specifies that all local, and remote port forwardings * **ClearAllForwardings** - Specifies that all local, and remote port forwardings
specified in the configuration files or on the command line be specified in the configuration files or on the command line be
cleared. This option is primarily useful when used from the cleared. This option is primarily useful when used from the
command line to clear port forwardings set in configura- command line to clear port forwardings set in configura-
tion files. The argument must be "true" or "false". The default is "false". tion files. The argument must be "true" or "false". The default is "false".
* **ConnectionAttempts** - Specifies the number of tries (one per second) to make * **ConnectionAttempts** - Specifies the number of tries (one per second) to make
before exiting. The argument must be an integer. This may be useful in scripts before exiting. The argument must be an integer. This may be useful in scripts
if the connection sometimes fails. The default is 1. if the connection sometimes fails. The default is 1.
* **ConnectTimeout** - Specifies the timeout (in seconds) used when connecting to the * **ConnectTimeout** - Specifies the timeout (in seconds) used when connecting to the
relay server, instead of using the default system TCP timeout. relay server, instead of using the default system TCP timeout.
This value is used only when the target is down or really This value is used only when the target is down or really
unreachable, not when it refuses the connection. unreachable, not when it refuses the connection.
* **ExitOnForwardFailure** - Specifies whether azbridge(1) should terminate the * **ExitOnForwardFailure** - Specifies whether azbridge(1) should terminate the
connection if it cannot set up all requested local, and remote port forwardings, connection if it cannot set up all requested local, and remote port forwardings,
(e.g. if either end is unable to bind and listen on a specified port). (e.g. if either end is unable to bind and listen on a specified port).
The argument must be "true" or "false". The default is "false". The argument must be "true" or "false". The default is "false".
* **GatewayPorts** - Specifies whether remote hosts are allowed to connect to local * **GatewayPorts** - Specifies whether remote hosts are allowed to connect to local
forwarded ports. By default, azbridge(1) binds local port forwardings forwarded ports. By default, azbridge(1) binds local port forwardings
to the loopback address. This prevents other remote hosts from to the loopback address. This prevents other remote hosts from
connecting to forwarded ports. GatewayPorts can be used to specify that azbridge connecting to forwarded ports. GatewayPorts can be used to specify that azbridge
should bind local port forwardings to the wildcard address, thus allowing remote should bind local port forwardings to the wildcard address, thus allowing remote
hosts to connect to forwarded ports. The argument must be "true" or "false". hosts to connect to forwarded ports. The argument must be "true" or "false".
The default is "false". The default is "false".
* **LocalForward** - Specifies that a (set of) TCP ports on the local machine * **LocalForward** - Specifies that a (set of) TCP ports on the local machine
shall be forwarded via the Azure Relay. Each entry can have four properties, shall be forwarded via the Azure Relay. Each entry can have four properties,
"BindAddress", "Port", "LocalSocket", and "RelayName". See [below](#localforward-properties) for "BindAddress", "Port", "LocalSocket", and "RelayName". See [below](#localforward-properties) for
details. details.
* **LogLevel** - Gives the verbosity level that is used when logging messages * **LogLevel** - Gives the verbosity level that is used when logging messages
from azbridge(1). The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE, from azbridge(1). The possible values are: QUIET, FATAL, ERROR, INFO, VERBOSE,
DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify
higher levels of verbose output. higher levels of verbose output.
* **RemoteForward** - Specifies that a TCP port on the remote machine be bound to * **RemoteForward** - Specifies that a TCP port on the remote machine be bound to
a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host", a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host",
"HostPort", and "LocalSocket". See [below](#remoteforward-properties) for details. "HostPort", and "LocalSocket". See [below](#remoteforward-properties) for details.
### LocalForward properties ### LocalForward properties
The following properties are defined for LocalForward. LocalForward is a list The following properties are defined for LocalForward. LocalForward is a list
and multiple entries are permitted. and multiple entries are permitted.
* **RelayName** - name of the Azure Relay name to bind to * **RelayName** - name of the Azure Relay name to bind to
* **ConnectionString** - optional Azure Relay connection string to use just for this forwarder, overriding the global **AzureRelayConnectionString** property. * **ConnectionString** - optional Azure Relay connection string to use just for this forwarder, overriding the global **AzureRelayConnectionString** property.
For a single port binding on the Relay name, the following properties can be For a single port binding on the Relay name, the following properties can be
used on the same entry. For multiple bindings they can be used to form a list. used on the same entry. For multiple bindings they can be used to form a list.
* **BindAddress** - network address to bind the socket to * **BindAddress** - network address to bind the socket to
* **PortName** - Logical port name * **PortName** - Logical port name
* **BindPort** - TCP port to bind the socket to * **BindPort** - TCP port to bind the socket to
* **BindLocalSocket** - named UNIX socket to bind to * **BindLocalSocket** - named UNIX socket to bind to
* **RemoteHostName** - optionally, remote host name represented by this entry (purely informational) * **RemoteHostName** - optionally, remote host name represented by this entry (purely informational)
Examples: Examples:
- Single listener binding: - Single listener binding:
``` YAML ``` YAML
- RelayName: myrelay - RelayName: myrelay
BindAddress: 127.0.8.1 BindAddress: 127.0.8.1
BindPort: 8888 BindPort: 8888
``` ```
- Multiple listener binding: - Multiple listener binding:
``` YAML ``` YAML
- RelayName: myrelay - RelayName: myrelay
Bindings: Bindings:
- BindAddress: 127.0.8.1 - BindAddress: 127.0.8.1
BindPort: 5671 BindPort: 5671
PortName: amqps PortName: amqps
- BindAddress: 127.0.8.1 - BindAddress: 127.0.8.1
BindPort: 5672 BindPort: 5672
PortName: amqp PortName: amqp
``` ```
Using `BindAddress` and `BindPort` is mutually exclusive with use of the Using `BindAddress` and `BindPort` is mutually exclusive with use of the
`BindLocalSocket` option. The bind_address argument is optional and when `BindLocalSocket` option. The bind_address argument is optional and when
omitted, the default is for the listener to bind to all interfaces. omitted, the default is for the listener to bind to all interfaces.
The `RelayName` option is always required. The `RelayName` option is always required.
The `RemoteHostName` is property optional and used for documentation. Host The `RemoteHostName` is property optional and used for documentation. Host
names that shall resolve to the -L local forwarder address need to names that shall resolve to the -L local forwarder address need to
be added to the local hosts file. be added to the local hosts file.
The `ConnectionString` property is optional and overrides the global settings The `ConnectionString` property is optional and overrides the global settings
if supplied. if supplied.
### RemoteForward properties ### RemoteForward properties
The following properties are defined for RemoteForward. RemoteForward is a list The following properties are defined for RemoteForward. RemoteForward is a list
and multiple entries are permitted. and multiple entries are permitted.
* **RelayName** - name of the Azure Relay name to bind to * **RelayName** - name of the Azure Relay name to bind to
* **ConnectionString** - Azure Relay connection string to use for this forwarder * **ConnectionString** - Azure Relay connection string to use for this forwarder
For a single port binding on the Relay name, the following properties can be For a single port binding on the Relay name, the following properties can be
used on the same entry. For multiple bindings they can be used to form a list. used on the same entry. For multiple bindings they can be used to form a list.
* **Host** - network address to forward to * **Host** - network address to forward to
* **HostPort** - TCP port on the host to forward to * **HostPort** - TCP port on the host to forward to
* **PortName** - Logical port name * **PortName** - Logical port name
* **LocalSocket** - named UNIX socket forward to * **LocalSocket** - named UNIX socket forward to
Examples: Examples:
- Single listener binding: - Single listener binding:
``` YAML ``` YAML
- RelayName: myrelay - RelayName: myrelay
Host: localhost Host: localhost
HostPort: 8888 HostPort: 8888
``` ```
- Multiple listener binding: - Multiple listener binding:
``` YAML ``` YAML
- RelayName: myrelay - RelayName: myrelay
Bindings: Bindings:
- Host: broker.corp.example.com - Host: broker.corp.example.com
HostPort: 5671 HostPort: 5671
PortName: amqps PortName: amqps
- Host: broker.corp.example.com - Host: broker.corp.example.com
HostPort: 5672 HostPort: 5672
PortName: amqp PortName: amqp
``` ```
Using `Host` and `HostPort` is mutually exclusive with use of the Using `Host` and `HostPort` is mutually exclusive with use of the
`LocalSocket` option. The host argument is optional and when `LocalSocket` option. The host argument is optional and when
omitted, the default is for the forwarder to connect to the local machine. omitted, the default is for the forwarder to connect to the local machine.
The `RelayName` option is always required. The `RelayName` option is always required.
The `ConnectionString` property is optional and overrides the global settings The `ConnectionString` property is optional and overrides the global settings
if supplied. if supplied.
## Configuration examples ## Configuration examples
### Example 1 ### Example 1
This example shows a local configuration that enables local forwarders for This example shows a local configuration that enables local forwarders for
three remote computers on different intranets via RDP. three remote computers on different intranets via RDP.
``` yaml ``` yaml
--- ---
GatewayPorts : no GatewayPorts : no
LocalForward: LocalForward:
# RDP to remote machine abcxyz # RDP to remote machine abcxyz
- BindAddress: 127.0.10.1 - BindAddress: 127.0.10.1
HostName: abcxyz.intra-de.example.com HostName: abcxyz.intra-de.example.com
BindPort: 3389 BindPort: 3389
RelayName: abcxyzrdp RelayName: abcxyzrdp
# SQL to remote machine abcxyz # SQL to remote machine abcxyz
- BindAddress: 127.0.10.1 - BindAddress: 127.0.10.1
HostName: abcxyz.intra-de.example.com HostName: abcxyz.intra-de.example.com
BindPort: 1433 BindPort: 1433
RelayName: abcxyzsql RelayName: abcxyzsql
# RDP to remote machine defijk # RDP to remote machine defijk
- BindAddress: 127.0.10.2 - BindAddress: 127.0.10.2
HostName: defijk.intra-us.example.com HostName: defijk.intra-us.example.com
BindPort: 3389 BindPort: 3389
RelayName: defijkrdp RelayName: defijkrdp
# RDP to remote machine ghiuvw # RDP to remote machine ghiuvw
- BindAddress: 127.0.10.3 - BindAddress: 127.0.10.3
HostName: ghiuvw.intra-jp.example.com HostName: ghiuvw.intra-jp.example.com
BindPort: 3389 BindPort: 3389
RelayName: ghiuvwrdp RelayName: ghiuvwrdp
``` ```
## Example 2 ## Example 2
This example shows a local configuration that enables the remote This example shows a local configuration that enables the remote
forwarder for RDP on the computer `abcxyz` from the prior example. forwarder for RDP on the computer `abcxyz` from the prior example.
``` yaml ``` yaml
--- ---
GatewayPorts : no GatewayPorts : no
RemoteForward: RemoteForward:
# RDP to this machine abcxyz # RDP to this machine abcxyz
- RelayName: abcxyzrdp - RelayName: abcxyzrdp
HostPort: 3389 HostPort: 3389
``` ```
## Example 3 ## Example 3
This example shows a local configuration that enables the remote This example shows a local configuration that enables the remote
forwarder for RDP to a computer `defijk` from the prior example forwarder for RDP to a computer `defijk` from the prior example
on the remote network, but from a different computer. on the remote network, but from a different computer.
``` yaml ``` yaml
--- ---
GatewayPorts : no GatewayPorts : no
RemoteForward: RemoteForward:
# RDP to remote machine defijk # RDP to remote machine defijk
- RelayName: defijkrdp - RelayName: defijkrdp
Host: defijk.intra-us.example.com Host: defijk.intra-us.example.com
HostPort: 3389 HostPort: 3389
``` ```
## Example 4 ## Example 4
This example shows a configuration that allows access This example shows a configuration that allows access
to a remote SQL server on a local network address of this computer. to a remote SQL server on a local network address of this computer.
``` yaml ``` yaml
--- ---
GatewayPorts : true GatewayPorts : true
LocalForward: LocalForward:
# SQL to remote machine abcxyz # SQL to remote machine abcxyz
- BindAddress: 10.10.100.2 - BindAddress: 10.10.100.2
HostName: abcxyz.intra-de.example.com HostName: abcxyz.intra-de.example.com
BindPort: 1433 BindPort: 1433
RelayName: abcxyzsql RelayName: abcxyzsql
``` ```

Просмотреть файл

@ -1,44 +1,44 @@
# Contribute or Provide Feedback for Azure Relay # Contribute or Provide Feedback for Azure Relay
## Table of Contents ## Table of Contents
- [Code of Conduct](#code-of-conduct) - [Code of Conduct](#code-of-conduct)
- [Filing Issues](#filing-issues) - [Filing Issues](#filing-issues)
- [Pull Requests](#pull-requests) - [Pull Requests](#pull-requests)
- [General guidelines](#general-guidelines) - [General guidelines](#general-guidelines)
- [Testing guidelines](#testing-guidelines) - [Testing guidelines](#testing-guidelines)
## Code of Conduct ## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Language specific libraries ## Language specific libraries
If you have an issue for a specific client library, see the following: If you have an issue for a specific client library, see the following:
* [.NET](https://github.com/clemensv/azure-relay-bridge-dotnet) * [.NET](https://github.com/clemensv/azure-relay-bridge-dotnet)
* [.Node](https://github.com/clemensv/azure-relay-bridge-node) * [.Node](https://github.com/clemensv/azure-relay-bridge-node)
## Filing Issues ## Filing Issues
You can find all of the issues that have been filed in the [Issues](https://github.com/clemensv/azure-relay-bridge/issues) section of the repository. You can find all of the issues that have been filed in the [Issues](https://github.com/clemensv/azure-relay-bridge/issues) section of the repository.
If you encounter any service side bugs, please file an issue [here](https://github.com/clemensv/azure-relay-bridge/issues/new) and make sure to fill out the provided template with the requested information. If you encounter any service side bugs, please file an issue [here](https://github.com/clemensv/azure-relay-bridge/issues/new) and make sure to fill out the provided template with the requested information.
To suggest a new feature or changes that could be made, file an issue the same way you would for a bug, but remove the provided template and replace it with information about your suggestion. To suggest a new feature or changes that could be made, file an issue the same way you would for a bug, but remove the provided template and replace it with information about your suggestion.
### Pull Requests ### Pull Requests
You can find all of the pull requests that have been opened in the [Pull Request](https://github.com/clemensv/azure-relay-bridge/pulls) section of the repository. You can find all of the pull requests that have been opened in the [Pull Request](https://github.com/clemensv/azure-relay-bridge/pulls) section of the repository.
To open your own pull request, click [here](https://github.com/clemensv/azure-relay-bridge/compare). When creating a pull request, keep the following in mind: To open your own pull request, click [here](https://github.com/clemensv/azure-relay-bridge/compare). When creating a pull request, keep the following in mind:
- Make sure you are pointing to the fork and branch that your changes were made in - Make sure you are pointing to the fork and branch that your changes were made in
- The pull request template that is provided **should be filled out**; this is not something that should just be deleted or ignored when the pull request is created - The pull request template that is provided **should be filled out**; this is not something that should just be deleted or ignored when the pull request is created
- Deleting or ignoring this template will elongate the time it takes for your pull request to be reviewed - Deleting or ignoring this template will elongate the time it takes for your pull request to be reviewed
#### General guidelines #### General guidelines
The following guidelines must be followed in **EVERY** pull request that is opened. The following guidelines must be followed in **EVERY** pull request that is opened.
- Title of the pull request is clear and informative - Title of the pull request is clear and informative
- There are a small number of commits that each have an informative message - There are a small number of commits that each have an informative message
- A description of the changes the pull request makes is included, and a reference to the bug/issue the pull request fixes is included, if applicable - A description of the changes the pull request makes is included, and a reference to the bug/issue the pull request fixes is included, if applicable

Просмотреть файл

@ -1,34 +1,34 @@
<Project> <Project>
<!--<Import <!--<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props" Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " /> Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
!--> !-->
<Import Project="version.props" /> <Import Project="version.props" />
<Import Project="build\sources.props" /> <Import Project="build\sources.props" />
<Import Project="build\repo.props" /> <Import Project="build\repo.props" />
<Import Project="build\dependencies.props" /> <Import Project="build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<WindowsOnly>false</WindowsOnly> <WindowsOnly>false</WindowsOnly>
<WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks> <WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks>
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp2.1</CoreFrameworks> <CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks> <TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers> <WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>
<UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers> <UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers>
<RuntimeIdentifiers>$(WindowsRuntimeIdentifiers)$(UnixRuntimeIdentifiers)</RuntimeIdentifiers> <RuntimeIdentifiers>$(WindowsRuntimeIdentifiers)$(UnixRuntimeIdentifiers)</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Product>Microsoft Azure Relay Bridge</Product> <Product>Microsoft Azure Relay Bridge</Product>
<RepositoryUrl>https://github.com/Azure/azure-relay-bridge</RepositoryUrl> <RepositoryUrl>https://github.com/Azure/azure-relay-bridge</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot> <RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<BuildDir>$(RepositoryRoot)/artifacts/build</BuildDir> <BuildDir>$(RepositoryRoot)/artifacts/build</BuildDir>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign> <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableApiCheck>false</EnableApiCheck> <EnableApiCheck>false</EnableApiCheck>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

Просмотреть файл

@ -1,13 +1,11 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreApp30PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion> <NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion> <!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion> <NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use --> </PropertyGroup>
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion> <Target Name="VSTestIfTestProject">
</PropertyGroup> <CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
<Target Name="VSTestIfTestProject"> </Target>
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" /> </Project>
</Target>
</Project>

Просмотреть файл

@ -1,23 +1,23 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 as build FROM mcr.microsoft.com/dotnet/core/sdk:2.1 as build
WORKDIR /azure-relay-bridge/src WORKDIR /azure-relay-bridge/src
COPY src/azbridge/azbridge.csproj /azure-relay-bridge/src/azbridge/ COPY src/azbridge/azbridge.csproj /azure-relay-bridge/src/azbridge/
COPY src/Microsoft.Azure.Relay.Bridge/Microsoft.Azure.Relay.Bridge.csproj /azure-relay-bridge/src/Microsoft.Azure.Relay.Bridge/ COPY src/Microsoft.Azure.Relay.Bridge/Microsoft.Azure.Relay.Bridge.csproj /azure-relay-bridge/src/Microsoft.Azure.Relay.Bridge/
RUN dotnet restore /azure-relay-bridge/src/azbridge/azbridge.csproj RUN dotnet restore /azure-relay-bridge/src/azbridge/azbridge.csproj
COPY . /azure-relay-bridge/ COPY . /azure-relay-bridge/
WORKDIR /azure-relay-bridge/src/azbridge WORKDIR /azure-relay-bridge/src/azbridge
RUN dotnet build azbridge.csproj RUN dotnet build azbridge.csproj
FROM build AS publish FROM build AS publish
WORKDIR /azure-relay-bridge/src/azbridge WORKDIR /azure-relay-bridge/src/azbridge
RUN dotnet publish azbridge.csproj -c Release -f netcoreapp2.1 -o /app RUN dotnet publish azbridge.csproj -c Release -f netcoreapp3.0 -o /app
FROM mcr.microsoft.com/dotnet/core/runtime:2.1 FROM mcr.microsoft.com/dotnet/core/runtime:2.1
WORKDIR /app WORKDIR /app
COPY --from=publish /app . COPY --from=publish /app .

Просмотреть файл

@ -1,14 +1,14 @@
Copyright (c) Microsoft Corporation Copyright (c) Microsoft Corporation
All rights reserved. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the this file except in compliance with the License. You may obtain a copy of the
License at License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License. specific language governing permissions and limitations under the License.

Просмотреть файл

@ -1,18 +1,17 @@
{ {
"Default": { "Default": {
"packages" : { "packages" : {
"azbridge": { "azbridge": {
"Exclusions": { "Exclusions": {
"DOC_MISSING": { "DOC_MISSING": {
"lib/netcoreapp2.0/azbridge.dll": "no public API", "lib/netcoreapp3.0/azbridge.dll": "no public API"
"lib/netcoreapp2.1/azbridge.dll": "no public API" }
} }
} }
} },
}, "rules": [
"rules": [ "DefaultCompositeRule"
"DefaultCompositeRule" ]
] }
}
} }

448
README.md
Просмотреть файл

@ -1,224 +1,224 @@
# Azure Relay Bridge # Azure Relay Bridge
![img](https://ci.appveyor.com/api/projects/status/github/clemensv/azure-relay-bridge) ![img](https://ci.appveyor.com/api/projects/status/github/clemensv/azure-relay-bridge)
The Azure Relay Bridge is a tool that allows creating TCP tunnels between any The Azure Relay Bridge is a tool that allows creating TCP tunnels between any
pair of hosts, as log as those hosts each have outbound Internet connectivity on pair of hosts, as log as those hosts each have outbound Internet connectivity on
port 443 (HTTPS) to the Azure Relay service. port 443 (HTTPS) to the Azure Relay service.
The Relay Bridge is designed for reaching networked assets in any environment The Relay Bridge is designed for reaching networked assets in any environment
where it is impractical or impossible for those assets to be directly reachable where it is impractical or impossible for those assets to be directly reachable
through a public IP address. through a public IP address.
For instance, if you need to reach an on-premises database or application from For instance, if you need to reach an on-premises database or application from
a cloud-based solution, the on-premises assets are typically not accessible a cloud-based solution, the on-premises assets are typically not accessible
from the public network. The Relay Bridge can help establishing a TCP tunnel from the public network. The Relay Bridge can help establishing a TCP tunnel
socket exclusive to a particular endpoint in such an on-premises environment, socket exclusive to a particular endpoint in such an on-premises environment,
and without the complexity of a VPN solution. and without the complexity of a VPN solution.
Another example are on-premises applications that run behind network gateways Another example are on-premises applications that run behind network gateways
with dynamically assigned IP addresses, like in most residential and small-business with dynamically assigned IP addresses, like in most residential and small-business
environments. An Azure Relay endpoint provides a stable network destination for environments. An Azure Relay endpoint provides a stable network destination for
such application endpoints, without VPN, and without the complexity of a dynamic such application endpoints, without VPN, and without the complexity of a dynamic
DNS registration. DNS registration.
Inside cloud and data-center environments, reaching into and bridging between Inside cloud and data-center environments, reaching into and bridging between
containerized workloads can also be tricky. The Relay Bridge can provide containerized workloads can also be tricky. The Relay Bridge can provide
every service inside a container instance with a stable and externally reachable every service inside a container instance with a stable and externally reachable
network address, and with the Relay's built-in load balancing support, you can network address, and with the Relay's built-in load balancing support, you can
even bind multiple services inside separate container instances to the same name. even bind multiple services inside separate container instances to the same name.
And you can do all that without configuring any kind of inbound network access And you can do all that without configuring any kind of inbound network access
to the containers. to the containers.
Practically all TCP-based services, including HTTP(S), are compatible with Practically all TCP-based services, including HTTP(S), are compatible with
the Azure Relay Bridge. For services that require connections to be made from the Azure Relay Bridge. For services that require connections to be made from
both parties, the bridge can concurrently act as local and remote bridge. both parties, the bridge can concurrently act as local and remote bridge.
All Azure Relay endpoints are secure, requiring TLS 1.2+ (aka SSL) WebSocket All Azure Relay endpoints are secure, requiring TLS 1.2+ (aka SSL) WebSocket
connections for all connections through the Relay, and both communicating connections for all connections through the Relay, and both communicating
parties must provide an authorization token to establish a connection via the parties must provide an authorization token to establish a connection via the
Relay. Relay.
The Azure Relay Bridge builds on this foundation and creates the illusion of a The Azure Relay Bridge builds on this foundation and creates the illusion of a
local connection to the target service by ways of a *local forwarder* that listens local connection to the target service by ways of a *local forwarder* that listens
on a configured IP address and port, and that then forwards all incoming TCP on a configured IP address and port, and that then forwards all incoming TCP
connections to a *remote forwarder* via the Azure Relay. The *remote forwarder* connections to a *remote forwarder* via the Azure Relay. The *remote forwarder*
connects each incoming connection to the target service. connects each incoming connection to the target service.
## azbridge ## azbridge
The Relay Bridge is a command line utility ("azbridge") with binary distributions The Relay Bridge is a command line utility ("azbridge") with binary distributions
for Windows, macOS, and several Linux distributions. It can optionally also be for Windows, macOS, and several Linux distributions. It can optionally also be
configured and run as a background service on Windows and Linux. configured and run as a background service on Windows and Linux.
Since the tool helps with scenarios not dissimilar to SSH tunnels (but without Since the tool helps with scenarios not dissimilar to SSH tunnels (but without
requiring peer-to-peer connectivity) the command line syntax of *azbridge* uses requiring peer-to-peer connectivity) the command line syntax of *azbridge* uses
elements that resemble SSH's equivalent tunnel functionality, especially the -L elements that resemble SSH's equivalent tunnel functionality, especially the -L
and -R arguments. The key difference to SSH is that *azbridge* always binds sockets and -R arguments. The key difference to SSH is that *azbridge* always binds sockets
to an Azure Relay name, and that Azure Relay acts as the identifier for the to an Azure Relay name, and that Azure Relay acts as the identifier for the
tunnel and as network rendezvous point. tunnel and as network rendezvous point.
The bridge can either be used directly on the machines where a client or a server The bridge can either be used directly on the machines where a client or a server
resides, or it can be used as a gateway solution. When used as *local forwarder resides, or it can be used as a gateway solution. When used as *local forwarder
gateway* (*-g* *-L*) and with externally resolvable listener addresses, the bridge gateway* (*-g* *-L*) and with externally resolvable listener addresses, the bridge
resides on a host in the network and allows connections from clients across the resides on a host in the network and allows connections from clients across the
network. The *remote forwarder* (*-R*) can always reach out to off-machine targets network. The *remote forwarder* (*-R*) can always reach out to off-machine targets
within its network scope. within its network scope.
When the bridge is used locally, the client can configure DNS names of the target When the bridge is used locally, the client can configure DNS names of the target
services in the local *hosts* file, picking a unique IP address out of the 127.x.x.x services in the local *hosts* file, picking a unique IP address out of the 127.x.x.x
range for each service, and then configuring a local forwarder for the respective range for each service, and then configuring a local forwarder for the respective
target address. Those addresses can only be reached on that local machine, shielding target address. Those addresses can only be reached on that local machine, shielding
the client from exposing TCP bridges to others. For instance, for reaching the remote the client from exposing TCP bridges to others. For instance, for reaching the remote
SQL Server "sql.corp.example.com", you would add an IP address like `127.1.2.3` to SQL Server "sql.corp.example.com", you would add an IP address like `127.1.2.3` to
the "hosts" file as `127.1.2.3 sql.corp.example.com`, and then use a local forwarder the "hosts" file as `127.1.2.3 sql.corp.example.com`, and then use a local forwarder
configuration that refers to the `127.1.2.3` address, for example configuration that refers to the `127.1.2.3` address, for example
`azbridge -L 127.1.2.3:1433:relay`. `azbridge -L 127.1.2.3:1433:relay`.
When used as a *local forwarder gateway*, you will need to use addresses that can be When used as a *local forwarder gateway*, you will need to use addresses that can be
reached by the clients in your network, and ideally have a multi-homed setup where reached by the clients in your network, and ideally have a multi-homed setup where
the gateway node has a network address, e.g. from the `10.x.x.x` range, per remote the gateway node has a network address, e.g. from the `10.x.x.x` range, per remote
target service host. For naming support, those network addresses should be registered target service host. For naming support, those network addresses should be registered
in a DNS service reachable and used by the clients in your network. A DNS service is in a DNS service reachable and used by the clients in your network. A DNS service is
also required for resolving wildcard addresses, even for the local scenario. also required for resolving wildcard addresses, even for the local scenario.
With a local configuration, when using *azbridge* to reach a Microsoft SQL Server With a local configuration, when using *azbridge* to reach a Microsoft SQL Server
instance endpoint (port 1433) on a different network, you would use the following instance endpoint (port 1433) on a different network, you would use the following
constellation: constellation:
* SQL Client connects to sql.corp.example.com:1433, whereby the local "hosts" file * SQL Client connects to sql.corp.example.com:1433, whereby the local "hosts" file
re-maps the server name to a local address with the entry re-maps the server name to a local address with the entry
`127.0.5.1 sql.corp.example.com` `127.0.5.1 sql.corp.example.com`
* Local bridge on the same machine the client runs as * Local bridge on the same machine the client runs as
`azclient -L 127.0.5.1:1433:sql-corp-example-com -x {cxnstring}` `azclient -L 127.0.5.1:1433:sql-corp-example-com -x {cxnstring}`
* Azure Relay has a configured endpoint * Azure Relay has a configured endpoint
`wss://mynamespace.servicebus.windows.net/$hc/sql-corp-example-com` `wss://mynamespace.servicebus.windows.net/$hc/sql-corp-example-com`
* Remote Bridge on or near the server runs as * Remote Bridge on or near the server runs as
`azclient -R sql-corp-example-com:sql.corp.example.com:1433 -x {cxnstring}` `azclient -R sql-corp-example-com:sql.corp.example.com:1433 -x {cxnstring}`
* SQL Server runs as `sql.corp.example.com:1433` * SQL Server runs as `sql.corp.example.com:1433`
The `{cxnstring}` represents the connection string for the configured The `{cxnstring}` represents the connection string for the configured
Azure Relay endpoint with appropriate send and/or listen permissions. Azure Relay endpoint with appropriate send and/or listen permissions.
The connection string can be obtained from the portal. The connection string can be obtained from the portal.
Further details about how to use the tool and how to configure it can be found in Further details about how to use the tool and how to configure it can be found in
the [Configuration and Command Line Options](CONFIG.md) document. the [Configuration and Command Line Options](CONFIG.md) document.
## Downloads ## Downloads
This is an early preview. Unsigned (!) binaries are available for direct download This is an early preview. Unsigned (!) binaries are available for direct download
from the [Github Releases](../../releases) page for evaluation. Signed binaries will eventually from the [Github Releases](../../releases) page for evaluation. Signed binaries will eventually
be available for download with common package managers. be available for download with common package managers.
## Installation ## Installation
The tool has installation packages for a variety of platforms. All packages are The tool has installation packages for a variety of platforms. All packages are
self-contained distributions, meaning they do not rely on a centrally installed self-contained distributions, meaning they do not rely on a centrally installed
runtime. However, depending on the package type and platform, the installation runtime. However, depending on the package type and platform, the installation
of some prerequisites may be required. of some prerequisites may be required.
### Windows ### Windows
The easiest way to install the bridge on Windows is by using the appropriate The easiest way to install the bridge on Windows is by using the appropriate
*.msi package. The installer adds the tool to the PATH and also registers *.msi package. The installer adds the tool to the PATH and also registers
the "azbridge" Windows service. The service is configured for on-demand the "azbridge" Windows service. The service is configured for on-demand
(manual) start at installation time. (manual) start at installation time.
> **KNOWN ISSUE:** These early builds are not signed. Download the MSI file, > **KNOWN ISSUE:** These early builds are not signed. Download the MSI file,
unblock it, and then install. Otherwise the application may not work as unblock it, and then install. Otherwise the application may not work as
expected. expected.
### Linux ### Linux
### Debian, Ubuntu, Linuxmint ### Debian, Ubuntu, Linuxmint
For Debian 8+ and all Debian-based distributions, like Ubuntu 16.04+ and Linuxmint 16+, For Debian 8+ and all Debian-based distributions, like Ubuntu 16.04+ and Linuxmint 16+,
you can install the tool from the respective *.deb package with you can install the tool from the respective *.deb package with
`sudo apt-get install ./{package-name}.deb` `sudo apt-get install ./{package-name}.deb`
Using `apt-get` will automatically install the distribution prerequisites. The Using `apt-get` will automatically install the distribution prerequisites. The
.NET Core platform required by the tool is private and not installed machine-wide. .NET Core platform required by the tool is private and not installed machine-wide.
The package install will put the tool into `/usr/share/azbridge`, place a machine-wide The package install will put the tool into `/usr/share/azbridge`, place a machine-wide
configuration file into `/etc/azbridge`, add the tool to the PATH, and register two configuration file into `/etc/azbridge`, add the tool to the PATH, and register two
BASH extensions for adding and removing entries from the `/etc/hosts` file: BASH extensions for adding and removing entries from the `/etc/hosts` file:
* `addhost {ipaddress} {name}` - adds an IP address with the given hostname to "hosts" * `addhost {ipaddress} {name}` - adds an IP address with the given hostname to "hosts"
* `removehost {name}` - removes the entry for the given hostname * `removehost {name}` - removes the entry for the given hostname
### Fedora, CentOS, Red Hat Enterprise Linux ### Fedora, CentOS, Red Hat Enterprise Linux
For Fedora, CentOS, and Red Hat Enterprise Linux, you can install the tool from the For Fedora, CentOS, and Red Hat Enterprise Linux, you can install the tool from the
respective *.rpm package with respective *.rpm package with
`sudo yum install {package-name}.rpm` `sudo yum install {package-name}.rpm`
Using `yum` will automatically install the distribution prerequisites. The Using `yum` will automatically install the distribution prerequisites. The
.NET Core platform required by the tool is private and not installed machine-wide. .NET Core platform required by the tool is private and not installed machine-wide.
The package install will put the tool into `/usr/share/azbridge`. The package install will put the tool into `/usr/share/azbridge`.
> **KNOWN ISSUE 1:** The package will presently not install correctly if the install of > **KNOWN ISSUE 1:** The package will presently not install correctly if the install of
> documentation files is suppressed for `yum` and/or `dnf`. The is the case for many > documentation files is suppressed for `yum` and/or `dnf`. The is the case for many
> container base images. On CentOS, you should drop the respective configuration with > container base images. On CentOS, you should drop the respective configuration with
> `sed -i '/tsflags=nodocs/d' /etc/yum.conf` (RUN in a Dockerfile before installing > `sed -i '/tsflags=nodocs/d' /etc/yum.conf` (RUN in a Dockerfile before installing
> the rpm) and on Fedora use `sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf`. > the rpm) and on Fedora use `sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf`.
> **KNOWN ISSUE 2:** The package does not yet perform any of the post-install tasks that > **KNOWN ISSUE 2:** The package does not yet perform any of the post-install tasks that
> the Debian package performs, meaning the tool is not added to the PATH. > the Debian package performs, meaning the tool is not added to the PATH.
### Other distributions and platforms ### Other distributions and platforms
You can also install the tool from respective platform *.tar.gz archive. For Linux, You can also install the tool from respective platform *.tar.gz archive. For Linux,
you need to [explicitly install Linux prerequisites for .NET Core](https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x) you need to [explicitly install Linux prerequisites for .NET Core](https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x)
for your respective distribution. For macOS, you need to [install prerequisites from for your respective distribution. For macOS, you need to [install prerequisites from
this list](https://docs.microsoft.com/en-us/dotnet/core/macos-prerequisites?tabs=netcore2x). this list](https://docs.microsoft.com/en-us/dotnet/core/macos-prerequisites?tabs=netcore2x).
## Building the code ## Building the code
The repo contains a complete build and verification structure for all platforms. The repo contains a complete build and verification structure for all platforms.
The Windows version MUST be built on Windows because the service integration requires The Windows version MUST be built on Windows because the service integration requires
the full .NET Framework and the installer can only be built on Windows. You will at least the full .NET Framework and the installer can only be built on Windows. You will at least
need the "Build Tools for Visual Studio 2017", and ideally a local install of need the "Build Tools for Visual Studio 2017", and ideally a local install of
Visual Studio 2017 with desktop C# support. Visual Studio 2017 with desktop C# support.
All other versions are built with the .NET Core 2.0 or .NET Core 2.1 SDK. The DEB and All other versions are built with the .NET Core 2.0 or .NET Core 2.1 SDK. The DEB and
RPM packages are only created when building on a Unix (i.e. Linux or macOS) host. RPM packages are only created when building on a Unix (i.e. Linux or macOS) host.
The ideal build environment is a Windows 10/Windows Server 2016 host with Docker for The ideal build environment is a Windows 10/Windows Server 2016 host with Docker for
Windows installed. The `package-all.cmd` script will first build and package all Windows Windows installed. The `package-all.cmd` script will first build and package all Windows
targets, and then launch a docker-based build with the official Microsoft .NET Core 2.1 targets, and then launch a docker-based build with the official Microsoft .NET Core 2.1
SDK image for the remaining targets. The `package.sh` script will only build and package SDK image for the remaining targets. The `package.sh` script will only build and package
the Unix targets, the `package.cmd` script only Windows targets. the Unix targets, the `package.cmd` script only Windows targets.
The latter two scripts are used with the AppVeyor build as well. The latter two scripts are used with the AppVeyor build as well.
All build output is placed into `./artifacts/build` All build output is placed into `./artifacts/build`
## Tests ## Tests
Running the Unit tests and the Integration tests both require an Azure Relay namespace Running the Unit tests and the Integration tests both require an Azure Relay namespace
to be available for use and configured. Before running any of the test scenarios, the to be available for use and configured. Before running any of the test scenarios, the
environment variable `AZBRIDGE_TEST_CXNSTRING` must be set to the Relay namespace environment variable `AZBRIDGE_TEST_CXNSTRING` must be set to the Relay namespace
connection string (enclosed in quotes) on the build platform. connection string (enclosed in quotes) on the build platform.
An [Azure Resource Manager template](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy-cli) An [Azure Resource Manager template](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy-cli)
to deploy a namespace with the definitions required for testing resides in to deploy a namespace with the definitions required for testing resides in
`./src/tools/azure/test-resource-template.json`. The template expects the name of a new namespace `./src/tools/azure/test-resource-template.json`. The template expects the name of a new namespace
and a region location as inputs. and a region location as inputs.
Once the template has been deployed using either Powershell or the Azure CLI, you can find Once the template has been deployed using either Powershell or the Azure CLI, you can find
the "sendListenConnectionString" value (starts with "Endpoint...") in the returned output. the "sendListenConnectionString" value (starts with "Endpoint...") in the returned output.
Copy and save that value for use in the `AZBRIDGE_TEST_CXNSTRING` environment variable. Copy and save that value for use in the `AZBRIDGE_TEST_CXNSTRING` environment variable.
The Unit tests can be run from the command line with `dotnet test` with an .NET Core build. The Unit tests can be run from the command line with `dotnet test` with an .NET Core build.
For integration testing that installs and executes the emitted packages, run `verify-build.cmd`/`verify-build.sh`. Expect for Windows, the integration tests depend on a For integration testing that installs and executes the emitted packages, run `verify-build.cmd`/`verify-build.sh`. Expect for Windows, the integration tests depend on a
local Docker installation: The script cleans any existing images, builds CentOS, Debian, Fedora, and Ubuntu images with the newly built binaries, and then executes a series of tests on each image. local Docker installation: The script cleans any existing images, builds CentOS, Debian, Fedora, and Ubuntu images with the newly built binaries, and then executes a series of tests on each image.
## Contributions ## Contributions
We're gladly accepting contributions. Please review the [contribution rules](CONTRIBUTING.md). We're gladly accepting contributions. Please review the [contribution rules](CONTRIBUTING.md).

Просмотреть файл

@ -1,5 +1,5 @@
<Project> <Project>
<Target Name="VSTest"> <Target Name="VSTest">
<MSBuild Projects="@(ProjectReference)" Targets="VSTestIfTestProject" /> <MSBuild Projects="@(ProjectReference)" Targets="VSTestIfTestProject" />
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,2 +1,2 @@
@ECHO OFF @ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE"

Просмотреть файл

@ -1,43 +1,42 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Package Versions"> <PropertyGroup Label="Package Versions">
<PackagingTargetsPackageVersion>0.1.39</PackagingTargetsPackageVersion> <PackagingTargetsPackageVersion>0.1.39</PackagingTargetsPackageVersion>
<DotnetDebPackageVersion>0.1.39</DotnetDebPackageVersion> <DotnetDebPackageVersion>0.1.39</DotnetDebPackageVersion>
<DotnetRpmPackageVersion>0.1.39</DotnetRpmPackageVersion> <DotnetRpmPackageVersion>0.1.39</DotnetRpmPackageVersion>
<DotnetZipPackageVersion>0.1.39</DotnetZipPackageVersion> <DotnetZipPackageVersion>0.1.39</DotnetZipPackageVersion>
<DotnetTarballPackageVersion>0.1.39</DotnetTarballPackageVersion> <DotnetTarballPackageVersion>0.1.39</DotnetTarballPackageVersion>
<WixPackageVersion>3.11.1</WixPackageVersion> <WixPackageVersion>3.11.1</WixPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion> <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftDiagnosticsTracingEventSourcePackageVersion>1.1.28</MicrosoftDiagnosticsTracingEventSourcePackageVersion> <MicrosoftDiagnosticsTracingEventSourcePackageVersion>1.1.28</MicrosoftDiagnosticsTracingEventSourcePackageVersion>
<MicrosoftDiagnosticsTracingTraceEventPackageVersion>2.0.22</MicrosoftDiagnosticsTracingTraceEventPackageVersion> <MicrosoftDiagnosticsTracingTraceEventPackageVersion>2.0.22</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion> <MicrosoftNETCoreApp30PackageVersion>2.0.0</MicrosoftNETCoreApp30PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0</MicrosoftNETCoreApp21PackageVersion> <MicrosoftNetHttpHeadersPackageVersion>2.1.0</MicrosoftNetHttpHeadersPackageVersion>
<MicrosoftNetHttpHeadersPackageVersion>2.1.0</MicrosoftNetHttpHeadersPackageVersion> <MicrosoftNETTestSdkPackageVersion>15.8.0</MicrosoftNETTestSdkPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.8.0</MicrosoftNETTestSdkPackageVersion> <NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion> <SystemNetHttpWinHttpHandlerPackageVersion>4.5.0-rtm-26502-02</SystemNetHttpWinHttpHandlerPackageVersion>
<SystemNetHttpWinHttpHandlerPackageVersion>4.5.0-rtm-26502-02</SystemNetHttpWinHttpHandlerPackageVersion> <SystemNetNetworkInformationPackageVersion>4.3.0</SystemNetNetworkInformationPackageVersion>
<SystemNetNetworkInformationPackageVersion>4.3.0</SystemNetNetworkInformationPackageVersion> <SystemThreadingTasksDataflowPackageVersion>4.8.0</SystemThreadingTasksDataflowPackageVersion>
<SystemThreadingTasksDataflowPackageVersion>4.8.0</SystemThreadingTasksDataflowPackageVersion> <SystemConsolePackageVersion>4.3.1</SystemConsolePackageVersion>
<SystemConsolePackageVersion>4.3.1</SystemConsolePackageVersion> <SystemIOPackageVersion>4.3.0</SystemIOPackageVersion>
<SystemIOPackageVersion>4.3.0</SystemIOPackageVersion> <SystemConfigurationPackageVersion>4.3.0</SystemConfigurationPackageVersion>
<SystemConfigurationPackageVersion>4.3.0</SystemConfigurationPackageVersion> <SystemDiagnosticsTracingPackageVersion>4.3.0</SystemDiagnosticsTracingPackageVersion>
<SystemDiagnosticsTracingPackageVersion>4.3.0</SystemDiagnosticsTracingPackageVersion> <SystemDiagnosticsDiagnosticSourcePackageVersion>4.5.0</SystemDiagnosticsDiagnosticSourcePackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>4.5.0</SystemDiagnosticsDiagnosticSourcePackageVersion> <SystemNetHttpPackageVersion>4.3.3</SystemNetHttpPackageVersion>
<SystemNetHttpPackageVersion>4.3.3</SystemNetHttpPackageVersion> <SystemNetNameResolutionPackageVersion>4.3.0</SystemNetNameResolutionPackageVersion>
<SystemNetNameResolutionPackageVersion>4.3.0</SystemNetNameResolutionPackageVersion> <YamlDotNetSignedPackageVersion>5.0.1</YamlDotNetSignedPackageVersion>
<YamlDotNetSignedPackageVersion>5.0.1</YamlDotNetSignedPackageVersion> <MicrosoftExtensionsLoggingPackageVersion>2.1.1</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.1</MicrosoftExtensionsLoggingPackageVersion> <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.1</MicrosoftExtensionsLoggingConsolePackageVersion> <XunitPackageVersion>2.4.0</XunitPackageVersion>
<XunitPackageVersion>2.4.0</XunitPackageVersion> <DotnetXunitPackageVersion>2.3.1</DotnetXunitPackageVersion>
<DotnetXunitPackageVersion>2.3.1</DotnetXunitPackageVersion> <XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion> <XunitRunnerMsBuildPackageVersion>2.4.0</XunitRunnerMsBuildPackageVersion>
<XunitRunnerMsBuildPackageVersion>2.4.0</XunitRunnerMsBuildPackageVersion> <NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion> <MicrosoftAzureRelayPackageVersion>2.0.0-preview1-20180523</MicrosoftAzureRelayPackageVersion>
<MicrosoftAzureRelayPackageVersion>2.0.0-preview1-20180523</MicrosoftAzureRelayPackageVersion> <McMasterExtensionsCommandLineUtilsPackageVersion>2.2.5</McMasterExtensionsCommandLineUtilsPackageVersion>
<McMasterExtensionsCommandLineUtilsPackageVersion>2.2.5</McMasterExtensionsCommandLineUtilsPackageVersion> <SerilogExtensionsLoggingFilePackageVersion>1.1.0</SerilogExtensionsLoggingFilePackageVersion>
<SerilogExtensionsLoggingFilePackageVersion>1.1.0</SerilogExtensionsLoggingFilePackageVersion> </PropertyGroup>
</PropertyGroup> <Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " /> </Project>
</Project>

Просмотреть файл

@ -1,18 +1,16 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<WindowsOnly>false</WindowsOnly> <WindowsOnly>false</WindowsOnly>
<WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks> <WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks>
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp2.1</CoreFrameworks> <CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks> <TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers> <WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>
<UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers> <UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers>
<RuntimeIdentifiers>$(WindowsRuntimeIdentifiers)$(UnixRuntimeIdentifiers)</RuntimeIdentifiers> <RuntimeIdentifiers>$(WindowsRuntimeIdentifiers)$(UnixRuntimeIdentifiers)</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" /> <DotNetCoreRuntime Include="$(MicrosoftNETCoreApp30PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" /> </ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" /> </Project>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,7 +1,7 @@
<Project> <Project>
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/> <Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
<PropertyGroup Label="RestoreSources"> <PropertyGroup Label="RestoreSources">
<RestoreSources>$(DotNetRestoreSources)</RestoreSources> <RestoreSources>$(DotNetRestoreSources)</RestoreSources>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

Просмотреть файл

@ -1,26 +1,26 @@
@echo off @echo off
SET _DOCKER_BUILD="true" SET _DOCKER_BUILD="true"
docker -v > NUL docker -v > NUL
if not errorlevel 0 ( if not errorlevel 0 (
echo Linux RPM and DEB packaging requires a docker install echo Linux RPM and DEB packaging requires a docker install
SET _DOCKER_BUILD="false" SET _DOCKER_BUILD="false"
) )
echo *** Sanity check Windows echo *** Sanity check Windows
dotnet restore dotnet restore
dotnet test %* dotnet test %*
if not errorlevel 0 exit /b 1 if not errorlevel 0 exit /b 1
echo *** Building and packaging Windows Targets echo *** Building and packaging Windows Targets
if %_DOCKER_BUILD% == "true" ( if %_DOCKER_BUILD% == "true" (
echo *** Windows only echo *** Windows only
msbuild /t:clean,restore,package /p:WindowsOnly=true;Configuration=Release %* msbuild /t:clean,restore,package /p:WindowsOnly=true;Configuration=Release %*
) else ( ) else (
echo *** All platforms echo *** All platforms
msbuild /t:clean,restore,package /p:WindowsOnly=false;Configuration=Release %* msbuild /t:clean,restore,package /p:WindowsOnly=false;Configuration=Release %*
) )
if not errorlevel 0 exit /b 1 if not errorlevel 0 exit /b 1
if %_DOCKER_BUILD% == "true" ( if %_DOCKER_BUILD% == "true" (
echo *** Building and packaging Unix/Linux Targets echo *** Building and packaging Unix/Linux Targets
docker run --rm -v %cd%:/build microsoft/dotnet:2.1-sdk /build/package.sh /p:TargetFramework=netcoreapp2.1 %* docker run --rm -v %cd%:/build microsoft/dotnet:2.1-sdk /build/package.sh /p:TargetFramework=netcoreapp3.0 %*
) )

Просмотреть файл

@ -1,4 +1,4 @@
if not "%APPVEYOR_BUILD_NUMBER%"=="" set _BuildProp="/p:BuildNumber=%APPVEYOR_BUILD_NUMBER%" if not "%APPVEYOR_BUILD_NUMBER%"=="" set _BuildProp="/p:BuildNumber=%APPVEYOR_BUILD_NUMBER%"
if not "%APPVEYOR_BUILD_VERSION%"=="" set _VersionProp="/p:VersionPrefix=%APPVEYOR_BUILD_VERSION%" if not "%APPVEYOR_BUILD_VERSION%"=="" set _VersionProp="/p:VersionPrefix=%APPVEYOR_BUILD_VERSION%"
msbuild /t:clean,restore,build /p:WindowsOnly=true /p:Configuration=Debug %_BuildProp% %_VersionProp% %* msbuild /t:clean,restore,build /p:WindowsOnly=true /p:Configuration=Debug %_BuildProp% %_VersionProp% %*
msbuild /t:clean,restore,build,package /p:WindowsOnly=true /p:Configuration=Release %_BuildProp% %_VersionProp% %* msbuild /t:clean,restore,build,package /p:WindowsOnly=true /p:Configuration=Release %_BuildProp% %_VersionProp% %*

Просмотреть файл

@ -3,6 +3,6 @@ pushd "${0%/*}" > /dev/null
if [ ! -z $APPVEYOR_BUILD_NUMBER ]; then _BuildProp="/p:BuildNumber=$APPVEYOR_BUILD_NUMBER"; fi if [ ! -z $APPVEYOR_BUILD_NUMBER ]; then _BuildProp="/p:BuildNumber=$APPVEYOR_BUILD_NUMBER"; fi
if [ ! -z $APPVEYOR_BUILD_VERSION ]; then _VersionProp="/p:VersionPrefix=$APPVEYOR_BUILD_VERSION"; fi if [ ! -z $APPVEYOR_BUILD_VERSION ]; then _VersionProp="/p:VersionPrefix=$APPVEYOR_BUILD_VERSION"; fi
dotnet restore dotnet restore
dotnet msbuild /t:clean,restore,build /p:Configuration=Debug /p:TargetFramework=netcoreapp2.1 $_BuildProp $_VersionProp $@ dotnet msbuild /t:clean,restore,build /p:Configuration=Debug /p:TargetFramework=netcoreapp3.0 $_BuildProp $_VersionProp $@
dotnet msbuild /t:clean,restore,build,package /p:Configuration=Release /p:TargetFramework=netcoreapp2.1 $_BuildProp $_VersionProp $@ dotnet msbuild /t:clean,restore,build,package /p:Configuration=Release /p:TargetFramework=netcoreapp3.0 $_BuildProp $_VersionProp $@
popd popd

Двоичные данные
packages-microsoft-prod.deb

Двоичный файл не отображается.

Просмотреть файл

@ -1,2 +1,2 @@
@ECHO OFF @ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE" PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' %*; exit $LASTEXITCODE"

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<WindowsOnly>false</WindowsOnly> <WindowsOnly>false</WindowsOnly>
<WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks> <WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks>
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp2.1</CoreFrameworks> <CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks> <TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers> <WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>
<UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers> <UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.16.04-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,68 +1,68 @@
<StyleCopSettings Version="105"> <StyleCopSettings Version="105">
<Parsers> <Parsers>
<Parser ParserId="StyleCop.CSharp.CsParser"> <Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings> <ParserSettings>
<!-- No Rules enforced on *.Designer.cs files --> <!-- No Rules enforced on *.Designer.cs files -->
<BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty> <BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
</ParserSettings> </ParserSettings>
</Parser> </Parser>
</Parsers> </Parsers>
<GlobalSettings> <GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">True</BooleanProperty> <BooleanProperty Name="RulesEnabledByDefault">True</BooleanProperty>
<StringProperty Name="LinkedSettingsFile">%REPOROOT%\src\Legacy.StyleCop</StringProperty> <StringProperty Name="LinkedSettingsFile">%REPOROOT%\src\Legacy.StyleCop</StringProperty>
<StringProperty Name="MergeSettingsFiles">Linked</StringProperty> <StringProperty Name="MergeSettingsFiles">Linked</StringProperty>
</GlobalSettings> </GlobalSettings>
<!-- Legacy Files - No Rules enforced --> <!-- Legacy Files - No Rules enforced -->
<SourceFileList> <SourceFileList>
<Settings> <Settings>
<GlobalSettings> <GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty> <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings> </GlobalSettings>
</Settings> </Settings>
<SourceFile>Action.lex.cs</SourceFile> <SourceFile>Action.lex.cs</SourceFile>
<SourceFile>Action.y.cs</SourceFile> <SourceFile>Action.y.cs</SourceFile>
<SourceFile>EventSource.cs</SourceFile> <SourceFile>EventSource.cs</SourceFile>
<SourceFile>Filter.lex.cs</SourceFile> <SourceFile>Filter.lex.cs</SourceFile>
<SourceFile>Filter.y.cs</SourceFile> <SourceFile>Filter.y.cs</SourceFile>
</SourceFileList> </SourceFileList>
<!-- Legacy Files - Turn off "Do not use comparison where value goes first" --> <!-- Legacy Files - Turn off "Do not use comparison where value goes first" -->
<SourceFileList> <SourceFileList>
<Settings> <Settings>
<Analyzers> <Analyzers>
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.OrderingRules"> <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.OrderingRules">
<Rules> <Rules>
<Rule Name="NoValueFirstComparison"> <Rule Name="NoValueFirstComparison">
<RuleSettings> <RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty> <BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings> </RuleSettings>
</Rule> </Rule>
</Rules> </Rules>
</Analyzer> </Analyzer>
</Analyzers> </Analyzers>
</Settings> </Settings>
<SourceFile>BasicHttpRelayMessageSecurity.cs</SourceFile> <SourceFile>BasicHttpRelayMessageSecurity.cs</SourceFile>
<SourceFile>BrokeredMessage.cs</SourceFile> <SourceFile>BrokeredMessage.cs</SourceFile>
<SourceFile>ByteArrayComparer.cs</SourceFile> <SourceFile>ByteArrayComparer.cs</SourceFile>
<SourceFile>ConfigurationHelpers.cs</SourceFile> <SourceFile>ConfigurationHelpers.cs</SourceFile>
<SourceFile>DuplexMessageCorrelator.cs</SourceFile> <SourceFile>DuplexMessageCorrelator.cs</SourceFile>
<SourceFile>EventData.cs</SourceFile> <SourceFile>EventData.cs</SourceFile>
<SourceFile>EventProvider.cs</SourceFile> <SourceFile>EventProvider.cs</SourceFile>
<SourceFile>IRelayedConnectionConnectionControl.cs</SourceFile> <SourceFile>IRelayedConnectionConnectionControl.cs</SourceFile>
<SourceFile>MessageCollection.cs</SourceFile> <SourceFile>MessageCollection.cs</SourceFile>
<SourceFile>MessageSecurityOverRelayHttp.cs</SourceFile> <SourceFile>MessageSecurityOverRelayHttp.cs</SourceFile>
<SourceFile>MruCache.cs</SourceFile> <SourceFile>MruCache.cs</SourceFile>
<SourceFile>RelayedHttpUtility.cs</SourceFile> <SourceFile>RelayedHttpUtility.cs</SourceFile>
<SourceFile>SendAvailabilityMessagePump.cs</SourceFile> <SourceFile>SendAvailabilityMessagePump.cs</SourceFile>
<SourceFile>ServiceBusClientWebSocket.cs</SourceFile> <SourceFile>ServiceBusClientWebSocket.cs</SourceFile>
<SourceFile>ServiceBusInputChannel.cs</SourceFile> <SourceFile>ServiceBusInputChannel.cs</SourceFile>
<SourceFile>ServiceBusInputSessionChannelListener.cs</SourceFile> <SourceFile>ServiceBusInputSessionChannelListener.cs</SourceFile>
<SourceFile>ServiceBusUriHelper.cs</SourceFile> <SourceFile>ServiceBusUriHelper.cs</SourceFile>
<SourceFile>SocketConnectionPoolSettingsElement.cs</SourceFile> <SourceFile>SocketConnectionPoolSettingsElement.cs</SourceFile>
<SourceFile>TransportChannelFactory.cs</SourceFile> <SourceFile>TransportChannelFactory.cs</SourceFile>
<SourceFile>TransportChannelListener.cs</SourceFile> <SourceFile>TransportChannelListener.cs</SourceFile>
<SourceFile>UriPrefixTable.cs</SourceFile> <SourceFile>UriPrefixTable.cs</SourceFile>
<SourceFile>WSHttpRelayBindingBase.cs</SourceFile> <SourceFile>WSHttpRelayBindingBase.cs</SourceFile>
</SourceFileList> </SourceFileList>
</StyleCopSettings> </StyleCopSettings>

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -1,69 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="Azure Relay Bridge" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="119729c9-25d5-447f-b9a8-5e2b1cdbc348"> <Product Id="*" Name="Azure Relay Bridge" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="119729c9-25d5-447f-b9a8-5e2b1cdbc348">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" /> <MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="azbridge_installer" Level="1"> <Feature Id="ProductFeature" Title="azbridge_installer" Level="1">
<ComponentGroupRef Id="ProductComponents" /> <ComponentGroupRef Id="ProductComponents" />
</Feature> </Feature>
<PropertyRef Id="WIX_ACCOUNT_NETWORKSERVICE" /> <PropertyRef Id="WIX_ACCOUNT_NETWORKSERVICE" />
<PropertyRef Id="WIX_ACCOUNT_USERS" /> <PropertyRef Id="WIX_ACCOUNT_USERS" />
<PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" /> <PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"/> <PropertyRef Id="WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)license.rtf" /> <WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)license.rtf" />
<Condition Message="This application requires .NET Framework 4.5.2 or later. Please install the .NET Framework then run this installer again."> <Condition Message="This application requires .NET Framework 4.5.2 or later. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]> <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]>
</Condition> </Condition>
</Product> </Product>
<Fragment> <Fragment>
<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="TARGETDIR" Name="SourceDir">
<!-- Note using the preprocessor variable here --> <!-- Note using the preprocessor variable here -->
<?if $(sys.BUILDARCH)=x64?> <?if $(sys.BUILDARCH)=x64?>
<Directory Id="ProgramFiles64Folder"> <Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="Azure Relay Bridge" /> <Directory Id="INSTALLFOLDER" Name="Azure Relay Bridge" />
</Directory> </Directory>
<?else ?> <?else ?>
<Directory Id="ProgramFilesFolder"> <Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Azure Relay Bridge" /> <Directory Id="INSTALLFOLDER" Name="Azure Relay Bridge" />
</Directory> </Directory>
<?endif ?> <?endif ?>
<Directory Id="CommonAppDataFolder"> <Directory Id="CommonAppDataFolder">
<Directory Id="MicrosoftAppDataFolder" Name="Microsoft"> <Directory Id="MicrosoftAppDataFolder" Name="Microsoft">
<Directory Id="CONFIGFOLDER" Name="Azure Relay Bridge"/> <Directory Id="CONFIGFOLDER" Name="Azure Relay Bridge"/>
</Directory> </Directory>
</Directory> </Directory>
</Directory> </Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" /> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" /> <UIRef Id="WixUI_InstallDir" />
</Fragment> </Fragment>
<Fragment> <Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="etwManifest.dll"> <Component Id="etwManifest.dll">
<File Id="etwManifest.dll" KeyPath="yes" <File Id="etwManifest.dll" KeyPath="yes"
Source="$(var.Microsoft.Azure.Relay.Bridge.TargetDir)\Microsoft.Azure.Relay.Bridge.Microsoft-Azure-RelayBridge.etwManifest.dll" /> Source="$(var.Microsoft.Azure.Relay.Bridge.TargetDir)\Microsoft.Azure.Relay.Bridge.Microsoft-Azure-RelayBridge.etwManifest.dll" />
</Component> </Component>
<Component Id="etwManifest.man"> <Component Id="etwManifest.man">
<File Id="etwManifest.man" KeyPath="yes" <File Id="etwManifest.man" KeyPath="yes"
Source="$(var.Microsoft.Azure.Relay.Bridge.TargetDir)\Microsoft.Azure.Relay.Bridge.Microsoft-Azure-RelayBridge.etwManifest.man"> Source="$(var.Microsoft.Azure.Relay.Bridge.TargetDir)\Microsoft.Azure.Relay.Bridge.Microsoft-Azure-RelayBridge.etwManifest.man">
<util:EventManifest MessageFile="[etwManifest.dll]" ResourceFile="[etwManifest.dll]"></util:EventManifest> <util:EventManifest MessageFile="[etwManifest.dll]" ResourceFile="[etwManifest.dll]"></util:EventManifest>
</File> </File>
</Component> </Component>
<Component Id="Path" Guid="{bfc77cbe-3e65-4cb9-a1db-3d0b14bbe11f}" KeyPath="yes"> <Component Id="Path" Guid="{bfc77cbe-3e65-4cb9-a1db-3d0b14bbe11f}" KeyPath="yes">
<Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" /> <Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" />
<CreateFolder/> <CreateFolder/>
</Component> </Component>
</ComponentGroup> </ComponentGroup>
<Feature Id="App" Title="Command line bridge" Level="1"> <Feature Id="App" Title="Command line bridge" Level="1">
<ComponentGroupRef Id="azbridge_Project" /> <ComponentGroupRef Id="azbridge_Project" />
</Feature> </Feature>
</Fragment> </Fragment>
</Wix> </Wix>

Просмотреть файл

@ -1,105 +1,105 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Publish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Publish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\WiX.3.11.1\build\wix.props" Condition="Exists('packages\WiX.3.11.1\build\wix.props')" /> <Import Project="packages\WiX.3.11.1\build\wix.props" Condition="Exists('packages\WiX.3.11.1\build\wix.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProductVersion>3.10</ProductVersion> <ProductVersion>3.10</ProductVersion>
<ProjectGuid>{5496840b-ef30-44be-a316-0b69790ea9a3}</ProjectGuid> <ProjectGuid>{5496840b-ef30-44be-a316-0b69790ea9a3}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<OutputName>azbridge_installer</OutputName> <OutputName>azbridge_installer</OutputName>
<OutputType>Package</OutputType> <OutputType>Package</OutputType>
<AlreadyPublished>false</AlreadyPublished> <AlreadyPublished>false</AlreadyPublished>
<EnableProjectHarvesting>false</EnableProjectHarvesting> <EnableProjectHarvesting>false</EnableProjectHarvesting>
<DefineSolutionProperties>false</DefineSolutionProperties> <DefineSolutionProperties>false</DefineSolutionProperties>
<BridgePublishPath>..\azbridge\bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish</BridgePublishPath> <BridgePublishPath>..\azbridge\bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish</BridgePublishPath>
<BridgeProjectFile>..\azbridge\azbridge.csproj</BridgeProjectFile> <BridgeProjectFile>..\azbridge\azbridge.csproj</BridgeProjectFile>
<Platform Condition="'$(Platform)'=='' AND $(RuntimeIdentifier.EndsWith('x64'))">x64</Platform> <Platform Condition="'$(Platform)'=='' AND $(RuntimeIdentifier.EndsWith('x64'))">x64</Platform>
<Platform Condition="'$(Platform)'=='' AND $(RuntimeIdentifier.EndsWith('x86'))">x86</Platform> <Platform Condition="'$(Platform)'=='' AND $(RuntimeIdentifier.EndsWith('x86'))">x86</Platform>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> --> <!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> -->
<IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath> <IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
<DefineConstants>Debug;ProcessorArchitecture=x86</DefineConstants> <DefineConstants>Debug;ProcessorArchitecture=x86</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> --> <!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> -->
<IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath> <IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
<DefineConstants>ProcessorArchitecture=x86</DefineConstants> <DefineConstants>ProcessorArchitecture=x86</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> --> <!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> -->
<IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath> <IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
<DefineConstants>Debug;ProcessorArchitecture=x64</DefineConstants> <DefineConstants>Debug;ProcessorArchitecture=x64</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> --> <!-- <OutputPath>bin\$(Configuration)\$(Platform)\</OutputPath> -->
<IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath> <IntermediateOutputPath>obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
<DefineConstants>ProcessorArchitecture=x64</DefineConstants> <DefineConstants>ProcessorArchitecture=x64</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="azbridge.wxs" /> <Compile Include="azbridge.wxs" />
<Compile Include="Product.wxs" /> <Compile Include="Product.wxs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<WixExtension Include="WixUtilExtension"> <WixExtension Include="WixUtilExtension">
<Name>WixUtilExtension</Name> <Name>WixUtilExtension</Name>
</WixExtension> </WixExtension>
<WixExtension Include="WixUIExtension"> <WixExtension Include="WixUIExtension">
<Name>WixUIExtension</Name> <Name>WixUIExtension</Name>
</WixExtension> </WixExtension>
<WixExtension Include="WixNetFxExtension"> <WixExtension Include="WixNetFxExtension">
<Name>WixNetFxExtension</Name> <Name>WixNetFxExtension</Name>
</WixExtension> </WixExtension>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\azbridge\azbridge.csproj"> <ProjectReference Include="..\azbridge\azbridge.csproj">
<Name>azbridge</Name> <Name>azbridge</Name>
<Project>{ac769774-b065-41e8-b0ab-d15ed6b8d6a8}</Project> <Project>{ac769774-b065-41e8-b0ab-d15ed6b8d6a8}</Project>
<Private>True</Private> <Private>True</Private>
<DoNotHarvest> <DoNotHarvest>
</DoNotHarvest> </DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir> <RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Microsoft.Azure.Relay.Bridge\Microsoft.Azure.Relay.Bridge.csproj"> <ProjectReference Include="..\Microsoft.Azure.Relay.Bridge\Microsoft.Azure.Relay.Bridge.csproj">
<Name>Microsoft.Azure.Relay.Bridge</Name> <Name>Microsoft.Azure.Relay.Bridge</Name>
<Project>{864ae8d8-f770-499b-a9e2-46e07c8fd3d2}</Project> <Project>{864ae8d8-f770-499b-a9e2-46e07c8fd3d2}</Project>
<Private>True</Private> <Private>True</Private>
<DoNotHarvest>True</DoNotHarvest> <DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir> <RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="installTransforms.xslt" /> <Content Include="installTransforms.xslt" />
<Content Include="LICENSE.rtf" /> <Content Include="LICENSE.rtf" />
<Content Include="packages.config" /> <Content Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" /> <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target> </Target>
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
<Exec Command="dotnet publish $(BridgeProjectFile) -c $(Configuration) -f $(TargetFramework) -r $(RuntimeIdentifier)" <Exec Command="dotnet publish $(BridgeProjectFile) -c $(Configuration) -f $(TargetFramework) -r $(RuntimeIdentifier)"
Condition="'$(AlreadyPublished)'=='false'"/> Condition="'$(AlreadyPublished)'=='false'"/>
<!--<MSBuild Projects="..\azbridge\azbridge.csproj" Properties="Configuration=$(Configuration);TargetFramework=$(TargetFramework);RuntimeIdentifier=$(RuntimeIdentifier)" Targets="Publish" />--> <!--<MSBuild Projects="..\azbridge\azbridge.csproj" Properties="Configuration=$(Configuration);TargetFramework=$(TargetFramework);RuntimeIdentifier=$(RuntimeIdentifier)" Targets="Publish" />-->
<PropertyGroup> <PropertyGroup>
<LinkerBaseInputPaths>$(BridgePublishPath)</LinkerBaseInputPaths> <LinkerBaseInputPaths>$(BridgePublishPath)</LinkerBaseInputPaths>
<DefineConstants>BasePath=$(BridgePublishPath)</DefineConstants> <DefineConstants>BasePath=$(BridgePublishPath)</DefineConstants>
</PropertyGroup> </PropertyGroup>
<HeatDirectory OutputFile="azbridge.wxs" DirectoryRefId="INSTALLFOLDER" ComponentGroupName="azbridge_Project" SuppressCom="true" Directory="$(BridgePublishPath)" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" PreprocessorVariable="var.BasePath" Transforms="installTransforms.xslt" /> <HeatDirectory OutputFile="azbridge.wxs" DirectoryRefId="INSTALLFOLDER" ComponentGroupName="azbridge_Project" SuppressCom="true" Directory="$(BridgePublishPath)" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" PreprocessorVariable="var.BasePath" Transforms="installTransforms.xslt" />
</Target> </Target>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('packages\WiX.3.11.1\build\wix.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\WiX.3.11.1\build\wix.props'))" /> <Error Condition="!Exists('packages\WiX.3.11.1\build\wix.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\WiX.3.11.1\build\wix.props'))" />
</Target> </Target>
<Target Name="Publish" DependsOnTargets="Build"> <Target Name="Publish" DependsOnTargets="Build">
</Target> </Target>
<Target Name="Package"> <Target Name="Package">
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,80 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" indent="yes" /> <xsl:output method="xml" indent="yes" />
<xsl:template match="@*|node()"> <xsl:template match="@*|node()">
<xsl:copy> <xsl:copy>
<xsl:apply-templates select="@*|node()"/> <xsl:apply-templates select="@*|node()"/>
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:key name="azbridgesvc-srch" match="wix:Component[substring(wix:File/@Source, string-length(wix:File/@Source) - string-length('azbridge.exe') +1)='azbridge.exe']" use="@Id" /> <xsl:key name="azbridgesvc-srch" match="wix:Component[substring(wix:File/@Source, string-length(wix:File/@Source) - string-length('azbridge.exe') +1)='azbridge.exe']" use="@Id" />
<xsl:template match="wix:Component[key('azbridgesvc-srch', @Id)]"> <xsl:template match="wix:Component[key('azbridgesvc-srch', @Id)]">
<xsl:copy> <xsl:copy>
<xsl:copy-of select="@*"/> <xsl:copy-of select="@*"/>
<xsl:apply-templates select="*|text()" /> <xsl:apply-templates select="*|text()" />
<wix:ServiceInstall Id="InstallABS" <wix:ServiceInstall Id="InstallABS"
Name="azbridgesvc" Name="azbridgesvc"
Description="Azure Relay Bridge Service" Description="Azure Relay Bridge Service"
Start="demand" Start="demand"
ErrorControl="normal" ErrorControl="normal"
Type="ownProcess" Type="ownProcess"
Arguments="--svc" Arguments="--svc"
Vital="yes" Vital="yes"
Account="NT AUTHORITY\NETWORKSERVICE" /> Account="NT AUTHORITY\NETWORKSERVICE" />
<wix:ServiceControl Id="ControllABS" <wix:ServiceControl Id="ControllABS"
Name="azbridgesvc" Name="azbridgesvc"
Start="install" Start="install"
Stop="both" Stop="both"
Remove="uninstall" Remove="uninstall"
Wait="yes" /> Wait="yes" />
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:key name="azbridge-svc-config" match="wix:File[substring(@Source, string-length(@Source) - string-length('azbridge_config.svc.yml') +1)='azbridge_config.svc.yml']" use="@Id" /> <xsl:key name="azbridge-svc-config" match="wix:File[substring(@Source, string-length(@Source) - string-length('azbridge_config.svc.yml') +1)='azbridge_config.svc.yml']" use="@Id" />
<xsl:key name="azbridge-machine-config" match="wix:File[substring(@Source, string-length(@Source) - string-length('azbridge_config.machine.yml') +1)='azbridge_config.machine.yml']" use="@Id" /> <xsl:key name="azbridge-machine-config" match="wix:File[substring(@Source, string-length(@Source) - string-length('azbridge_config.machine.yml') +1)='azbridge_config.machine.yml']" use="@Id" />
<xsl:template match="wix:Wix/wix:Fragment[1]"> <xsl:template match="wix:Wix/wix:Fragment[1]">
<xsl:copy> <xsl:copy>
<xsl:copy-of select="@*"/> <xsl:copy-of select="@*"/>
<wix:DirectoryRef Id="CONFIGFOLDER"> <wix:DirectoryRef Id="CONFIGFOLDER">
<xsl:apply-templates select="//wix:Component/wix:File[key('azbridge-svc-config', @Id)]|//wix:Component/wix:File[key('azbridge-machine-config', @Id)]" /> <xsl:apply-templates select="//wix:Component/wix:File[key('azbridge-svc-config', @Id)]|//wix:Component/wix:File[key('azbridge-machine-config', @Id)]" />
</wix:DirectoryRef> </wix:DirectoryRef>
<xsl:apply-templates select="*|text()" /> <xsl:apply-templates select="*|text()" />
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:template match="wix:DirectoryRef[@Id='INSTALLFOLDER']"> <xsl:template match="wix:DirectoryRef[@Id='INSTALLFOLDER']">
<xsl:copy> <xsl:copy>
<xsl:copy-of select="@*"/> <xsl:copy-of select="@*"/>
<xsl:apply-templates select="*[not(self::wix:Component/wix:File[key('azbridge-svc-config', @Id)] or self::wix:Component/wix:File[key('azbridge-machine-config', @Id)])]|text()" /> <xsl:apply-templates select="*[not(self::wix:Component/wix:File[key('azbridge-svc-config', @Id)] or self::wix:Component/wix:File[key('azbridge-machine-config', @Id)])]|text()" />
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:template match="wix:Component/wix:File[key('azbridge-svc-config', @Id)]"> <xsl:template match="wix:Component/wix:File[key('azbridge-svc-config', @Id)]">
<wix:Component> <wix:Component>
<xsl:copy-of select="../@*"/> <xsl:copy-of select="../@*"/>
<xsl:copy> <xsl:copy>
<xsl:copy-of select="@*"/> <xsl:copy-of select="@*"/>
<xsl:apply-templates select="*|text()" /> <xsl:apply-templates select="*|text()" />
<wix:Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" FileAllRights="yes" /> <wix:Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" FileAllRights="yes" />
<wix:Permission User="[WIX_ACCOUNT_USERS]" GenericRead="yes" Read="yes" /> <wix:Permission User="[WIX_ACCOUNT_USERS]" GenericRead="yes" Read="yes" />
<wix:Permission User="[WIX_ACCOUNT_NETWORKSERVICE]" GenericRead="yes" Read="yes" /> <wix:Permission User="[WIX_ACCOUNT_NETWORKSERVICE]" GenericRead="yes" Read="yes" />
</xsl:copy> </xsl:copy>
</wix:Component> </wix:Component>
</xsl:template> </xsl:template>
<xsl:template match="wix:Component/wix:File[key('azbridge-machine-config', @Id)]"> <xsl:template match="wix:Component/wix:File[key('azbridge-machine-config', @Id)]">
<wix:Component> <wix:Component>
<xsl:copy-of select="../@*"/> <xsl:copy-of select="../@*"/>
<xsl:copy> <xsl:copy>
<xsl:copy-of select="@*"/> <xsl:copy-of select="@*"/>
<xsl:apply-templates select="*|text()" /> <xsl:apply-templates select="*|text()" />
<wix:Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" FileAllRights="yes" /> <wix:Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" FileAllRights="yes" />
<wix:Permission User="[WIX_ACCOUNT_USERS]" GenericRead="yes" Read="yes" /> <wix:Permission User="[WIX_ACCOUNT_USERS]" GenericRead="yes" Read="yes" />
<wix:Permission User="[WIX_ACCOUNT_NETWORKSERVICE]" GenericRead="yes" Read="yes" /> <wix:Permission User="[WIX_ACCOUNT_NETWORKSERVICE]" GenericRead="yes" Read="yes" />
</xsl:copy> </xsl:copy>
</wix:Component> </wix:Component>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="WiX" version="3.11.1" targetFramework="net462" /> <package id="WiX" version="3.11.1" targetFramework="net462" />
</packages> </packages>

Просмотреть файл

@ -1,20 +1,20 @@
REM REM
REM The WIX project MUST be built using the NETFX project format and REM The WIX project MUST be built using the NETFX project format and
REM using the 32-bit runtime and we can't use the project-embedded REM using the 32-bit runtime and we can't use the project-embedded
REM <PackageReference> format. Therefore we do a nuget package restore REM <PackageReference> format. Therefore we do a nuget package restore
REM here. This is called from the build process in the package step. REM here. This is called from the build process in the package step.
REM REM
@echo off @echo off
pushd "%~dp0" pushd "%~dp0"
if not exist ".\.nuget" mkdir ".\.nuget" if not exist ".\.nuget" mkdir ".\.nuget"
if not exist ".\.nuget\nuget.exe" powershell -Command "Invoke-WebRequest https://www.nuget.org/nuget.exe -OutFile .\.nuget\nuget.exe" if not exist ".\.nuget\nuget.exe" powershell -Command "Invoke-WebRequest https://www.nuget.org/nuget.exe -OutFile .\.nuget\nuget.exe"
if not exist ".\.nuget\nuget.config" ( if not exist ".\.nuget\nuget.config" (
echo ^<?xml version="1.0" encoding="utf-8"?^> > .\.nuget\nuget.config echo ^<?xml version="1.0" encoding="utf-8"?^> > .\.nuget\nuget.config
echo ^<configuration^>^<packageSources^> >> .\.nuget\nuget.config echo ^<configuration^>^<packageSources^> >> .\.nuget\nuget.config
echo ^<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /^> >> .\.nuget\nuget.config echo ^<add key="NuGet" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /^> >> .\.nuget\nuget.config
echo ^</packageSources^>^</configuration^> >> .\.nuget\nuget.config echo ^</packageSources^>^</configuration^> >> .\.nuget\nuget.config
) )
".nuget\NuGet.exe" restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config -Verbosity detailed ".nuget\NuGet.exe" restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config -Verbosity detailed
popd popd

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<WindowsOnly>false</WindowsOnly> <WindowsOnly>false</WindowsOnly>
<WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks> <WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks>
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp2.1</CoreFrameworks> <CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks> <TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<!-- <TargetFrameworks>$(CoreFrameworks)</TargetFrameworks> --> <!-- <TargetFrameworks>$(CoreFrameworks)</TargetFrameworks> -->
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers> <WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>
@ -124,8 +124,6 @@
<RpmDependency Include="krb5-libs" Version="" /> <RpmDependency Include="krb5-libs" Version="" />
<RpmDependency Include="libicu" Version="" /> <RpmDependency Include="libicu" Version="" />
<RpmDependency Include="zlib" Version="" /> <RpmDependency Include="zlib" Version="" />
<RpmDependency Include="libunwind" Version="" Condition="'$(TargetFramework)'=='netcoreapp2.0'" />
<RpmDependency Include="libuuid" Version="" Condition="'$(TargetFramework)'=='netcoreapp2.0'" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))"> <ItemGroup Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))">
@ -138,8 +136,6 @@
<DebDependency Include="libicu55" Version="" Condition="'$(RuntimeIdentifier)'=='ubuntu.16'" /> <DebDependency Include="libicu55" Version="" Condition="'$(RuntimeIdentifier)'=='ubuntu.16'" />
<DebDependency Include="libicu57" Version="" Condition="'$(RuntimeIdentifier)'=='debian.9' OR '$(RuntimeIdentifier)'=='ubuntu.17' OR '$(RuntimeIdentifier)'=='linuxmint.17'" /> <DebDependency Include="libicu57" Version="" Condition="'$(RuntimeIdentifier)'=='debian.9' OR '$(RuntimeIdentifier)'=='ubuntu.17' OR '$(RuntimeIdentifier)'=='linuxmint.17'" />
<DebDependency Include="libicu60" Version="" Condition="'$(RuntimeIdentifier)'=='debian.10' OR '$(RuntimeIdentifier)'=='ubuntu.18' OR '$(RuntimeIdentifier)'=='linuxmint.18'" /> <DebDependency Include="libicu60" Version="" Condition="'$(RuntimeIdentifier)'=='debian.10' OR '$(RuntimeIdentifier)'=='ubuntu.18' OR '$(RuntimeIdentifier)'=='linuxmint.18'" />
<DebDependency Include="libunwind8" Version="" Condition="'$(TargetFramework)'=='netcoreapp2.0'" />
<DebDependency Include="libuuid1" Version="" Condition="'$(TargetFramework)'=='netcoreapp2.0'" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))"> <PropertyGroup Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))">
@ -188,13 +184,13 @@
<Target Name="PackageZip" DependsOnTargets="CreateZip" Condition="$(RuntimeIdentifier.EndsWith($(PlatformTarget)))"> <Target Name="PackageZip" DependsOnTargets="CreateZip" Condition="$(RuntimeIdentifier.EndsWith($(PlatformTarget)))">
<Copy SourceFiles="$(ZipPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" /> <Copy SourceFiles="$(ZipPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target> </Target>
<Target Name="PackageTarball" DependsOnTargets="CreateTarball" Condition="('$(TargetFramework)' == 'netcoreapp2.0' OR '$(TargetFramework)' == 'netcoreapp2.1') AND $(UnixRuntimeIdentifiers.Contains($(RuntimeIdentifier)))"> <Target Name="PackageTarball" DependsOnTargets="CreateTarball" Condition="('$(TargetFramework)' == 'netcoreapp3.0') AND $(UnixRuntimeIdentifiers.Contains($(RuntimeIdentifier)))">
<Copy SourceFiles="$(TarballPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" /> <Copy SourceFiles="$(TarballPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target> </Target>
<Target Name="PackageDebian" DependsOnTargets="CreateDeb" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp2.0' OR '$(TargetFramework)' == 'netcoreapp2.1') AND ($(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('linuxmint')))"> <Target Name="PackageDebian" DependsOnTargets="CreateDeb" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp3.0') AND ($(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('linuxmint')))">
<Copy SourceFiles="$(DebPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" /> <Copy SourceFiles="$(DebPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target> </Target>
<Target Name="PackageRpm" DependsOnTargets="CreateRpm" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp2.0' OR '$(TargetFramework)' == 'netcoreapp2.1') AND ($(RuntimeIdentifier.StartsWith('rhel')) OR $(RuntimeIdentifier.StartsWith('centos')) OR $(RuntimeIdentifier.StartsWith('fedora')) OR $(RuntimeIdentifier.StartsWith('opensuse')) OR $(RuntimeIdentifier.StartsWith('ol')))"> <Target Name="PackageRpm" DependsOnTargets="CreateRpm" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp3.0') AND ($(RuntimeIdentifier.StartsWith('rhel')) OR $(RuntimeIdentifier.StartsWith('centos')) OR $(RuntimeIdentifier.StartsWith('fedora')) OR $(RuntimeIdentifier.StartsWith('opensuse')) OR $(RuntimeIdentifier.StartsWith('ol')))">
<Copy SourceFiles="$(RpmPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" /> <Copy SourceFiles="$(RpmPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target> </Target>
<Target Name="PackageWindows" DependsOnTargets="Publish" Condition="'$(OS)' == 'Windows_NT' AND '$(TargetFramework)' == 'net462' AND $(RuntimeIdentifier.StartsWith('win')) AND $(RuntimeIdentifier.EndsWith($(PlatformTarget)))"> <Target Name="PackageWindows" DependsOnTargets="Publish" Condition="'$(OS)' == 'Windows_NT' AND '$(TargetFramework)' == 'net462' AND $(RuntimeIdentifier.StartsWith('win')) AND $(RuntimeIdentifier.EndsWith($(PlatformTarget)))">
@ -208,7 +204,7 @@
<Exec Command="&quot;$(MSBuildToolsPath32)\msbuild&quot; ../azbridge-installer/azbridge-installer.wixproj /t:Publish /p:TargetFramework=$(TargetFramework);RuntimeIdentifier=$(RuntimeIdentifier);BridgeProjectFile=$(MSBuildProjectFullPath);BridgePublishPath=$(MSBuildProjectDirectory)\$(PublishDir);OutputPath=$(MSBuildProjectDirectory)\$(MsiDir);OutputName=$(_OutputName);AlreadyPublished=true" /> <Exec Command="&quot;$(MSBuildToolsPath32)\msbuild&quot; ../azbridge-installer/azbridge-installer.wixproj /t:Publish /p:TargetFramework=$(TargetFramework);RuntimeIdentifier=$(RuntimeIdentifier);BridgeProjectFile=$(MSBuildProjectFullPath);BridgePublishPath=$(MSBuildProjectDirectory)\$(PublishDir);OutputPath=$(MSBuildProjectDirectory)\$(MsiDir);OutputName=$(_OutputName);AlreadyPublished=true" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(MsiDir)\$(_OutputName).msi" DestinationFolder="$(BuildDir)/$(TargetFramework)" /> <Copy SourceFiles="$(MSBuildProjectDirectory)\$(MsiDir)\$(_OutputName).msi" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target> </Target>
<Target Name="PackageOSX" DependsOnTargets="Publish" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp2.0' OR '$(TargetFramework)' == 'netcoreapp2.1') AND ($(RuntimeIdentifier.StartsWith('osx')))"> <Target Name="PackageOSX" DependsOnTargets="Publish" Condition="'$(OS)' == 'Unix' AND ('$(TargetFramework)' == 'netcoreapp3.0') AND ($(RuntimeIdentifier.StartsWith('osx')))">
</Target> </Target>
<Target Name="PublishPackages" DependsOnTargets="PackageDebian;PackageRpm;PackageWindows;PackageOSX;PackageZip;PackageTarball" Condition=" '$(RuntimeIdentifier)' != ''"> <Target Name="PublishPackages" DependsOnTargets="PackageDebian;PackageRpm;PackageWindows;PackageOSX;PackageZip;PackageTarball" Condition=" '$(RuntimeIdentifier)' != ''">

Просмотреть файл

@ -1,8 +1,8 @@
[Unit] [Unit]
Description=Azure Relay Bridge Description=Azure Relay Bridge
[Service] [Service]
ExecStart=/usr/shared/azbridge ExecStart=/usr/shared/azbridge
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

Просмотреть файл

@ -1,103 +1,103 @@
# Azure Relay Bridge Configuration # Azure Relay Bridge Configuration
# Specifies which address family to use when connecting. Valid # Specifies which address family to use when connecting. Valid
# arguments are "any", "inet" (use IPv4 only), or "inet6" # arguments are "any", "inet" (use IPv4 only), or "inet6"
# (use IPv6 only). The default is "any". # (use IPv6 only). The default is "any".
AddressFamily : AddressFamily :
# Azure Relay connection string for a Relay namespace. Only one # Azure Relay connection string for a Relay namespace. Only one
# namespace connection string can be specified per configuration # namespace connection string can be specified per configuration
# file. # file.
AzureRelayConnectionString : AzureRelayConnectionString :
# Azure Relay endpoint URI for a Relay namespace. Overrides # Azure Relay endpoint URI for a Relay namespace. Overrides
# the 'Endpoint' property of the connection string, if present. # the 'Endpoint' property of the connection string, if present.
AzureRelayEndpoint : AzureRelayEndpoint :
# Azure Relay shared access policy name. Overrides the 'SharedAccessKeyName' # Azure Relay shared access policy name. Overrides the 'SharedAccessKeyName'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessKeyName : AzureRelaySharedAccessKeyName :
# Azure Relay shared access policy key. Overrides the 'SharedAccessKey' # Azure Relay shared access policy key. Overrides the 'SharedAccessKey'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessKey : AzureRelaySharedAccessKey :
# Azure Relay shared access policy signature. Overrides the 'SharedAccessSignature' # Azure Relay shared access policy signature. Overrides the 'SharedAccessSignature'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessSignature : AzureRelaySharedAccessSignature :
# Use the specified address on the local machine as the source # Use the specified address on the local machine as the source
# address of the connection. Only useful on systems with more than # address of the connection. Only useful on systems with more than
# one address. # one address.
BindAddress : BindAddress :
# Specifies that all local, and remote port forwardings # Specifies that all local, and remote port forwardings
# specified in the configuration files or on the command line be # specified in the configuration files or on the command line be
# cleared. This option is primarily useful when used from the # cleared. This option is primarily useful when used from the
# command line to clear port forwardings set in configura- # command line to clear port forwardings set in configura-
# tion files. The argument must be "true" or "false". The default is "false". # tion files. The argument must be "true" or "false". The default is "false".
ClearAllForwardings : ClearAllForwardings :
# Specifies the number of tries (one per second) to make # Specifies the number of tries (one per second) to make
# before exiting. The argument must be an integer. This may be useful in scripts # before exiting. The argument must be an integer. This may be useful in scripts
# if the connection sometimes fails. The default is 1. # if the connection sometimes fails. The default is 1.
ConnectionAttempts : ConnectionAttempts :
# Specifies the timeout (in seconds) used when connecting to the # Specifies the timeout (in seconds) used when connecting to the
# relay server, instead of using the default system TCP timeout. # relay server, instead of using the default system TCP timeout.
# This value is used only when the target is down or really # This value is used only when the target is down or really
# unreachable, not when it refuses the connection. # unreachable, not when it refuses the connection.
ConnectTimeout : ConnectTimeout :
# Specifies whether azbridge(1) should terminate the # Specifies whether azbridge(1) should terminate the
# connection if it cannot set up all requested local, and remote port forwardings, # connection if it cannot set up all requested local, and remote port forwardings,
# (e.g. if either end is unable to bind and listen on a specified port). # (e.g. if either end is unable to bind and listen on a specified port).
# The argument must be "true" or "false". The default is "false". # The argument must be "true" or "false". The default is "false".
ExitOnForwardFailure : ExitOnForwardFailure :
# Specifies whether remote hosts are allowed to connect to local # Specifies whether remote hosts are allowed to connect to local
# forwarded ports. By default, azbridge(1) binds local port forwardings # forwarded ports. By default, azbridge(1) binds local port forwardings
# to the loopback address. This prevents other remote hosts from # to the loopback address. This prevents other remote hosts from
# connecting to forwarded ports. GatewayPorts can be used to specify that azbridge # connecting to forwarded ports. GatewayPorts can be used to specify that azbridge
# should bind local port forwardings to the wildcard address, thus allowing remote # should bind local port forwardings to the wildcard address, thus allowing remote
# hosts to connect to forwarded ports. The argument must be "true" or "false". # hosts to connect to forwarded ports. The argument must be "true" or "false".
# The default is "false". # The default is "false".
GatewayPorts : GatewayPorts :
# Specifies that a (set of) TCP ports on the local machine # Specifies that a (set of) TCP ports on the local machine
# shall be forwarded via the Azure Relay. Each entry can have four properties, # shall be forwarded via the Azure Relay. Each entry can have four properties,
# "BindAddress", "BindPort", "LocalSocket", and "RelayName". # "BindAddress", "BindPort", "LocalSocket", and "RelayName".
LocalForward : LocalForward :
# - BindAddress: 127.0.8.1 # - BindAddress: 127.0.8.1
# BindPort: 443 # BindPort: 443
# RelayName: a1 # RelayName: a1
# Gives the verbosity level that is used when logging messages # Gives the verbosity level that is used when logging messages
# from azbridge(1). The possible values are : QUIET, FATAL, ERROR, INFO, VERBOSE, # from azbridge(1). The possible values are : QUIET, FATAL, ERROR, INFO, VERBOSE,
# DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. # DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
# DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify # DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify
# higher levels of verbose output. # higher levels of verbose output.
LogLevel : ERROR LogLevel : ERROR
# Specifies that a TCP port on the remote machine be bound to # Specifies that a TCP port on the remote machine be bound to
# a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host", # a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host",
# "HostPort", and "LocalSocket". # "HostPort", and "LocalSocket".
RemoteForward : RemoteForward :
# - RelayName: a1 # - RelayName: a1
# Host: localhost # Host: localhost
# HostPort: 443 # HostPort: 443

Просмотреть файл

@ -1,103 +1,103 @@
# Azure Relay Bridge Configuration # Azure Relay Bridge Configuration
# Specifies which address family to use when connecting. Valid # Specifies which address family to use when connecting. Valid
# arguments are "any", "inet" (use IPv4 only), or "inet6" # arguments are "any", "inet" (use IPv4 only), or "inet6"
# (use IPv6 only). The default is "any". # (use IPv6 only). The default is "any".
AddressFamily : AddressFamily :
# Azure Relay connection string for a Relay namespace. Only one # Azure Relay connection string for a Relay namespace. Only one
# namespace connection string can be specified per configuration # namespace connection string can be specified per configuration
# file. # file.
AzureRelayConnectionString : AzureRelayConnectionString :
# Azure Relay endpoint URI for a Relay namespace. Overrides # Azure Relay endpoint URI for a Relay namespace. Overrides
# the 'Endpoint' property of the connection string, if present. # the 'Endpoint' property of the connection string, if present.
AzureRelayEndpoint : AzureRelayEndpoint :
# Azure Relay shared access policy name. Overrides the 'SharedAccessKeyName' # Azure Relay shared access policy name. Overrides the 'SharedAccessKeyName'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessKeyName : AzureRelaySharedAccessKeyName :
# Azure Relay shared access policy key. Overrides the 'SharedAccessKey' # Azure Relay shared access policy key. Overrides the 'SharedAccessKey'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessKey : AzureRelaySharedAccessKey :
# Azure Relay shared access policy signature. Overrides the 'SharedAccessSignature' # Azure Relay shared access policy signature. Overrides the 'SharedAccessSignature'
# property of the connection string, if present. # property of the connection string, if present.
AzureRelaySharedAccessSignature : AzureRelaySharedAccessSignature :
# Use the specified address on the local machine as the source # Use the specified address on the local machine as the source
# address of the connection. Only useful on systems with more than # address of the connection. Only useful on systems with more than
# one address. # one address.
BindAddress : BindAddress :
# Specifies that all local, and remote port forwardings # Specifies that all local, and remote port forwardings
# specified in the configuration files or on the command line be # specified in the configuration files or on the command line be
# cleared. This option is primarily useful when used from the # cleared. This option is primarily useful when used from the
# command line to clear port forwardings set in configura- # command line to clear port forwardings set in configura-
# tion files. The argument must be "true" or "false". The default is "false". # tion files. The argument must be "true" or "false". The default is "false".
ClearAllForwardings : ClearAllForwardings :
# Specifies the number of tries (one per second) to make # Specifies the number of tries (one per second) to make
# before exiting. The argument must be an integer. This may be useful in scripts # before exiting. The argument must be an integer. This may be useful in scripts
# if the connection sometimes fails. The default is 1. # if the connection sometimes fails. The default is 1.
ConnectionAttempts : ConnectionAttempts :
# Specifies the timeout (in seconds) used when connecting to the # Specifies the timeout (in seconds) used when connecting to the
# relay server, instead of using the default system TCP timeout. # relay server, instead of using the default system TCP timeout.
# This value is used only when the target is down or really # This value is used only when the target is down or really
# unreachable, not when it refuses the connection. # unreachable, not when it refuses the connection.
ConnectTimeout : ConnectTimeout :
# Specifies whether azbridge(1) should terminate the # Specifies whether azbridge(1) should terminate the
# connection if it cannot set up all requested local, and remote port forwardings, # connection if it cannot set up all requested local, and remote port forwardings,
# (e.g. if either end is unable to bind and listen on a specified port). # (e.g. if either end is unable to bind and listen on a specified port).
# The argument must be "true" or "false". The default is "false". # The argument must be "true" or "false". The default is "false".
ExitOnForwardFailure : ExitOnForwardFailure :
# Specifies whether remote hosts are allowed to connect to local # Specifies whether remote hosts are allowed to connect to local
# forwarded ports. By default, azbridge(1) binds local port forwardings # forwarded ports. By default, azbridge(1) binds local port forwardings
# to the loopback address. This prevents other remote hosts from # to the loopback address. This prevents other remote hosts from
# connecting to forwarded ports. GatewayPorts can be used to specify that azbridge # connecting to forwarded ports. GatewayPorts can be used to specify that azbridge
# should bind local port forwardings to the wildcard address, thus allowing remote # should bind local port forwardings to the wildcard address, thus allowing remote
# hosts to connect to forwarded ports. The argument must be "true" or "false". # hosts to connect to forwarded ports. The argument must be "true" or "false".
# The default is "false". # The default is "false".
GatewayPorts : GatewayPorts :
# Specifies that a (set of) TCP ports on the local machine # Specifies that a (set of) TCP ports on the local machine
# shall be forwarded via the Azure Relay. Each entry can have four properties, # shall be forwarded via the Azure Relay. Each entry can have four properties,
# "BindAddress", "BindPort", "LocalSocket", and "RelayName". # "BindAddress", "BindPort", "LocalSocket", and "RelayName".
LocalForward : LocalForward :
# - BindAddress: 127.0.8.1 # - BindAddress: 127.0.8.1
# BindPort: 443 # BindPort: 443
# RelayName: a1 # RelayName: a1
# Gives the verbosity level that is used when logging messages # Gives the verbosity level that is used when logging messages
# from azbridge(1). The possible values are : QUIET, FATAL, ERROR, INFO, VERBOSE, # from azbridge(1). The possible values are : QUIET, FATAL, ERROR, INFO, VERBOSE,
# DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO. # DEBUG, DEBUG1, DEBUG2, and DEBUG3. The default is INFO.
# DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify # DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify
# higher levels of verbose output. # higher levels of verbose output.
LogLevel : ERROR LogLevel : ERROR
# Specifies that a TCP port on the remote machine be bound to # Specifies that a TCP port on the remote machine be bound to
# a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host", # a name on the Azure Relay. Each entry can have four properties, "RelayName", "Host",
# "HostPort", and "LocalSocket". # "HostPort", and "LocalSocket".
RemoteForward : RemoteForward :
# - RelayName: a1 # - RelayName: a1
# Host: localhost # Host: localhost
# HostPort: 443 # HostPort: 443

Просмотреть файл

@ -1,300 +1,300 @@
<# <#
.DESCRIPTION .DESCRIPTION
The hosts file is used to map hostnames to IP addresses. The hosts file is used to map hostnames to IP addresses.
.PARAMETER IPAddress .PARAMETER IPAddress
The IP address to map the hostname(s) to. The IP address to map the hostname(s) to.
.PARAMETER Hostnames .PARAMETER Hostnames
One or more hostnames to map to the specified IP address. One or more hostnames to map to the specified IP address.
.PARAMETER Comment .PARAMETER Comment
Optional comment that is written above the new hosts entry. Optional comment that is written above the new hosts entry.
.EXAMPLE .EXAMPLE
.\Add-Hostnames.ps1 127.0.0.1 foobar .\Add-Hostnames.ps1 127.0.0.1 foobar
Description Description
----------- -----------
Adds the following line to the hosts file (assuming "foobar" does not already Adds the following line to the hosts file (assuming "foobar" does not already
exist in the hosts file): exist in the hosts file):
127.0.0.1 foobar 127.0.0.1 foobar
A warning is displayed if "foobar" already exists in the hosts file and is A warning is displayed if "foobar" already exists in the hosts file and is
mapped to the specified IP address. An error occurs if "foobar" is already mapped to the specified IP address. An error occurs if "foobar" is already
mapped to a different IP address. mapped to a different IP address.
.EXAMPLE .EXAMPLE
.\Add-Hostnames.ps1 127.0.0.1 foo, bar "This is a comment" .\Add-Hostnames.ps1 127.0.0.1 foo, bar "This is a comment"
Description Description
----------- -----------
Adds the following lines to the hosts file (assuming "foo" and "bar" do not Adds the following lines to the hosts file (assuming "foo" and "bar" do not
already exist in the hosts file): already exist in the hosts file):
# This is a comment # This is a comment
127.0.0.1 foo bar 127.0.0.1 foo bar
A warning is displayed if either "foo" or "bar" already exists in the hosts A warning is displayed if either "foo" or "bar" already exists in the hosts
file and is mapped to the specified IP address. An error occurs if "foo" or file and is mapped to the specified IP address. An error occurs if "foo" or
"bar" is already mapped to a different IP address. "bar" is already mapped to a different IP address.
.NOTES .NOTES
This script must be run with administrator privileges. This script must be run with administrator privileges.
#> #>
param( param(
[parameter(Mandatory = $true)] [parameter(Mandatory = $true)]
[string] $IPAddress, [string] $IPAddress,
[parameter(Mandatory = $true, ValueFromPipeline = $true)] [parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string[]] $Hostnames, [string[]] $Hostnames,
[string] $Comment [string] $Comment
) )
begin begin
{ {
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
function CreateHostsEntryObject( function CreateHostsEntryObject(
[string] $ipAddress, [string] $ipAddress,
[string[]] $hostnames, [string[]] $hostnames,
<# [string] #> $comment) #HACK: never $null if type is specified <# [string] #> $comment) #HACK: never $null if type is specified
{ {
$hostsEntry = New-Object PSObject $hostsEntry = New-Object PSObject
$hostsEntry | Add-Member NoteProperty -Name "IpAddress" ` $hostsEntry | Add-Member NoteProperty -Name "IpAddress" `
-Value $ipAddress -Value $ipAddress
[System.Collections.ArrayList] $hostnamesList = [System.Collections.ArrayList] $hostnamesList =
New-Object System.Collections.ArrayList New-Object System.Collections.ArrayList
$hostsEntry | Add-Member NoteProperty -Name "Hostnames" ` $hostsEntry | Add-Member NoteProperty -Name "Hostnames" `
-Value $hostnamesList -Value $hostnamesList
If ($hostnames -ne $null) If ($hostnames -ne $null)
{ {
$hostnames | foreach { $hostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
$hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment $hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment
return $hostsEntry return $hostsEntry
} }
function ParseHostsEntry( function ParseHostsEntry(
[string] $line) [string] $line)
{ {
$hostsEntry = CreateHostsEntryObject $hostsEntry = CreateHostsEntryObject
Write-Debug "Parsing hosts entry: $line" Write-Debug "Parsing hosts entry: $line"
If ($line.Contains("#") -eq $true) If ($line.Contains("#") -eq $true)
{ {
If ($line -eq "#") If ($line -eq "#")
{ {
$hostsEntry.Comment = [string]::Empty $hostsEntry.Comment = [string]::Empty
} }
Else Else
{ {
$hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1) $hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1)
} }
$line = $line.Substring(0, $line.IndexOf("#")) $line = $line.Substring(0, $line.IndexOf("#"))
} }
$line = $line.Trim() $line = $line.Trim()
If ($line.Length -gt 0) If ($line.Length -gt 0)
{ {
$hostsEntry.IpAddress = ($line -Split "\s+")[0] $hostsEntry.IpAddress = ($line -Split "\s+")[0]
Write-Debug "Parsed address: $($hostsEntry.IpAddress)" Write-Debug "Parsed address: $($hostsEntry.IpAddress)"
[string[]] $parsedHostnames = $line.Substring( [string[]] $parsedHostnames = $line.Substring(
$hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+" $hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+"
Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" ` Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" `
+ " $parsedHostnames") + " $parsedHostnames")
$parsedHostnames | foreach { $parsedHostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
return $hostsEntry return $hostsEntry
} }
function ParseHostsFile function ParseHostsFile
{ {
$hostsEntries = New-Object System.Collections.ArrayList $hostsEntries = New-Object System.Collections.ArrayList
[string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts" [string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts"
If ((Test-Path $hostsFile) -eq $false) If ((Test-Path $hostsFile) -eq $false)
{ {
Write-Verbose "Hosts file does not exist." Write-Verbose "Hosts file does not exist."
} }
Else Else
{ {
[string[]] $hostsContent = Get-Content $hostsFile [string[]] $hostsContent = Get-Content $hostsFile
$hostsContent | foreach { $hostsContent | foreach {
$hostsEntry = ParseHostsEntry $_ $hostsEntry = ParseHostsEntry $_
$hostsEntries.Add($hostsEntry) | Out-Null $hostsEntries.Add($hostsEntry) | Out-Null
} }
} }
# HACK: Return an array (containing the ArrayList) to avoid issue with # HACK: Return an array (containing the ArrayList) to avoid issue with
# PowerShell returning $null (when hosts file does not exist) # PowerShell returning $null (when hosts file does not exist)
return ,$hostsEntries return ,$hostsEntries
} }
function UpdateHostsFile( function UpdateHostsFile(
$hostsEntries = $(Throw "Value cannot be null: hostsEntries")) $hostsEntries = $(Throw "Value cannot be null: hostsEntries"))
{ {
Write-Verbose "Updatings hosts file..." Write-Verbose "Updatings hosts file..."
[string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts" [string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts"
$buffer = New-Object System.Text.StringBuilder $buffer = New-Object System.Text.StringBuilder
$hostsEntries | foreach { $hostsEntries | foreach {
If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false) If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false)
{ {
$buffer.Append($_.IpAddress) | Out-Null $buffer.Append($_.IpAddress) | Out-Null
$buffer.Append("`t") | Out-Null $buffer.Append("`t") | Out-Null
} }
If ($_.Hostnames -ne $null) If ($_.Hostnames -ne $null)
{ {
[bool] $firstHostname = $true [bool] $firstHostname = $true
$_.Hostnames | foreach { $_.Hostnames | foreach {
If ($firstHostname -eq $false) If ($firstHostname -eq $false)
{ {
$buffer.Append(" ") | Out-Null $buffer.Append(" ") | Out-Null
} }
Else Else
{ {
$firstHostname = $false $firstHostname = $false
} }
$buffer.Append($_) | Out-Null $buffer.Append($_) | Out-Null
} }
} }
If ($_.Comment -ne $null) If ($_.Comment -ne $null)
{ {
If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false) If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false)
{ {
$buffer.Append(" ") | Out-Null $buffer.Append(" ") | Out-Null
} }
$buffer.Append("#") | Out-Null $buffer.Append("#") | Out-Null
$buffer.Append($_.Comment) | Out-Null $buffer.Append($_.Comment) | Out-Null
} }
$buffer.Append([System.Environment]::NewLine) | Out-Null $buffer.Append([System.Environment]::NewLine) | Out-Null
} }
[string] $hostsContent = $buffer.ToString() [string] $hostsContent = $buffer.ToString()
$hostsContent = $hostsContent.Trim() $hostsContent = $hostsContent.Trim()
Set-Content -Path $hostsFile -Value $hostsContent -Force -Encoding ASCII Set-Content -Path $hostsFile -Value $hostsContent -Force -Encoding ASCII
Write-Verbose "Successfully updated hosts file." Write-Verbose "Successfully updated hosts file."
} }
[bool] $isInputFromPipeline = [bool] $isInputFromPipeline =
($PSBoundParameters.ContainsKey("Hostnames") -eq $false) ($PSBoundParameters.ContainsKey("Hostnames") -eq $false)
[int] $pendingUpdates = 0 [int] $pendingUpdates = 0
[Collections.ArrayList] $hostsEntries = ParseHostsFile [Collections.ArrayList] $hostsEntries = ParseHostsFile
} }
process process
{ {
If ($isInputFromPipeline -eq $true) If ($isInputFromPipeline -eq $true)
{ {
$items = $_ $items = $_
} }
Else Else
{ {
$items = $Hostnames $items = $Hostnames
} }
$newHostsEntry = CreateHostsEntryObject $IpAddress $newHostsEntry = CreateHostsEntryObject $IpAddress
$hostsEntries.Add($newHostsEntry) | Out-Null $hostsEntries.Add($newHostsEntry) | Out-Null
$items | foreach { $items | foreach {
[string] $hostname = $_ [string] $hostname = $_
[bool] $isHostnameInHostsEntries = $false [bool] $isHostnameInHostsEntries = $false
for ([int] $i = 0; $i -lt $hostsEntries.Count; $i++) for ([int] $i = 0; $i -lt $hostsEntries.Count; $i++)
{ {
$hostsEntry = $hostsEntries[$i] $hostsEntry = $hostsEntries[$i]
Write-Debug "Hosts entry: $hostsEntry" Write-Debug "Hosts entry: $hostsEntry"
If ($hostsEntry.Hostnames.Count -eq 0) If ($hostsEntry.Hostnames.Count -eq 0)
{ {
continue continue
} }
for ([int] $j = 0; $j -lt $hostsEntry.Hostnames.Count; $j++) for ([int] $j = 0; $j -lt $hostsEntry.Hostnames.Count; $j++)
{ {
[string] $parsedHostname = $hostsEntry.Hostnames[$j] [string] $parsedHostname = $hostsEntry.Hostnames[$j]
Write-Debug ("Comparing specified hostname" ` Write-Debug ("Comparing specified hostname" `
+ " ($hostname) to existing hostname" ` + " ($hostname) to existing hostname" `
+ " ($parsedHostname)...") + " ($parsedHostname)...")
If ([string]::Compare($hostname, $parsedHostname, $true) -eq 0) If ([string]::Compare($hostname, $parsedHostname, $true) -eq 0)
{ {
$isHostnameInHostsEntries = $true $isHostnameInHostsEntries = $true
If ($ipAddress -ne $hostsEntry.IpAddress) If ($ipAddress -ne $hostsEntry.IpAddress)
{ {
Throw "The hosts file already contains the" ` Throw "The hosts file already contains the" `
+ " specified hostname ($parsedHostname) and it is" ` + " specified hostname ($parsedHostname) and it is" `
+ " mapped to a different address" ` + " mapped to a different address" `
+ " ($($hostsEntry.IpAddress))." + " ($($hostsEntry.IpAddress))."
} }
Write-Verbose ("The hosts file already contains the" ` Write-Verbose ("The hosts file already contains the" `
+ " specified hostname ($($hostsEntry.IpAddress) $parsedHostname).") + " specified hostname ($($hostsEntry.IpAddress) $parsedHostname).")
} }
} }
} }
If ($isHostnameInHostsEntries -eq $false) If ($isHostnameInHostsEntries -eq $false)
{ {
Write-Debug ("Adding hostname ($hostname) to hosts entry...") Write-Debug ("Adding hostname ($hostname) to hosts entry...")
$newHostsEntry.Hostnames.Add($hostname) | Out-Null $newHostsEntry.Hostnames.Add($hostname) | Out-Null
$pendingUpdates++ $pendingUpdates++
} }
} }
} }
end end
{ {
If ($pendingUpdates -eq 0) If ($pendingUpdates -eq 0)
{ {
Write-Verbose "No changes to the hosts file are necessary." Write-Verbose "No changes to the hosts file are necessary."
return return
} }
Write-Verbose ("There are $pendingUpdates pending update(s) to the hosts" ` Write-Verbose ("There are $pendingUpdates pending update(s) to the hosts" `
+ " file.") + " file.")
UpdateHostsFile $hostsEntries UpdateHostsFile $hostsEntries
} }

Просмотреть файл

@ -1,136 +1,136 @@
<# <#
.SYNOPSIS .SYNOPSIS
Gets the hostnames (and corresponding IP addresses) specified in the hosts file. Gets the hostnames (and corresponding IP addresses) specified in the hosts file.
.DESCRIPTION .DESCRIPTION
The hosts file is used to map hostnames to IP addresses. The hosts file is used to map hostnames to IP addresses.
.EXAMPLE .EXAMPLE
.\Get-HostNames.ps1 .\Get-HostNames.ps1
IpAddress Hostname IpAddress Hostname
--------- -------- --------- --------
127.0.0.1 localhost 127.0.0.1 localhost
127.0.0.1 zurich-ac-portal-test.dnsdemo1.com # Added by HybridConnectionClient 127.0.0.1 zurich-ac-portal-test.dnsdemo1.com # Added by HybridConnectionClient
#> #>
begin begin
{ {
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
function CreateHostsEntryObject( function CreateHostsEntryObject(
[string] $ipAddress, [string] $ipAddress,
[string[]] $hostnames, [string[]] $hostnames,
<# [string] #> $comment) #HACK: never $null if type is specified <# [string] #> $comment) #HACK: never $null if type is specified
{ {
$hostsEntry = New-Object PSObject $hostsEntry = New-Object PSObject
$hostsEntry | Add-Member NoteProperty -Name "IpAddress" ` $hostsEntry | Add-Member NoteProperty -Name "IpAddress" `
-Value $ipAddress -Value $ipAddress
[System.Collections.ArrayList] $hostnamesList = [System.Collections.ArrayList] $hostnamesList =
New-Object System.Collections.ArrayList New-Object System.Collections.ArrayList
$hostsEntry | Add-Member NoteProperty -Name "Hostnames" ` $hostsEntry | Add-Member NoteProperty -Name "Hostnames" `
-Value $hostnamesList -Value $hostnamesList
If ($hostnames -ne $null) If ($hostnames -ne $null)
{ {
$hostnames | foreach { $hostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
$hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment $hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment
return $hostsEntry return $hostsEntry
} }
function ParseHostsEntry( function ParseHostsEntry(
[string] $line) [string] $line)
{ {
$hostsEntry = CreateHostsEntryObject $hostsEntry = CreateHostsEntryObject
Write-Debug "Parsing hosts entry: $line" Write-Debug "Parsing hosts entry: $line"
If ($line.Contains("#") -eq $true) If ($line.Contains("#") -eq $true)
{ {
If ($line -eq "#") If ($line -eq "#")
{ {
$hostsEntry.Comment = [string]::Empty $hostsEntry.Comment = [string]::Empty
} }
Else Else
{ {
$hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1) $hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1)
} }
$line = $line.Substring(0, $line.IndexOf("#")) $line = $line.Substring(0, $line.IndexOf("#"))
} }
$line = $line.Trim() $line = $line.Trim()
If ($line.Length -gt 0) If ($line.Length -gt 0)
{ {
$hostsEntry.IpAddress = ($line -Split "\s+")[0] $hostsEntry.IpAddress = ($line -Split "\s+")[0]
Write-Debug "Parsed address: $($hostsEntry.IpAddress)" Write-Debug "Parsed address: $($hostsEntry.IpAddress)"
[string[]] $parsedHostnames = $line.Substring( [string[]] $parsedHostnames = $line.Substring(
$hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+" $hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+"
Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" ` Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" `
+ " $parsedHostnames") + " $parsedHostnames")
$parsedHostnames | foreach { $parsedHostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
return $hostsEntry return $hostsEntry
} }
function ParseHostsFile function ParseHostsFile
{ {
$hostsEntries = New-Object System.Collections.ArrayList $hostsEntries = New-Object System.Collections.ArrayList
[string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts" [string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts"
If ((Test-Path $hostsFile) -eq $false) If ((Test-Path $hostsFile) -eq $false)
{ {
Write-Verbose "Hosts file does not exist." Write-Verbose "Hosts file does not exist."
} }
Else Else
{ {
[string[]] $hostsContent = Get-Content $hostsFile [string[]] $hostsContent = Get-Content $hostsFile
$hostsContent | foreach { $hostsContent | foreach {
$hostsEntry = ParseHostsEntry $_ $hostsEntry = ParseHostsEntry $_
$hostsEntries.Add($hostsEntry) | Out-Null $hostsEntries.Add($hostsEntry) | Out-Null
} }
} }
# HACK: Return an array (containing the ArrayList) to avoid issue with # HACK: Return an array (containing the ArrayList) to avoid issue with
# PowerShell returning $null (when hosts file does not exist) # PowerShell returning $null (when hosts file does not exist)
return ,$hostsEntries return ,$hostsEntries
} }
[Collections.ArrayList] $hostsEntries = ParseHostsFile [Collections.ArrayList] $hostsEntries = ParseHostsFile
} }
process process
{ {
$hostsEntries | foreach { $hostsEntries | foreach {
$hostsEntry = $_ $hostsEntry = $_
$hostsEntry.Hostnames | foreach { $hostsEntry.Hostnames | foreach {
$properties = @{ $properties = @{
Hostname = $_ Hostname = $_
IpAddress = $hostsEntry.IpAddress IpAddress = $hostsEntry.IpAddress
Comment = $hostsEntry.Comment Comment = $hostsEntry.Comment
} }
New-Object PSObject -Property $properties New-Object PSObject -Property $properties
} }
} }
} }

Просмотреть файл

@ -1,295 +1,295 @@
<# <#
.SYNOPSIS .SYNOPSIS
Removes one or more hostnames from the hosts file. Removes one or more hostnames from the hosts file.
.DESCRIPTION .DESCRIPTION
The hosts file is used to map hostnames to IP addresses. The hosts file is used to map hostnames to IP addresses.
.PARAMETER Hostnames .PARAMETER Hostnames
One or more hostnames to remove from the hosts file. One or more hostnames to remove from the hosts file.
.EXAMPLE .EXAMPLE
.\Remove-Hostnames.ps1 foobar .\Remove-Hostnames.ps1 foobar
Description Description
----------- -----------
Assume the following line was previously added to the hosts file: Assume the following line was previously added to the hosts file:
127.0.0.1 foobar 127.0.0.1 foobar
After running "Remove-Hostnames.ps1 foobar" the hosts file no longer contains this After running "Remove-Hostnames.ps1 foobar" the hosts file no longer contains this
line. line.
.EXAMPLE .EXAMPLE
.\Remove-Hostnames.ps1 foo .\Remove-Hostnames.ps1 foo
Description Description
----------- -----------
Assume the following line was previously added to the hosts file: Assume the following line was previously added to the hosts file:
127.0.0.1 foobar foo bar 127.0.0.1 foobar foo bar
After running "Remove-Hostnames.ps1 foo" the line in the hosts file is updated After running "Remove-Hostnames.ps1 foo" the line in the hosts file is updated
to remove the specified hostname ("foo"): to remove the specified hostname ("foo"):
127.0.0.1 foobar bar 127.0.0.1 foobar bar
.EXAMPLE .EXAMPLE
.\Remove-Hostnames.ps1 foo, bar .\Remove-Hostnames.ps1 foo, bar
Description Description
----------- -----------
Assume the following line was previously added to the hosts file: Assume the following line was previously added to the hosts file:
127.0.0.1 foobar foo bar 127.0.0.1 foobar foo bar
After running "Remove-Hostnames.ps1 foo, bar" the line in the hosts file is updated to After running "Remove-Hostnames.ps1 foo, bar" the line in the hosts file is updated to
remove the specified hostnames ("foo" and "bar"): remove the specified hostnames ("foo" and "bar"):
127.0.0.1 foobar 127.0.0.1 foobar
.NOTES .NOTES
This script must be run with administrator privileges. This script must be run with administrator privileges.
#> #>
param( param(
[parameter(Mandatory = $true, ValueFromPipeline = $true)] [parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string[]] $Hostnames [string[]] $Hostnames
) )
begin begin
{ {
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
function CreateHostsEntryObject( function CreateHostsEntryObject(
[string] $ipAddress, [string] $ipAddress,
[string[]] $hostnames, [string[]] $hostnames,
<# [string] #> $comment) #HACK: never $null if type is specified <# [string] #> $comment) #HACK: never $null if type is specified
{ {
$hostsEntry = New-Object PSObject $hostsEntry = New-Object PSObject
$hostsEntry | Add-Member NoteProperty -Name "IpAddress" ` $hostsEntry | Add-Member NoteProperty -Name "IpAddress" `
-Value $ipAddress -Value $ipAddress
[System.Collections.ArrayList] $hostnamesList = [System.Collections.ArrayList] $hostnamesList =
New-Object System.Collections.ArrayList New-Object System.Collections.ArrayList
$hostsEntry | Add-Member NoteProperty -Name "Hostnames" ` $hostsEntry | Add-Member NoteProperty -Name "Hostnames" `
-Value $hostnamesList -Value $hostnamesList
If ($hostnames -ne $null) If ($hostnames -ne $null)
{ {
$hostnames | foreach { $hostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
$hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment $hostsEntry | Add-Member NoteProperty -Name "Comment" -Value $comment
return $hostsEntry return $hostsEntry
} }
function ParseHostsEntry( function ParseHostsEntry(
[string] $line) [string] $line)
{ {
$hostsEntry = CreateHostsEntryObject $hostsEntry = CreateHostsEntryObject
Write-Debug "Parsing hosts entry: $line" Write-Debug "Parsing hosts entry: $line"
If ($line.Contains("#") -eq $true) If ($line.Contains("#") -eq $true)
{ {
If ($line -eq "#") If ($line -eq "#")
{ {
$hostsEntry.Comment = [string]::Empty $hostsEntry.Comment = [string]::Empty
} }
Else Else
{ {
$hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1) $hostsEntry.Comment = $line.Substring($line.IndexOf("#") + 1)
} }
$line = $line.Substring(0, $line.IndexOf("#")) $line = $line.Substring(0, $line.IndexOf("#"))
} }
$line = $line.Trim() $line = $line.Trim()
If ($line.Length -gt 0) If ($line.Length -gt 0)
{ {
$hostsEntry.IpAddress = ($line -Split "\s+")[0] $hostsEntry.IpAddress = ($line -Split "\s+")[0]
Write-Debug "Parsed address: $($hostsEntry.IpAddress)" Write-Debug "Parsed address: $($hostsEntry.IpAddress)"
[string[]] $parsedHostnames = $line.Substring( [string[]] $parsedHostnames = $line.Substring(
$hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+" $hostsEntry.IpAddress.Length + 1).Trim() -Split "\s+"
Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" ` Write-Debug ("Parsed hostnames ($($parsedHostnames.Length)):" `
+ " $parsedHostnames") + " $parsedHostnames")
$parsedHostnames | foreach { $parsedHostnames | foreach {
$hostsEntry.Hostnames.Add($_) | Out-Null $hostsEntry.Hostnames.Add($_) | Out-Null
} }
} }
return $hostsEntry return $hostsEntry
} }
function ParseHostsFile function ParseHostsFile
{ {
$hostsEntries = New-Object System.Collections.ArrayList $hostsEntries = New-Object System.Collections.ArrayList
[string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts" [string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts"
If ((Test-Path $hostsFile) -eq $false) If ((Test-Path $hostsFile) -eq $false)
{ {
Write-Verbose "Hosts file does not exist." Write-Verbose "Hosts file does not exist."
} }
Else Else
{ {
[string[]] $hostsContent = Get-Content $hostsFile [string[]] $hostsContent = Get-Content $hostsFile
$hostsContent | foreach { $hostsContent | foreach {
$hostsEntry = ParseHostsEntry $_ $hostsEntry = ParseHostsEntry $_
$hostsEntries.Add($hostsEntry) | Out-Null $hostsEntries.Add($hostsEntry) | Out-Null
} }
} }
# HACK: Return an array (containing the ArrayList) to avoid issue with # HACK: Return an array (containing the ArrayList) to avoid issue with
# PowerShell returning $null (when hosts file does not exist) # PowerShell returning $null (when hosts file does not exist)
return ,$hostsEntries return ,$hostsEntries
} }
function UpdateHostsFile( function UpdateHostsFile(
$hostsEntries = $(Throw "Value cannot be null: hostsEntries")) $hostsEntries = $(Throw "Value cannot be null: hostsEntries"))
{ {
Write-Verbose "Updatings hosts file..." Write-Verbose "Updatings hosts file..."
[string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts" [string] $hostsFile = $env:WINDIR + "\System32\drivers\etc\hosts"
$buffer = New-Object System.Text.StringBuilder $buffer = New-Object System.Text.StringBuilder
$hostsEntries | foreach { $hostsEntries | foreach {
If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false) If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false)
{ {
$buffer.Append($_.IpAddress) | Out-Null $buffer.Append($_.IpAddress) | Out-Null
$buffer.Append("`t") | Out-Null $buffer.Append("`t") | Out-Null
} }
If ($_.Hostnames -ne $null) If ($_.Hostnames -ne $null)
{ {
[bool] $firstHostname = $true [bool] $firstHostname = $true
$_.Hostnames | foreach { $_.Hostnames | foreach {
If ($firstHostname -eq $false) If ($firstHostname -eq $false)
{ {
$buffer.Append(" ") | Out-Null $buffer.Append(" ") | Out-Null
} }
Else Else
{ {
$firstHostname = $false $firstHostname = $false
} }
$buffer.Append($_) | Out-Null $buffer.Append($_) | Out-Null
} }
} }
If ($_.Comment -ne $null) If ($_.Comment -ne $null)
{ {
If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false) If ([string]::IsNullOrEmpty($_.IpAddress) -eq $false)
{ {
$buffer.Append(" ") | Out-Null $buffer.Append(" ") | Out-Null
} }
$buffer.Append("#") | Out-Null $buffer.Append("#") | Out-Null
$buffer.Append($_.Comment) | Out-Null $buffer.Append($_.Comment) | Out-Null
} }
$buffer.Append([System.Environment]::NewLine) | Out-Null $buffer.Append([System.Environment]::NewLine) | Out-Null
} }
[string] $hostsContent = $buffer.ToString() [string] $hostsContent = $buffer.ToString()
$hostsContent = $hostsContent.Trim() $hostsContent = $hostsContent.Trim()
Set-Content -Path $hostsFile -Value $hostsContent -Force -Encoding ASCII Set-Content -Path $hostsFile -Value $hostsContent -Force -Encoding ASCII
Write-Verbose "Successfully updated hosts file." Write-Verbose "Successfully updated hosts file."
} }
[bool] $isInputFromPipeline = [bool] $isInputFromPipeline =
($PSBoundParameters.ContainsKey("Hostnames") -eq $false) ($PSBoundParameters.ContainsKey("Hostnames") -eq $false)
[int] $pendingUpdates = 0 [int] $pendingUpdates = 0
[Collections.ArrayList] $hostsEntries = ParseHostsFile [Collections.ArrayList] $hostsEntries = ParseHostsFile
} }
process process
{ {
If ($isInputFromPipeline -eq $true) If ($isInputFromPipeline -eq $true)
{ {
$items = $_ $items = $_
} }
Else Else
{ {
$items = $Hostnames $items = $Hostnames
} }
$items | foreach { $items | foreach {
[string] $hostname = $_ [string] $hostname = $_
for ([int] $i = 0; $i -lt $hostsEntries.Count; $i++) for ([int] $i = 0; $i -lt $hostsEntries.Count; $i++)
{ {
$hostsEntry = $hostsEntries[$i] $hostsEntry = $hostsEntries[$i]
Write-Debug "Hosts entry: $hostsEntry" Write-Debug "Hosts entry: $hostsEntry"
If ($hostsEntry.Hostnames.Count -eq 0) If ($hostsEntry.Hostnames.Count -eq 0)
{ {
continue continue
} }
for ([int] $j = 0; $j -lt $hostsEntry.Hostnames.Count; $j++) for ([int] $j = 0; $j -lt $hostsEntry.Hostnames.Count; $j++)
{ {
[string] $parsedHostname = $hostsEntry.Hostnames[$j] [string] $parsedHostname = $hostsEntry.Hostnames[$j]
Write-Debug ("Comparing specified hostname" ` Write-Debug ("Comparing specified hostname" `
+ " ($hostname) to existing hostname" ` + " ($hostname) to existing hostname" `
+ " ($parsedHostname)...") + " ($parsedHostname)...")
If ([string]::Compare($hostname, $parsedHostname, $true) -eq 0) If ([string]::Compare($hostname, $parsedHostname, $true) -eq 0)
{ {
Write-Debug "Removing hostname ($hostname) from host entry ($hostsEntry)..." Write-Debug "Removing hostname ($hostname) from host entry ($hostsEntry)..."
$hostsEntry.Hostnames.RemoveAt($j) $hostsEntry.Hostnames.RemoveAt($j)
$j-- $j--
$pendingUpdates++ $pendingUpdates++
} }
} }
If ($hostsEntry.Hostnames.Count -eq 0) If ($hostsEntry.Hostnames.Count -eq 0)
{ {
Write-Debug ("Removing host entry (because it no longer specifies" ` Write-Debug ("Removing host entry (because it no longer specifies" `
+ " any hostnames)...") + " any hostnames)...")
$hostsEntries.RemoveAt($i) $hostsEntries.RemoveAt($i)
$i-- $i--
} }
} }
} }
} }
end end
{ {
If ($pendingUpdates -eq 0) If ($pendingUpdates -eq 0)
{ {
Write-Verbose "No changes to the hosts file are necessary." Write-Verbose "No changes to the hosts file are necessary."
return return
} }
Write-Verbose ("There are $pendingUpdates pending update(s) to the hosts" ` Write-Verbose ("There are $pendingUpdates pending update(s) to the hosts" `
+ " file.") + " file.")
UpdateHostsFile $hostsEntries UpdateHostsFile $hostsEntries
} }

Просмотреть файл

@ -1,80 +1,80 @@
{ {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
"parameters": { "parameters": {
"relay_namespace": { "relay_namespace": {
"type": "String" "type": "String"
}, },
"location": { "location": {
"type": "String" "type": "String"
} }
}, },
"variables": { "variables": {
"apiVersion": "2017-04-01" "apiVersion": "2017-04-01"
}, },
"resources": [{ "resources": [{
"type": "Microsoft.Relay/namespaces", "type": "Microsoft.Relay/namespaces",
"name": "[parameters('relay_namespace')]", "name": "[parameters('relay_namespace')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
"location": "[parameters('location')]", "location": "[parameters('location')]",
"dependsOn": [] "dependsOn": []
}, },
{ {
"type": "Microsoft.Relay/namespaces/AuthorizationRules", "type": "Microsoft.Relay/namespaces/AuthorizationRules",
"name": "[concat(parameters('relay_namespace'), '/sendlisten')]", "name": "[concat(parameters('relay_namespace'), '/sendlisten')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
"properties": { "properties": {
"rights": [ "rights": [
"Send", "Send",
"Listen" "Listen"
] ]
}, },
"dependsOn": [ "dependsOn": [
"[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]" "[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]"
] ]
}, },
{ {
"type": "Microsoft.Relay/namespaces/hybridConnections", "type": "Microsoft.Relay/namespaces/hybridConnections",
"name": "[concat(parameters('relay_namespace'), '/a1')]", "name": "[concat(parameters('relay_namespace'), '/a1')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
"properties": { "properties": {
"requiresClientAuthorization": true "requiresClientAuthorization": true
}, },
"dependsOn": [ "dependsOn": [
"[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]" "[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]"
] ]
}, },
{ {
"type": "Microsoft.Relay/namespaces/hybridConnections", "type": "Microsoft.Relay/namespaces/hybridConnections",
"name": "[concat(parameters('relay_namespace'), '/a2')]", "name": "[concat(parameters('relay_namespace'), '/a2')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
"properties": { "properties": {
"requiresClientAuthorization": true "requiresClientAuthorization": true
}, },
"dependsOn": [ "dependsOn": [
"[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]" "[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]"
] ]
}, },
{ {
"type": "Microsoft.Relay/namespaces/hybridConnections", "type": "Microsoft.Relay/namespaces/hybridConnections",
"name": "[concat(parameters('relay_namespace'), '/a3')]", "name": "[concat(parameters('relay_namespace'), '/a3')]",
"apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
"properties": { "properties": {
"requiresClientAuthorization": true "requiresClientAuthorization": true
}, },
"dependsOn": [ "dependsOn": [
"[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]" "[resourceId('Microsoft.Relay/namespaces', parameters('relay_namespace'))]"
] ]
} }
], ],
"outputs": { "outputs": {
"serviceBusNamespaceName": { "serviceBusNamespaceName": {
"type": "string", "type": "string",
"value": "[parameters('relay_namespace')]" "value": "[parameters('relay_namespace')]"
}, },
"sendListenConnectionString": { "sendListenConnectionString": {
"type": "string", "type": "string",
"value": "[listkeys(resourceId('Microsoft.Relay/namespaces/AuthorizationRules', parameters('relay_namespace'), 'sendlisten'),variables('apiVersion')).primaryConnectionString]" "value": "[listkeys(resourceId('Microsoft.Relay/namespaces/AuthorizationRules', parameters('relay_namespace'), 'sendlisten'),variables('apiVersion')).primaryConnectionString]"
} }
} }
} }

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -1,10 +1,10 @@
node_modules node_modules
npm-debug.log npm-debug.log
Dockerfile* Dockerfile*
docker-compose* docker-compose*
.dockerignore .dockerignore
.git .git
.gitignore .gitignore
README.md README.md
LICENSE LICENSE
.vscode .vscode

2
test/docker/.gitattributes поставляемый
Просмотреть файл

@ -1 +1 @@
*.txt eol=lf *.txt eol=lf

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -1,18 +1,18 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<OutputType>None</OutputType> <OutputType>None</OutputType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectsToBuild Include="**\*proj" Exclude="$(MSBuildProjectFile)"/> <ProjectsToBuild Include="**\*proj" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup> </ItemGroup>
<Target Name="Build"> <Target Name="Build">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Build" /> <MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Build" />
</Target> </Target>
<Target Name="VSTest"> <Target Name="VSTest">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="VSTest"/> <MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="VSTest"/>
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Clean"/> <MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Clean"/>
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,23 +1,23 @@
@echo off @echo off
SET _CXNSTRING= SET _CXNSTRING=
FOR /F "delims=" %%i IN (%AZBRIDGE_TEST_CXNSTRING%) DO SET _CXNSTRING=%%i FOR /F "delims=" %%i IN (%AZBRIDGE_TEST_CXNSTRING%) DO SET _CXNSTRING=%%i
if "%_CXNSTRING%" == "" ( if "%_CXNSTRING%" == "" (
echo AZBRIDGE_TEST_CXNSTRING environment variable must be set to valid relay connection string echo AZBRIDGE_TEST_CXNSTRING environment variable must be set to valid relay connection string
exit /b exit /b
) )
set _IMAGE_ID= set _IMAGE_ID=
rem for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i rem for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i
rem if "%_IMAGE_ID%"=="" call build.cmd rem if "%_IMAGE_ID%"=="" call build.cmd
FOR /F %%i IN ("%cd%\..") DO set _MOUNTPATH=%%~fi FOR /F %%i IN ("%cd%\..") DO set _MOUNTPATH=%%~fi
set _TESTNAME=test_nc_ping_pong set _TESTNAME=test_nc_ping_pong
call ../_scripts/runtest.cmd call ../_scripts/runtest.cmd
if NOT "%_RESULT%"=="0" exit /b %_RESULT% if NOT "%_RESULT%"=="0" exit /b %_RESULT%
set _TESTNAME=test_nc_config_ping_pong set _TESTNAME=test_nc_config_ping_pong
call ../_scripts/runtest.cmd call ../_scripts/runtest.cmd
exit /b %_RESULT% exit /b %_RESULT%

Просмотреть файл

@ -1,4 +1,4 @@
set _IMAGE_ID= set _IMAGE_ID=
for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i
if "%_IMAGE_ID%"=="" exit /b if "%_IMAGE_ID%"=="" exit /b
docker rmi -f %IMAGE_NAME%:latest docker rmi -f %IMAGE_NAME%:latest

Просмотреть файл

@ -1,21 +1,21 @@
@echo off @echo off
echo Running %_TESTNAME% echo Running %_TESTNAME%
set _OUTFILE=%temp%\azbridge-tests-%_TESTNAME%.output.txt set _OUTFILE=%temp%\azbridge-tests-%_TESTNAME%.output.txt
docker run -v %_MOUNTPATH%:/tests -e AZBRIDGE_TEST_CXNSTRING="%_CXNSTRING%" --rm %IMAGE_NAME%:latest bash /tests/%_TESTNAME%.sh > %_OUTFILE% docker run -v %_MOUNTPATH%:/tests -e AZBRIDGE_TEST_CXNSTRING="%_CXNSTRING%" --rm %IMAGE_NAME%:latest bash /tests/%_TESTNAME%.sh > %_OUTFILE%
if exist %_MOUNTPATH%\%_TESTNAME%.reference.txt ( if exist %_MOUNTPATH%\%_TESTNAME%.reference.txt (
fc /L %_MOUNTPATH%\%_TESTNAME%.reference.txt %_OUTFILE% > NUL fc /L %_MOUNTPATH%\%_TESTNAME%.reference.txt %_OUTFILE% > NUL
if ERRORLEVEL 1 ( if ERRORLEVEL 1 (
set _RESULT=%ERRORLEVEL% set _RESULT=%ERRORLEVEL%
type %_OUTFILE% type %_OUTFILE%
echo Error %_RESULT% echo Error %_RESULT%
) )
if ERRORLEVEL 0 ( if ERRORLEVEL 0 (
set _RESULT=0 set _RESULT=0
echo OK echo OK
) )
del %_OUTFILE% del %_OUTFILE%
) else ( ) else (
copy /Y %_OUTFILE% %_MOUNTPATH%\%_TESTNAME%.reference.txt > NUL copy /Y %_OUTFILE% %_MOUNTPATH%\%_TESTNAME%.reference.txt > NUL
set _RESULT=%ERRORLEVEL% set _RESULT=%ERRORLEVEL%
) )
exit /b %_RESULT% exit /b %_RESULT%

Просмотреть файл

@ -1,12 +1,12 @@
FROM centos AS build FROM centos AS build
ARG rpm_package ARG rpm_package
WORKDIR /tmp WORKDIR /tmp
COPY ./tmp/$rpm_package . COPY ./tmp/$rpm_package .
USER root USER root
# temporary workaround for RPM packaging issue # temporary workaround for RPM packaging issue
RUN sed -i '/tsflags=nodocs/d' /etc/yum.conf RUN sed -i '/tsflags=nodocs/d' /etc/yum.conf
RUN yum update -y RUN yum update -y
RUN useradd -ms /bin/bash azbridge RUN useradd -ms /bin/bash azbridge
RUN yum install -y $rpm_package RUN yum install -y $rpm_package
RUN yum install -y nc findutils RUN yum install -y nc findutils
USER azbridge USER azbridge

Просмотреть файл

@ -1,19 +1,19 @@
<Project> <Project>
<Import Project="..\..\..\version.props" /> <Import Project="..\..\..\version.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>None</OutputType> <OutputType>None</OutputType>
</PropertyGroup> </PropertyGroup>
<Target Name="Build"> <Target Name="Build">
<Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="VSTest"> <Target Name="VSTest">
<Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,19 +1,19 @@
@echo off @echo off
if not "%1" == "" set BuildNumber=%1 if not "%1" == "" set BuildNumber=%1
if not "%2" == "" set VersionPrefix=%2 if not "%2" == "" set VersionPrefix=%2
if not "%3" == "" set VersionSuffix=%3 if not "%3" == "" set VersionSuffix=%3
if not "%4" == "" set TargetFramework=%4 if not "%4" == "" set TargetFramework=%4
if "%BuildNumber%"=="" set BuildNumber=0000 if "%BuildNumber%"=="" set BuildNumber=0000
if "%VersionSuffix%"=="" set VersionSuffix=preview if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0 if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework=netcoreapp2.1 if "%TargetFramework%"=="" set TargetFramework=netcoreapp3.0
pushd "%~dp0" pushd "%~dp0"
if not exist "tmp" mkdir tmp if not exist "tmp" mkdir tmp
set RpmFile=azbridge.%VersionPrefix%-%VersionSuffix%.centos-x64.rpm set RpmFile=azbridge.%VersionPrefix%-%VersionSuffix%.centos-x64.rpm
copy /y ..\..\..\artifacts\build\%TargetFramework%\%RpmFile% tmp > NUL copy /y ..\..\..\artifacts\build\%TargetFramework%\%RpmFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_centos_test --build-arg rpm_package=%RpmFile% docker build -f Dockerfile . --tag azbridge_centos_test --build-arg rpm_package=%RpmFile%
rd /s /q tmp rd /s /q tmp
popd popd

Просмотреть файл

@ -9,7 +9,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi if [ ! -d "tmp" ]; then mkdir tmp; fi

Просмотреть файл

@ -1,3 +1,3 @@
@echo off @echo off
set IMAGE_NAME=azbridge_centos_test set IMAGE_NAME=azbridge_centos_test
call ../_scripts/removeimage.cmd call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,7 +1,7 @@
@echo off @echo off
pushd "%~dp0" pushd "%~dp0"
SET IMAGE_NAME=azbridge_centos_test SET IMAGE_NAME=azbridge_centos_test
call ../_scripts/imagetests.cmd %* call ../_scripts/imagetests.cmd %*
popd popd
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%

Просмотреть файл

@ -9,7 +9,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge_centos_test IMAGE_NAME=azbridge_centos_test

Просмотреть файл

@ -1,14 +1,14 @@
FROM debian:jessie AS build FROM debian:jessie AS build
ARG deb_package ARG deb_package
WORKDIR /tmp WORKDIR /tmp
COPY ./tmp/$deb_package . COPY ./tmp/$deb_package .
USER root USER root
# temporary workaround for RPM packaging issue # temporary workaround for RPM packaging issue
# RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf # RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN apt-get update -y RUN apt-get update -y
#RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10 #RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10
RUN useradd -ms /bin/bash azbridge RUN useradd -ms /bin/bash azbridge
#RUN rpm -i $deb_package #RUN rpm -i $deb_package
RUN apt-get install -y netcat-openbsd findutils gdebi-core RUN apt-get install -y netcat-openbsd findutils gdebi-core
RUN gdebi -n $deb_package RUN gdebi -n $deb_package
USER azbridge USER azbridge

Просмотреть файл

@ -1,19 +1,19 @@
<Project> <Project>
<Import Project="..\..\..\version.props" /> <Import Project="..\..\..\version.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>None</OutputType> <OutputType>None</OutputType>
</PropertyGroup> </PropertyGroup>
<Target Name="Build"> <Target Name="Build">
<Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="VSTest"> <Target Name="VSTest">
<Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,20 +1,20 @@
@echo off @echo off
if not "%1" == "" set BuildNumber=%1 if not "%1" == "" set BuildNumber=%1
if not "%2" == "" set VersionPrefix=%2 if not "%2" == "" set VersionPrefix=%2
if not "%3" == "" set VersionSuffix=%3 if not "%3" == "" set VersionSuffix=%3
if not "%4" == "" set TargetFramework=%4 if not "%4" == "" set TargetFramework=%4
if "%BuildNumber%"=="" set BuildNumber=0000 if "%BuildNumber%"=="" set BuildNumber=0000
if "%VersionSuffix%"=="" set VersionSuffix=preview if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0 if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp2.1" if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0" pushd "%~dp0"
if not exist "tmp" mkdir tmp if not exist "tmp" mkdir tmp
set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.debian.8-x64.deb set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.debian.8-x64.deb
copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_debian8_test --build-arg deb_package=%DebFile% docker build -f Dockerfile . --tag azbridge_debian8_test --build-arg deb_package=%DebFile%
rd /s /q tmp rd /s /q tmp
popd popd

Просмотреть файл

@ -8,7 +8,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi if [ ! -d "tmp" ]; then mkdir tmp; fi

Просмотреть файл

@ -1,3 +1,3 @@
@echo off @echo off
set IMAGE_NAME=azbridge_debian8_test set IMAGE_NAME=azbridge_debian8_test
call ../_scripts/removeimage.cmd call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,7 +1,7 @@
@echo off @echo off
pushd "%~dp0" pushd "%~dp0"
SET IMAGE_NAME=azbridge_debian8_test SET IMAGE_NAME=azbridge_debian8_test
call ../_scripts/imagetests.cmd %* call ../_scripts/imagetests.cmd %*
popd popd
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%

Просмотреть файл

@ -9,7 +9,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge_debian8_test IMAGE_NAME=azbridge_debian8_test

Просмотреть файл

@ -1,14 +1,14 @@
FROM fedora AS build FROM fedora AS build
ARG rpm_package ARG rpm_package
WORKDIR /tmp WORKDIR /tmp
COPY ./tmp/$rpm_package . COPY ./tmp/$rpm_package .
USER root USER root
# temporary workaround for RPM packaging issue # temporary workaround for RPM packaging issue
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN yum update -y RUN yum update -y
#RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10 #RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10
RUN useradd -ms /bin/bash azbridge RUN useradd -ms /bin/bash azbridge
#RUN rpm -i $rpm_package #RUN rpm -i $rpm_package
RUN yum install -y $rpm_package RUN yum install -y $rpm_package
RUN yum install -y nc findutils RUN yum install -y nc findutils
USER azbridge USER azbridge

Просмотреть файл

@ -1,19 +1,19 @@
<Project> <Project>
<Import Project="..\..\..\version.props" /> <Import Project="..\..\..\version.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>None</OutputType> <OutputType>None</OutputType>
</PropertyGroup> </PropertyGroup>
<Target Name="Build"> <Target Name="Build">
<Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="VSTest"> <Target Name="VSTest">
<Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,19 +1,19 @@
@echo off @echo off
if not "%1" == "" set BuildNumber=%1 if not "%1" == "" set BuildNumber=%1
if not "%2" == "" set VersionPrefix=%2 if not "%2" == "" set VersionPrefix=%2
if not "%3" == "" set VersionSuffix=%3 if not "%3" == "" set VersionSuffix=%3
if not "%4" == "" set TargetFramework=%4 if not "%4" == "" set TargetFramework=%4
if "%BuildNumber%"=="" set BuildNumber=0000 if "%BuildNumber%"=="" set BuildNumber=0000
if "%VersionSuffix%"=="" set VersionSuffix=preview if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0 if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp2.1" if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0" pushd "%~dp0"
if not exist "tmp" mkdir tmp if not exist "tmp" mkdir tmp
set RpmFile=azbridge.%VersionPrefix%-%VersionSuffix%.fedora-x64.rpm set RpmFile=azbridge.%VersionPrefix%-%VersionSuffix%.fedora-x64.rpm
copy /y ..\..\..\artifacts\build\%TargetFramework%\%RpmFile% tmp > NUL copy /y ..\..\..\artifacts\build\%TargetFramework%\%RpmFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_fedora_test --build-arg rpm_package=%RpmFile% docker build -f Dockerfile . --tag azbridge_fedora_test --build-arg rpm_package=%RpmFile%
rd /s /q tmp rd /s /q tmp
popd popd

Просмотреть файл

@ -8,7 +8,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi if [ ! -d "tmp" ]; then mkdir tmp; fi

Просмотреть файл

@ -1,3 +1,3 @@
@echo off @echo off
set IMAGE_NAME=azbridge_fedora_test set IMAGE_NAME=azbridge_fedora_test
call ../_scripts/removeimage.cmd call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,7 +1,7 @@
@echo off @echo off
pushd "%~dp0" pushd "%~dp0"
SET IMAGE_NAME=azbridge_fedora_test SET IMAGE_NAME=azbridge_fedora_test
call ../_scripts/imagetests.cmd %* call ../_scripts/imagetests.cmd %*
popd popd
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%

Просмотреть файл

@ -9,7 +9,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null

Просмотреть файл

@ -1,6 +1,6 @@
LocalForward: LocalForward:
- RelayName: a1 - RelayName: a1
BindAddress: 127.0.8.1 BindAddress: 127.0.8.1
BindPort: 8888 BindPort: 8888
PortName: test PortName: test

Просмотреть файл

@ -1,5 +1,5 @@
RemoteForward: RemoteForward:
- RelayName: a1 - RelayName: a1
HostPort: 9999 HostPort: 9999
Host: localhost Host: localhost
PortName: test PortName: test

Просмотреть файл

@ -1,14 +1,14 @@
FROM ubuntu:xenial AS build FROM ubuntu:xenial AS build
ARG deb_package ARG deb_package
WORKDIR /tmp WORKDIR /tmp
COPY ./tmp/$deb_package . COPY ./tmp/$deb_package .
USER root USER root
# temporary workaround for RPM packaging issue # temporary workaround for RPM packaging issue
# RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf # RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN apt-get update -y RUN apt-get update -y
#RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10 #RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10
RUN useradd -ms /bin/bash azbridge RUN useradd -ms /bin/bash azbridge
#RUN rpm -i $deb_package #RUN rpm -i $deb_package
RUN apt-get install -y netcat-openbsd findutils gdebi-core RUN apt-get install -y netcat-openbsd findutils gdebi-core
RUN gdebi -n $deb_package RUN gdebi -n $deb_package
USER azbridge USER azbridge

Просмотреть файл

@ -1,19 +1,19 @@
<Project> <Project>
<Import Project="..\..\..\version.props" /> <Import Project="..\..\..\version.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>None</OutputType> <OutputType>None</OutputType>
</PropertyGroup> </PropertyGroup>
<Target Name="Build"> <Target Name="Build">
<Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="build.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./build.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="VSTest"> <Target Name="VSTest">
<Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="test.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./test.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/> <Exec Command="clean.cmd $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/> <Exec Command="bash ./clean.sh $(BuildNumber) $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,20 +1,20 @@
@echo off @echo off
if not "%1" == "" set BuildNumber=%1 if not "%1" == "" set BuildNumber=%1
if not "%2" == "" set VersionPrefix=%2 if not "%2" == "" set VersionPrefix=%2
if not "%3" == "" set VersionSuffix=%3 if not "%3" == "" set VersionSuffix=%3
if not "%4" == "" set TargetFramework=%4 if not "%4" == "" set TargetFramework=%4
if "%BuildNumber%"=="" set BuildNumber=0000 if "%BuildNumber%"=="" set BuildNumber=0000
if "%VersionSuffix%"=="" set VersionSuffix=preview if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0 if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp2.1" if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0" pushd "%~dp0"
if not exist "tmp" mkdir tmp if not exist "tmp" mkdir tmp
set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.ubuntu.16.04-x64.deb set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.ubuntu.16.04-x64.deb
copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_ubuntu1604_test --build-arg deb_package=%DebFile% docker build -f Dockerfile . --tag azbridge_ubuntu1604_test --build-arg deb_package=%DebFile%
rd /s /q tmp rd /s /q tmp
popd popd

Просмотреть файл

@ -8,7 +8,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi if [ ! -d "tmp" ]; then mkdir tmp; fi

Просмотреть файл

@ -1,3 +1,3 @@
@echo off @echo off
set IMAGE_NAME=azbridge_ubuntu1604_test set IMAGE_NAME=azbridge_ubuntu1604_test
call ../_scripts/removeimage.cmd call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,7 +1,7 @@
@echo off @echo off
pushd "%~dp0" pushd "%~dp0"
SET IMAGE_NAME=azbridge_ubuntu1604_test SET IMAGE_NAME=azbridge_ubuntu1604_test
call ../_scripts/imagetests.cmd %* call ../_scripts/imagetests.cmd %*
popd popd
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%

Просмотреть файл

@ -9,7 +9,7 @@ if [ ! -z $4 ]; then TargetFramework=$4; fi
if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi
if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi
if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi
if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.1'; fi if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null pushd "${0%/*}" > /dev/null

Просмотреть файл

@ -1,16 +1,16 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
<PropertyGroup> <PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms> <DeveloperBuildTestTfms>netcoreapp3.0</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms> <StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">$(StandardTestTfms)</StandardTestTfms> <StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">$(StandardTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms> <StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" /> <PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" /> <PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Просмотреть файл

@ -1,3 +1,3 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
</Project> </Project>

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<WindowsOnly>false</WindowsOnly> <WindowsOnly>false</WindowsOnly>
<WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks> <WindowsFrameworks Condition="'$(OS)'=='Windows_NT'">net462;</WindowsFrameworks>
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp2.1</CoreFrameworks> <CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks> <TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<!-- <TargetFrameworks>$(CoreFrameworks)</TargetFrameworks> --> <!-- <TargetFrameworks>$(CoreFrameworks)</TargetFrameworks> -->
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers> <WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>

Просмотреть файл

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup> <ItemGroup>
<ProjectReference Include="Microsoft.Azure.Relay.Bridge.Tests\Microsoft.Azure.Relay.Bridge.Tests.csproj" /> <ProjectReference Include="Microsoft.Azure.Relay.Bridge.Tests\Microsoft.Azure.Relay.Bridge.Tests.csproj" />
</ItemGroup> </ItemGroup>
<Target Name="BeforeBuild" DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences"/> <Target Name="BeforeBuild" DependsOnTargets="ResolveProjectReferences;ResolveAssemblyReferences"/>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="$(DotnetXunitPackageVersion)" /> <DotNetCliToolReference Include="dotnet-xunit" Version="$(DotnetXunitPackageVersion)" />
</ItemGroup> </ItemGroup>
<Target Name="VSTest"> <Target Name="VSTest">
<xunit Assemblies="@(_ResolveAssemblyReferenceResolvedFiles)" /> <xunit Assemblies="@(_ResolveAssemblyReferenceResolvedFiles)" />
</Target> </Target>
</Project> </Project>

Просмотреть файл

@ -1,10 +1,10 @@
pushd "%~dp0" pushd "%~dp0"
set xunitrunner=%userprofile%\.nuget\packages\dotnet-xunit\2.3.1\tools\net452\xunit.console.exe set xunitrunner=%userprofile%\.nuget\packages\dotnet-xunit\2.3.1\tools\net452\xunit.console.exe
%xunitrunner% -? 2>&1 > NUL %xunitrunner% -? 2>&1 > NUL
if ERRORLEVEL 1 set xunitrunner=C:\Tools\xUnit20\xunit.console.exe if ERRORLEVEL 1 set xunitrunner=C:\Tools\xUnit20\xunit.console.exe
"%xunitrunner%" "test\unit\Microsoft.Azure.Relay.Bridge.Tests\bin\Debug\net462\Microsoft.Azure.Relay.Bridge.Tests.dll" -appveyor "%xunitrunner%" "test\unit\Microsoft.Azure.Relay.Bridge.Tests\bin\Debug\net462\Microsoft.Azure.Relay.Bridge.Tests.dll" -appveyor
rem cd test\docker rem cd test\docker
rem msbuild /t:clean,build,vstest rem msbuild /t:clean,build,vstest
popd popd

Просмотреть файл

@ -5,6 +5,6 @@ if [ ! -z $APPVEYOR_BUILD_VERSION ]; then _VersionProp="/p:VersionPrefix=$APPVEY
dotnet test --verbosity=normal dotnet test --verbosity=normal
cd test/docker cd test/docker
dotnet clean --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp2.1 $_BuildProp $_VersionProp $@ dotnet clean --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp3.0 $_BuildProp $_VersionProp $@
dotnet build --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp2.1 $_BuildProp $_VersionProp $@ dotnet build --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp3.0 $_BuildProp $_VersionProp $@
dotnet test --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp2.1 $_BuildProp $_VersionProp $@ dotnet test --verbosity=normal /p:Configuration=Debug /p:TargetFramework=netcoreapp3.0 $_BuildProp $_VersionProp $@

Просмотреть файл

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<VersionPrefix>0.1.1</VersionPrefix> <VersionPrefix>0.1.1</VersionPrefix>
<BuildNumber></BuildNumber> <BuildNumber></BuildNumber>
<VersionSuffix>preview</VersionSuffix> <VersionSuffix>preview</VersionSuffix>
</PropertyGroup> </PropertyGroup>
</Project> </Project>