Skip to content

Commit

Permalink
Apply DomainStrategy to outbound target
Browse files Browse the repository at this point in the history
  • Loading branch information
Vigilans committed Jun 6, 2023
1 parent 2ac0188 commit c9d3fd3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/proxyman/outbound/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ func (h *Handler) Tag() string {

// Dispatch implements proxy.Outbound.Dispatch.
func (h *Handler) Dispatch(ctx context.Context, link *transport.Link) {
if h.senderSettings != nil && h.senderSettings.DomainStrategy != proxyman.SenderConfig_AS_IS {
outbound := session.OutboundFromContext(ctx)
if outbound == nil {
outbound = new(session.Outbound)
ctx = session.ContextWithOutbound(ctx, outbound)
}
if outbound.Target.Address != nil && outbound.Target.Address.Family().IsDomain() {
outbound.Target.Address = h.resolveIP(ctx, outbound.Target.Address.Domain(), h.Address())
}
}
if h.mux != nil && (h.mux.Enabled || session.MuxPreferedFromContext(ctx)) {
if err := h.mux.Dispatch(ctx, link); err != nil {
err := newError("failed to process mux outbound traffic").Base(err)
Expand Down

0 comments on commit c9d3fd3

Please sign in to comment.