Path: blob/dev/pkg/js/libs/oracle/oracledialer.go
2858 views
package oracle12import (3"context"4"fmt"5"net"6"time"78"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"9)1011// oracleCustomDialer implements the dialer interface expected by go-ora12type oracleCustomDialer struct {13executionId string14}1516func (o *oracleCustomDialer) dialWithCtx(ctx context.Context, network, address string) (net.Conn, error) {17dialers := protocolstate.GetDialersWithId(o.executionId)18if dialers == nil {19return nil, fmt.Errorf("dialers not initialized for %s", o.executionId)20}21if !protocolstate.IsHostAllowed(o.executionId, address) {22// host is not valid according to network policy23return nil, protocolstate.ErrHostDenied.Msgf(address)24}25return dialers.Fastdialer.Dial(ctx, network, address)26}2728func (o *oracleCustomDialer) Dial(network, address string) (net.Conn, error) {29return o.dialWithCtx(context.TODO(), network, address)30}3132func (o *oracleCustomDialer) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error) {33ctx, cancel := context.WithTimeout(context.Background(), timeout)34defer cancel()3536return o.dialWithCtx(ctx, network, address)37}3839func (o *oracleCustomDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {40return o.dialWithCtx(ctx, network, address)41}424344